git: 9front

Download patch

ref: cdf3c4900b7fc1b17c41008f45e91371b7ff023a
parent: 8b97843e8701dcbfd924632d3f7add548864b4e4
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 22 15:21:51 EDT 2020

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.

--- a/sys/src/libc/port/date.c
+++ b/sys/src/libc/port/date.c
@@ -330,7 +330,7 @@
 	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))
--