From 3f95ea53b0404299eb4068667bb33804387fdda9 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Thu, 28 Jun 2007 13:51:44 +0000 Subject: 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 --- apps/gui/statusbar.c | 20 ++++++++------------ apps/gui/statusbar.h | 3 +-- 2 files changed, 9 insertions(+), 14 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 9eb766f054..bbf01abd7c 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 21f98336d0..2be765b8e8 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 -- cgit v1.2.3