summaryrefslogtreecommitdiff
path: root/firmware/common
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/common')
-rw-r--r--firmware/common/timefuncs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index 7d385949b5..cffdb3951a 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -44,6 +44,7 @@ static void fill_default_tm(struct tm *tm)
44} 44}
45#endif /* !CONFIG_RTC */ 45#endif /* !CONFIG_RTC */
46 46
47#if CONFIG_RTC
47bool valid_time(const struct tm *tm) 48bool valid_time(const struct tm *tm)
48{ 49{
49 if (tm->tm_hour < 0 || tm->tm_hour > 23 || 50 if (tm->tm_hour < 0 || tm->tm_hour > 23 ||
@@ -57,6 +58,7 @@ bool valid_time(const struct tm *tm)
57 else 58 else
58 return true; 59 return true;
59} 60}
61#endif /* CONFIG_RTC */
60 62
61struct tm *get_time(void) 63struct tm *get_time(void)
62{ 64{
@@ -103,6 +105,7 @@ int set_time(const struct tm *tm)
103#endif /* RTC */ 105#endif /* RTC */
104} 106}
105 107
108#if CONFIG_RTC
106void set_day_of_week(struct tm *tm) 109void set_day_of_week(struct tm *tm)
107{ 110{
108 int y=tm->tm_year+1900; 111 int y=tm->tm_year+1900;
@@ -113,4 +116,5 @@ void set_day_of_week(struct tm *tm)
113 if(m == 0 || m == 1) y--; 116 if(m == 0 || m == 1) y--;
114 tm->tm_wday = (d + mo[m] + y + y/4 - y/100 + y/400) % 7; 117 tm->tm_wday = (d + mo[m] + y + y/4 - y/100 + y/400) % 7;
115} 118}
119#endif /* CONFIG_RTC */
116 120