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);
|
static void gui_statusbar_icon_recording_info(struct screen * display);
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_RTC
|
#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
|
||||||
#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 */
|
bar->info.led = led_read(HZ/2); /* delay should match polling interval */
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
{
|
bar->info.time = get_time();
|
||||||
struct tm* tm = get_time();
|
|
||||||
bar->info.hour = tm->tm_hour;
|
|
||||||
bar->info.minute = tm->tm_min;
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_RTC */
|
#endif /* CONFIG_RTC */
|
||||||
|
|
||||||
/* only redraw if forced to, or info has changed */
|
/* 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);
|
gui_statusbar_icon_lock_remote(display);
|
||||||
#endif
|
#endif
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
gui_statusbar_time(display, bar->info.hour, bar->info.minute);
|
gui_statusbar_time(display, bar->info.time);
|
||||||
#endif /* CONFIG_RTC */
|
#endif /* CONFIG_RTC */
|
||||||
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
|
||||||
if(!display->has_disk_led && bar->info.led)
|
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
|
* 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 char buffer[6];
|
||||||
unsigned int width, height;
|
unsigned int width, height;
|
||||||
if ( hour >= 0 &&
|
int hour, minute;
|
||||||
hour <= 23 &&
|
if ( valid_time(time) ) {
|
||||||
minute >= 0 &&
|
hour = time->tm_hour;
|
||||||
minute <= 59 ) {
|
minute = time->tm_min;
|
||||||
if ( global_settings.timeformat ) { /* 12 hour clock */
|
if ( global_settings.timeformat ) { /* 12 hour clock */
|
||||||
hour %= 12;
|
hour %= 12;
|
||||||
if ( hour == 0 ) {
|
if ( hour == 0 ) {
|
||||||
|
|
|
@ -34,8 +34,7 @@ struct status_info {
|
||||||
int playmode;
|
int playmode;
|
||||||
int repeat;
|
int repeat;
|
||||||
#if CONFIG_RTC
|
#if CONFIG_RTC
|
||||||
int hour;
|
struct tm *time;
|
||||||
int minute;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_CHARGING
|
#if CONFIG_CHARGING
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue