summaryrefslogtreecommitdiff
path: root/firmware/common/timefuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common/timefuncs.c')
-rw-r--r--firmware/common/timefuncs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index 108431753a..d87e6b67f2 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -32,6 +32,20 @@
32 32
33static struct tm tm; 33static struct tm tm;
34 34
35time_t dostime_mktime(uint16_t dosdate, uint16_t dostime)
36{
37 /* this knows our mktime() only uses these struct tm fields */
38 struct tm tm;
39 tm.tm_sec = ((dostime ) & 0x1f) * 2;
40 tm.tm_min = ((dostime >> 5) & 0x3f);
41 tm.tm_hour = ((dostime >> 11) );
42 tm.tm_mday = ((dosdate ) & 0x1f);
43 tm.tm_mon = ((dosdate >> 5) & 0x0f) - 1;
44 tm.tm_year = ((dosdate >> 9) ) + 80;
45
46 return mktime(&tm);
47}
48
35#if !CONFIG_RTC 49#if !CONFIG_RTC
36static inline bool rtc_dirty(void) 50static inline bool rtc_dirty(void)
37{ 51{