diff options
Diffstat (limited to 'firmware/common/timefuncs.c')
-rw-r--r-- | firmware/common/timefuncs.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index 774fba9ab0..405bce4f5f 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c | |||
@@ -204,28 +204,3 @@ void set_day_of_week(struct tm *tm) | |||
204 | if(m == 0 || m == 1) y--; | 204 | if(m == 0 || m == 1) y--; |
205 | tm->tm_wday = (d + mo[m] + y + y/4 - y/100 + y/400) % 7; | 205 | tm->tm_wday = (d + mo[m] + y + y/4 - y/100 + y/400) % 7; |
206 | } | 206 | } |
207 | |||
208 | void yearday_to_daymonth(int yd, int y, int *d, int *m) | ||
209 | { | ||
210 | static const char tnl[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | ||
211 | static const char tl[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | ||
212 | const char *t; | ||
213 | int i=0; | ||
214 | |||
215 | if((y%4 == 0 && y%100 != 0) || y%400 == 0) | ||
216 | { | ||
217 | t=tl; | ||
218 | } | ||
219 | else | ||
220 | { | ||
221 | t=tnl; | ||
222 | } | ||
223 | |||
224 | while(yd >= t[i] && i<12) | ||
225 | { | ||
226 | yd-=t[i]; | ||
227 | i++; | ||
228 | } | ||
229 | *d = yd+1; | ||
230 | *m = i; | ||
231 | } | ||