summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2009-09-26 14:58:32 +0000
committerNils Wallménius <nils@rockbox.org>2009-09-26 14:58:32 +0000
commitc8b87d76eb506d374edd2631d4c29e4300be84c4 (patch)
tree5d380f1f32f317afc579798c5fc4d988e9c48122 /uisimulator
parent66d5bd7cf8c10971578c643c16f72b51df4a1ddf (diff)
downloadrockbox-c8b87d76eb506d374edd2631d4c29e4300be84c4.tar.gz
rockbox-c8b87d76eb506d374edd2631d4c29e4300be84c4.tar.bz2
rockbox-c8b87d76eb506d374edd2631d4c29e4300be84c4.zip
FS#10569 RTC driver cleanup
Change the RTC drivers so that the rtc_(read|write)_datetime functions now deal directly with the tm struct instead of passing a string of bcd digits to/from (set|get)_time . This simplifies drivers for rtc's that do not use a bcd representation internally and cleans up some target specific code and #ifdefs in generic code. Implement simple stubs for the sim to avoid #ifdefing for that too. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22839 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/stubs.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index cb208bfeab..2218c497f8 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -142,25 +142,17 @@ int rtc_write(int address, int value)
return 0;
}
-int rtc_read_datetime(unsigned char* buf)
+int rtc_read_datetime(struct tm *tm)
{
time_t now = time(NULL);
- struct tm *teem = localtime(&now);
-
- buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
- buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
- buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
- buf[3] = (teem->tm_wday);
- buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
- buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
- buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
+ *tm = *localtime(&now);
return 0;
}
-int rtc_write_datetime(unsigned char* buf)
+int rtc_write_datetime(const struct tm *tm)
{
- (void)buf;
+ (void)tm;
return 0;
}