diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-10-11 18:48:22 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-10-11 18:48:22 +0000 |
commit | d4d3a5df94aaad40e5a6674dead87c44b62ca18c (patch) | |
tree | fdfd77b2fd0652a6e5b0f9912627ceb3e75b6f6d | |
parent | 207e60516941596dbbb49ffad958d57dcc041ea2 (diff) | |
download | rockbox-d4d3a5df94aaad40e5a6674dead87c44b62ca18c.tar.gz rockbox-d4d3a5df94aaad40e5a6674dead87c44b62ca18c.zip |
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
-rw-r--r-- | uisimulator/common/stubs.c | 24 |
1 files changed, 24 insertions, 0 deletions
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 @@ | |||
17 | * | 17 | * |
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | #include <stdio.h> | 19 | #include <stdio.h> |
20 | #include <time.h> | ||
20 | #include <stdbool.h> | 21 | #include <stdbool.h> |
22 | |||
21 | #include "debug.h" | 23 | #include "debug.h" |
22 | 24 | ||
23 | #include "screens.h" | 25 | #include "screens.h" |
@@ -170,3 +172,25 @@ void backlight_set_on_when_charging(bool beep) | |||
170 | { | 172 | { |
171 | (void)beep; | 173 | (void)beep; |
172 | } | 174 | } |
175 | |||
176 | int rtc_read(int address) | ||
177 | { | ||
178 | time_t now = time(NULL); | ||
179 | struct tm *teem = localtime(&now); | ||
180 | |||
181 | switch(address) { | ||
182 | case 3: /* hour */ | ||
183 | return (teem->tm_hour%10) | ((teem->tm_hour/10) << 4); | ||
184 | |||
185 | case 2: /* minute */ | ||
186 | return (teem->tm_min%10) | ((teem->tm_min/10) << 4); | ||
187 | } | ||
188 | |||
189 | return address ^ 0x55; | ||
190 | } | ||
191 | |||
192 | int rtc_write(int address, int value) | ||
193 | { | ||
194 | DEBUGF("write %x to address %x\n", value, address); | ||
195 | return 0; | ||
196 | } | ||