ref: b8d3b7d0a164f8927f01bde90566674ca04c5c12
parent: 52a14b4a550347d8da3a4865564d4dfb9c8281a7
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
--
⑨