forked from len0rd/rockbox
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
This commit is contained in:
parent
0350bf2252
commit
3f95ea53b0
2 changed files with 9 additions and 14 deletions
|
@ -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 ) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue