From 9fb29e09ea09ccdc4d99c72faf3b428daee83cc5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 11 Aug 2013 01:36:03 +0200 Subject: 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. --- sys/src/cmd/cifs/pack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/src') diff --git a/sys/src/cmd/cifs/pack.c b/sys/src/cmd/cifs/pack.c index 16285bfc3..33f204413 100644 --- a/sys/src/cmd/cifs/pack.c +++ b/sys/src/cmd/cifs/pack.c @@ -401,17 +401,17 @@ gdatetime(Pkt *p) 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 -- cgit v1.2.3