shithub: riscv

Download patch

ref: 77c3cb50fb529740c57908cc5f0655fba0257c91
parent: 313aebb96478c37be8f39754875c02dcb3f896cc
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))