From 77c3cb50fb529740c57908cc5f0655fba0257c91 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Tue, 22 Sep 2020 19:21:51 -0700 Subject: 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. --- sys/src/libc/port/date.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/libc/port/date.c b/sys/src/libc/port/date.c index 44ae15696..1c90a7985 100644 --- a/sys/src/libc/port/date.c +++ b/sys/src/libc/port/date.c @@ -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)) -- cgit v1.2.3