diff options
Diffstat (limited to 'firmware/common/timefuncs.c')
-rw-r--r-- | firmware/common/timefuncs.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index 1bf29d203c..d46b961a8c 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c | |||
@@ -52,10 +52,12 @@ struct tm *get_time(void) | |||
52 | static long timeout = 0; | 52 | static long timeout = 0; |
53 | 53 | ||
54 | /* Don't read the RTC more than once per second */ | 54 | /* Don't read the RTC more than once per second */ |
55 | if (current_tick > timeout) { | 55 | if (current_tick > timeout) |
56 | char rtcbuf[7]; | 56 | { |
57 | /* Once per second, 1/10th of a second off */ | 57 | /* Once per second, 1/10th of a second off */ |
58 | timeout = HZ * (current_tick / HZ + 1) + HZ / 5; | 58 | timeout = HZ * (current_tick / HZ + 1) + HZ / 5; |
59 | #if CONFIG_RTC != RTC_JZ47XX | ||
60 | char rtcbuf[7]; | ||
59 | rtc_read_datetime(rtcbuf); | 61 | rtc_read_datetime(rtcbuf); |
60 | 62 | ||
61 | tm.tm_sec = ((rtcbuf[0] & 0x70) >> 4) * 10 + (rtcbuf[0] & 0x0f); | 63 | tm.tm_sec = ((rtcbuf[0] & 0x70) >> 4) * 10 + (rtcbuf[0] & 0x0f); |
@@ -76,6 +78,9 @@ struct tm *get_time(void) | |||
76 | 78 | ||
77 | tm.tm_yday = 0; /* Not implemented for now */ | 79 | tm.tm_yday = 0; /* Not implemented for now */ |
78 | tm.tm_isdst = -1; /* Not implemented for now */ | 80 | tm.tm_isdst = -1; /* Not implemented for now */ |
81 | #else | ||
82 | rtc_read_datetime((unsigned char*)&tm); | ||
83 | #endif | ||
79 | } | 84 | } |
80 | #else | 85 | #else |
81 | tm.tm_sec = 0; | 86 | tm.tm_sec = 0; |