libc: make yday 0-based, as docs suggest

Tm.yday is docuemnted as being 0-based, and our new api
should respect that. Fix the code so that this is true.
This commit is contained in:
Ori Bernstein 2020-09-22 19:21:51 -07:00
parent 313aebb964
commit 77c3cb50fb

View file

@ -330,7 +330,7 @@ tmfill(Tm *tm, vlong abs, vlong nsec)
if(d < 0)
d += mdays[m - 1];
tm->yday = d;
tm->yday = d - 1;
for(i = 0; i < m - 1; i++)
tm->yday += mdays[i];
if(m > 1 && isleap(y))