38 uint16_t days, n, leapyear, years;
41 days = *timer / 86400UL;
42 fract = *timer % 86400UL;
45 lresult = ldiv(fract, 60L);
46 timeptr->
tm_sec = lresult.rem;
47 result = div(lresult.quot, 60);
48 timeptr->
tm_min = result.rem;
66 lresult = ldiv((
long) days, 36525L);
67 years = 100 * lresult.quot;
70 lresult = ldiv(lresult.rem, 1461L);
71 years += 4 * lresult.quot;
73 if (years > 100) days++;
81 if (years == 100) leapyear = 0;
93 result = div(days, 365);
109 result = div(days, 31);
110 timeptr->
tm_mon = result.quot;
121 result = div(days, 153);
122 timeptr->
tm_mon = 2 + result.quot * 5;
125 result = div(result.rem, 61);
126 timeptr->
tm_mon += result.quot * 2;
129 result = div(result.rem, 31);
130 timeptr->
tm_mon += result.quot;
int8_t tm_mday
Day in Month [1-31].
int8_t tm_min
Minutes [0-59].
int16_t tm_yday
days since January 1 [0-365].
int16_t tm_isdst
Daylight Saving Time flag [-1/0/1].
struct tm * gmtime_r(const time_t *timer, struct tm *timeptr)
int16_t tm_year
Years since 1900.
int8_t tm_sec
Seconds [0-60].
int8_t tm_hour
Hours [0-23].
int8_t tm_wday
Days since Sunday [0-6].
int8_t tm_mon
0-11 Months since January [0-11].