Fix leap year computation
This commit is contained in:
parent
72da6659ed
commit
9df7ab3875
|
@ -44,13 +44,13 @@ gmtime_r (const time_t *timep, struct tm *ptm)
|
||||||
ptm->tm_hour = t % 24;
|
ptm->tm_hour = t % 24;
|
||||||
t /= 24;
|
t /= 24;
|
||||||
ptm->tm_wday = (t+4) % 7;
|
ptm->tm_wday = (t+4) % 7;
|
||||||
year = 70;
|
year = 1970;
|
||||||
days = 0;
|
days = 0;
|
||||||
while ((days += YDAYS (year)) <= t)
|
while ((days += YDAYS (year)) <= t)
|
||||||
{
|
{
|
||||||
year++;
|
year++;
|
||||||
}
|
}
|
||||||
ptm->tm_year = year;
|
ptm->tm_year = year - 1900;
|
||||||
days -= YDAYS(year);
|
days -= YDAYS(year);
|
||||||
t -= days;
|
t -= days;
|
||||||
ptm->tm_yday = t;
|
ptm->tm_yday = t;
|
||||||
|
|
Loading…
Reference in a new issue