diff options
author | Uwe Freese <thebreaker@rockbox.org> | 2003-03-03 14:23:39 +0000 |
---|---|---|
committer | Uwe Freese <thebreaker@rockbox.org> | 2003-03-03 14:23:39 +0000 |
commit | 5bfa9b7548ce8122a2f49f2781014b9db6123243 (patch) | |
tree | d91955103487c073e405202fe7689379514a1bc5 /apps/alarm_menu.c | |
parent | 21130ebc29053b3f8e8ac43ed1b8b29cb756a0e2 (diff) |
avoid min+hour to be out of range after changing the batteries
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3375 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/alarm_menu.c')
-rw-r--r-- | apps/alarm_menu.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/alarm_menu.c b/apps/alarm_menu.c index 2f8c5ced47..9ccdcfc3c2 100644 --- a/apps/alarm_menu.c +++ b/apps/alarm_menu.c @@ -41,19 +41,24 @@ bool alarm_screen(void) { /* get alarm time from RTC */ - + int h, m, hour, minute; - + rtc_get_alarm(&h, &m); - - m = m / 5 * 5; /* 5 min accuracy should be enough */ - + + if (m > 60 || h > 24) { /* after battery-change RTC-values are out of range */ + m = 0; + h = 12; + } else { + m = m / 5 * 5; /* 5 min accuracy should be enough */ + } + bool done=false; char buf[32]; - + lcd_clear_display(); lcd_puts(0,1, str(LANG_ALARM_MOD_KEYS)); - + while(!done) { snprintf(buf, 32, str(LANG_ALARM_MOD_TIME), h, m); lcd_puts(0,0, buf); |