shithub: riscv

Download patch

ref: 9fb29e09ea09ccdc4d99c72faf3b428daee83cc5
parent: c7b56cfe584e231ae6117bd6741db0d75ebca4d4
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sat Aug 10 21:36:03 EDT 2013

cifs: fix timezone for timestamps

tm2sec() ignores tm.tzoff and will use the local timezone for
conversion. to make it work right, we convert the dos timestamp
as GMT and then correct timezone with the offset provided by the
server.

--- a/sys/src/cmd/cifs/pack.c
+++ b/sys/src/cmd/cifs/pack.c
@@ -401,17 +401,17 @@
 		d = gl16(p);
 	}
 
+	memset(&tm, 0, sizeof(tm));
 	tm.year = 80 + (d >> 9);
 	tm.mon = ((d >> 5) & 017) - 1;
 	tm.mday = d & 037;
-	tm.zone[0] = 0;
-	tm.tzoff = p->s->tz;
 
 	tm.hour = t >> 11;
 	tm.min = (t >> 5) & 63;
 	tm.sec = (t & 31) << 1;
+	strcpy(tm.zone, "GMT");
 
-	return tm2sec(&tm);
+	return tm2sec(&tm) + p->s->tz;
 }
 
 long
--