summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-06-28 13:51:44 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-06-28 13:51:44 +0000
commit3f95ea53b0404299eb4068667bb33804387fdda9 (patch)
treef021879b2a9fd7582ce4d98d04f23a3439874797 /apps/gui
parent0350bf225234ca22460a758e9e7d007236256efc (diff)
downloadrockbox-3f95ea53b0404299eb4068667bb33804387fdda9.zip
rockbox-3f95ea53b0404299eb4068667bb33804387fdda9.tar.gz
rockbox-3f95ea53b0404299eb4068667bb33804387fdda9.tar.bz2
rockbox-3f95ea53b0404299eb4068667bb33804387fdda9.tar.xz
Make the time in the statusbar always display --:-- when the RTC isn't set
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13729 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/statusbar.c20
-rw-r--r--apps/gui/statusbar.h3
2 files changed, 9 insertions, 14 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index 9eb766f..bbf01ab 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -142,7 +142,7 @@ static void gui_statusbar_led(struct screen * display);
static void gui_statusbar_icon_recording_info(struct screen * display);
#endif
#if CONFIG_RTC
-static void gui_statusbar_time(struct screen * display, int hour, int minute);
+static void gui_statusbar_time(struct screen * display, struct tm *time);
#endif
#endif
@@ -239,11 +239,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
bar->info.led = led_read(HZ/2); /* delay should match polling interval */
#endif
#if CONFIG_RTC
- {
- struct tm* tm = get_time();
- bar->info.hour = tm->tm_hour;
- bar->info.minute = tm->tm_min;
- }
+ bar->info.time = get_time();
#endif /* CONFIG_RTC */
/* only redraw if forced to, or info has changed */
@@ -317,7 +313,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
gui_statusbar_icon_lock_remote(display);
#endif
#if CONFIG_RTC
- gui_statusbar_time(display, bar->info.hour, bar->info.minute);
+ gui_statusbar_time(display, bar->info.time);
#endif /* CONFIG_RTC */
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
if(!display->has_disk_led && bar->info.led)
@@ -577,14 +573,14 @@ static void gui_statusbar_led(struct screen * display)
/*
* Print time to status bar
*/
-static void gui_statusbar_time(struct screen * display, int hour, int minute)
+static void gui_statusbar_time(struct screen * display, struct tm *time)
{
unsigned char buffer[6];
unsigned int width, height;
- if ( hour >= 0 &&
- hour <= 23 &&
- minute >= 0 &&
- minute <= 59 ) {
+ int hour, minute;
+ if ( valid_time(time) ) {
+ hour = time->tm_hour;
+ minute = time->tm_min;
if ( global_settings.timeformat ) { /* 12 hour clock */
hour %= 12;
if ( hour == 0 ) {
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index 21f9833..2be765b 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -34,8 +34,7 @@ struct status_info {
int playmode;
int repeat;
#if CONFIG_RTC
- int hour;
- int minute;
+ struct tm *time;
#endif
#if CONFIG_CHARGING