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.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c
index e423e016fd..42babbd8e3 100644
--- a/firmware/common/timefuncs.c
+++ b/firmware/common/timefuncs.c
@@ -103,43 +103,6 @@ int set_time(const struct tm *tm)
103#endif /* RTC */ 103#endif /* RTC */
104} 104}
105 105
106#if CONFIG_RTC
107/* mktime() code taken from lynx-2.8.5 source, written
108 by Philippe De Muyter <phdm@macqel.be> */
109time_t mktime(struct tm *t)
110{
111 short month, year;
112 time_t result;
113 static int m_to_d[12] =
114 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
115
116 month = t->tm_mon;
117 year = t->tm_year + month / 12 + 1900;
118 month %= 12;
119 if (month < 0)
120 {
121 year -= 1;
122 month += 12;
123 }
124 result = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month];
125 result = (year - 1970) * 365 + m_to_d[month];
126 if (month <= 1)
127 year -= 1;
128 result += (year - 1968) / 4;
129 result -= (year - 1900) / 100;
130 result += (year - 1600) / 400;
131 result += t->tm_mday;
132 result -= 1;
133 result *= 24;
134 result += t->tm_hour;
135 result *= 60;
136 result += t->tm_min;
137 result *= 60;
138 result += t->tm_sec;
139 return(result);
140}
141#endif
142
143void set_day_of_week(struct tm *tm) 106void set_day_of_week(struct tm *tm)
144{ 107{
145 int y=tm->tm_year+1900; 108 int y=tm->tm_year+1900;