diff options
author | Björn Stenberg <bjorn@haxx.se> | 2003-01-27 14:24:40 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2003-01-27 14:24:40 +0000 |
commit | cc11e885d1ab32f11b322071260376de3788c62e (patch) | |
tree | 3b790f616946cc6d4ff6b4fa424cedb2fc813467 | |
parent | 8ed1a3a409fadf5c5f45dce7fc4c697d9d290626 (diff) | |
download | rockbox-cc11e885d1ab32f11b322071260376de3788c62e.tar.gz rockbox-cc11e885d1ab32f11b322071260376de3788c62e.zip |
Corrected get_time(). This should fix the bad file date bug. Also changed status.c to use get_time() instead of reading directly from RTC.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3170 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/recorder/recording.c | 2 | ||||
-rw-r--r-- | apps/status.c | 11 | ||||
-rw-r--r-- | firmware/common/timefuncs.c | 2 | ||||
-rw-r--r-- | firmware/common/timefuncs.h | 2 |
4 files changed, 7 insertions, 10 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index 73b2773e44..adcea752d4 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -143,7 +143,7 @@ static char *create_filename(void) | |||
143 | 143 | ||
144 | /* Create a filename: RYYMMDDHHMMSS.mp3 */ | 144 | /* Create a filename: RYYMMDDHHMMSS.mp3 */ |
145 | snprintf(fname, 32, "/R%02d%02d%02d%02d%02d%02d.mp3", | 145 | snprintf(fname, 32, "/R%02d%02d%02d%02d%02d%02d.mp3", |
146 | tm->tm_year-2000, tm->tm_mon, tm->tm_mday, | 146 | tm->tm_year%100, tm->tm_mon, tm->tm_mday, |
147 | tm->tm_hour, tm->tm_min, tm->tm_sec); | 147 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
148 | 148 | ||
149 | DEBUGF("Filename: %s\n", fname); | 149 | DEBUGF("Filename: %s\n", fname); |
diff --git a/apps/status.c b/apps/status.c index 3921a3bcdb..8ebf662ad8 100644 --- a/apps/status.c +++ b/apps/status.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "mpeg.h" | 26 | #include "mpeg.h" |
27 | #include "wps.h" | 27 | #include "wps.h" |
28 | #ifdef HAVE_RTC | 28 | #ifdef HAVE_RTC |
29 | #include "rtc.h" | 29 | #include "timefuncs.h" |
30 | #endif | 30 | #endif |
31 | #ifdef HAVE_LCD_BITMAP | 31 | #ifdef HAVE_LCD_BITMAP |
32 | #include "icons.h" | 32 | #include "icons.h" |
@@ -88,7 +88,7 @@ void status_draw(void) | |||
88 | int battlevel = battery_level(); | 88 | int battlevel = battery_level(); |
89 | int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume); | 89 | int volume = mpeg_val2phys(SOUND_VOLUME, global_settings.volume); |
90 | #if defined(HAVE_LCD_BITMAP) && defined(HAVE_RTC) | 90 | #if defined(HAVE_LCD_BITMAP) && defined(HAVE_RTC) |
91 | int hour, minute; | 91 | struct tm* tm; |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | if ( !global_settings.statusbar ) | 94 | if ( !global_settings.statusbar ) |
@@ -247,11 +247,8 @@ void status_draw(void) | |||
247 | if (keys_locked) | 247 | if (keys_locked) |
248 | statusbar_icon_lock(); | 248 | statusbar_icon_lock(); |
249 | #ifdef HAVE_RTC | 249 | #ifdef HAVE_RTC |
250 | hour = rtc_read(3); | 250 | tm = get_time(); |
251 | hour = ((hour & 0x30) >> 4) * 10 + (hour & 0x0f); | 251 | statusbar_time(tm->tm_hour, tm->tm_min); |
252 | minute = rtc_read(2); | ||
253 | minute = ((minute & 0x70) >> 4) * 10 + (minute & 0x0f); | ||
254 | statusbar_time(hour, minute); | ||
255 | #endif | 252 | #endif |
256 | 253 | ||
257 | lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT); | 254 | lcd_update_rect(0, 0, LCD_WIDTH, STATUSBAR_HEIGHT); |
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index 6b979389d5..913f85f8e1 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c | |||
@@ -39,7 +39,7 @@ struct tm *get_time(void) | |||
39 | tm.tm_hour = ((rtcbuf[3] & 0x30) >> 4) * 10 + (rtcbuf[3] & 0x0f); | 39 | tm.tm_hour = ((rtcbuf[3] & 0x30) >> 4) * 10 + (rtcbuf[3] & 0x0f); |
40 | tm.tm_mday = ((rtcbuf[5] & 0x30) >> 4) * 10 + (rtcbuf[5] & 0x0f); | 40 | tm.tm_mday = ((rtcbuf[5] & 0x30) >> 4) * 10 + (rtcbuf[5] & 0x0f); |
41 | tm.tm_mon = ((rtcbuf[6] & 0x10) >> 4) * 10 + (rtcbuf[6] & 0x0f); | 41 | tm.tm_mon = ((rtcbuf[6] & 0x10) >> 4) * 10 + (rtcbuf[6] & 0x0f); |
42 | tm.tm_year = ((rtcbuf[7] & 0xf0) >> 4) * 10 + (rtcbuf[7] & 0x0f) + 2000; | 42 | tm.tm_year = ((rtcbuf[7] & 0xf0) >> 4) * 10 + (rtcbuf[7] & 0x0f) + 100; |
43 | tm.tm_wday = rtcbuf[4] & 0x07; | 43 | tm.tm_wday = rtcbuf[4] & 0x07; |
44 | tm.tm_yday = 0; /* Not implemented for now */ | 44 | tm.tm_yday = 0; /* Not implemented for now */ |
45 | tm.tm_isdst = -1; /* Not implemented for now */ | 45 | tm.tm_isdst = -1; /* Not implemented for now */ |
diff --git a/firmware/common/timefuncs.h b/firmware/common/timefuncs.h index 1110ad9a44..3845b946c5 100644 --- a/firmware/common/timefuncs.h +++ b/firmware/common/timefuncs.h | |||
@@ -31,7 +31,7 @@ struct tm | |||
31 | int tm_hour; /* hours */ | 31 | int tm_hour; /* hours */ |
32 | int tm_mday; /* day of the month */ | 32 | int tm_mday; /* day of the month */ |
33 | int tm_mon; /* month */ | 33 | int tm_mon; /* month */ |
34 | int tm_year; /* year */ | 34 | int tm_year; /* year since 1900 */ |
35 | int tm_wday; /* day of the week */ | 35 | int tm_wday; /* day of the week */ |
36 | int tm_yday; /* day in the year */ | 36 | int tm_yday; /* day in the year */ |
37 | int tm_isdst; /* daylight saving time */ | 37 | int tm_isdst; /* daylight saving time */ |