summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/common/timefuncs.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index a924ed496a..275fc6c782 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -46,11 +46,11 @@ bool valid_time(const struct tm *tm)
46struct tm *get_time(void) 46struct tm *get_time(void)
47{ 47{
48#ifndef SIMULATOR 48#ifndef SIMULATOR
49#ifdef CONFIG_RTC
49 static long last_tick = 0; 50 static long last_tick = 0;
50 51
51 /* Don't read the RTC more than 4 times per second */ 52 /* Don't read the RTC more than 4 times per second */
52 if (last_tick + HZ < current_tick) { 53 if (last_tick + HZ < current_tick) {
53#ifdef CONFIG_RTC
54 char rtcbuf[7]; 54 char rtcbuf[7];
55 last_tick = HZ * (current_tick / HZ); 55 last_tick = HZ * (current_tick / HZ);
56 rtc_read_datetime(rtcbuf); 56 rtc_read_datetime(rtcbuf);
@@ -65,18 +65,18 @@ struct tm *get_time(void)
65 65
66 tm.tm_yday = 0; /* Not implemented for now */ 66 tm.tm_yday = 0; /* Not implemented for now */
67 tm.tm_isdst = -1; /* Not implemented for now */ 67 tm.tm_isdst = -1; /* Not implemented for now */
68 }
68#else 69#else
69 tm.tm_sec = 0; 70 tm.tm_sec = 0;
70 tm.tm_min = 0; 71 tm.tm_min = 0;
71 tm.tm_hour = 0; 72 tm.tm_hour = 0;
72 tm.tm_mday = 1; 73 tm.tm_mday = 1;
73 tm.tm_mon = 0; 74 tm.tm_mon = 0;
74 tm.tm_year = 70; 75 tm.tm_year = 70;
75 tm.tm_wday = 1; 76 tm.tm_wday = 1;
76 tm.tm_yday = 0; /* Not implemented for now */ 77 tm.tm_yday = 0; /* Not implemented for now */
77 tm.tm_isdst = -1; /* Not implemented for now */ 78 tm.tm_isdst = -1; /* Not implemented for now */
78#endif 79#endif
79 }
80 return &tm; 80 return &tm;
81#else 81#else
82 time_t now = time(NULL); 82 time_t now = time(NULL);