summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 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);
142static void gui_statusbar_icon_recording_info(struct screen * display); 142static void gui_statusbar_icon_recording_info(struct screen * display);
143#endif 143#endif
144#if CONFIG_RTC 144#if CONFIG_RTC
145static void gui_statusbar_time(struct screen * display, int hour, int minute); 145static void gui_statusbar_time(struct screen * display, struct tm *time);
146#endif 146#endif
147#endif 147#endif
148 148
@@ -239,11 +239,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
239 bar->info.led = led_read(HZ/2); /* delay should match polling interval */ 239 bar->info.led = led_read(HZ/2); /* delay should match polling interval */
240#endif 240#endif
241#if CONFIG_RTC 241#if CONFIG_RTC
242 { 242 bar->info.time = get_time();
243 struct tm* tm = get_time();
244 bar->info.hour = tm->tm_hour;
245 bar->info.minute = tm->tm_min;
246 }
247#endif /* CONFIG_RTC */ 243#endif /* CONFIG_RTC */
248 244
249 /* only redraw if forced to, or info has changed */ 245 /* only redraw if forced to, or info has changed */
@@ -317,7 +313,7 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
317 gui_statusbar_icon_lock_remote(display); 313 gui_statusbar_icon_lock_remote(display);
318#endif 314#endif
319#if CONFIG_RTC 315#if CONFIG_RTC
320 gui_statusbar_time(display, bar->info.hour, bar->info.minute); 316 gui_statusbar_time(display, bar->info.time);
321#endif /* CONFIG_RTC */ 317#endif /* CONFIG_RTC */
322#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 318#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
323 if(!display->has_disk_led && bar->info.led) 319 if(!display->has_disk_led && bar->info.led)
@@ -577,14 +573,14 @@ static void gui_statusbar_led(struct screen * display)
577/* 573/*
578 * Print time to status bar 574 * Print time to status bar
579 */ 575 */
580static void gui_statusbar_time(struct screen * display, int hour, int minute) 576static void gui_statusbar_time(struct screen * display, struct tm *time)
581{ 577{
582 unsigned char buffer[6]; 578 unsigned char buffer[6];
583 unsigned int width, height; 579 unsigned int width, height;
584 if ( hour >= 0 && 580 int hour, minute;
585 hour <= 23 && 581 if ( valid_time(time) ) {
586 minute >= 0 && 582 hour = time->tm_hour;
587 minute <= 59 ) { 583 minute = time->tm_min;
588 if ( global_settings.timeformat ) { /* 12 hour clock */ 584 if ( global_settings.timeformat ) { /* 12 hour clock */
589 hour %= 12; 585 hour %= 12;
590 if ( hour == 0 ) { 586 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 {
34 int playmode; 34 int playmode;
35 int repeat; 35 int repeat;
36#if CONFIG_RTC 36#if CONFIG_RTC
37 int hour; 37 struct tm *time;
38 int minute;
39#endif 38#endif
40 39
41#if CONFIG_CHARGING 40#if CONFIG_CHARGING