From d4d3a5df94aaad40e5a6674dead87c44b62ca18c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 11 Oct 2002 18:48:22 +0000 Subject: [PATCH] rtc_read() and rtc_write() added, and if we now set HAVE_RTC when building the recorder simulator, we get a clock in the status bar! ;-) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2586 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/stubs.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index 11c1b827d4..5a8c9435dd 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c @@ -17,7 +17,9 @@ * ****************************************************************************/ #include +#include #include + #include "debug.h" #include "screens.h" @@ -170,3 +172,25 @@ void backlight_set_on_when_charging(bool beep) { (void)beep; } + +int rtc_read(int address) +{ + time_t now = time(NULL); + struct tm *teem = localtime(&now); + + switch(address) { + case 3: /* hour */ + return (teem->tm_hour%10) | ((teem->tm_hour/10) << 4); + + case 2: /* minute */ + return (teem->tm_min%10) | ((teem->tm_min/10) << 4); + } + + return address ^ 0x55; +} + +int rtc_write(int address, int value) +{ + DEBUGF("write %x to address %x\n", value, address); + return 0; +}