summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-08-11 01:36:03 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-08-11 01:36:03 +0200
commit9fb29e09ea09ccdc4d99c72faf3b428daee83cc5 (patch)
treed68873b09046ebf6bf06dd52efe6c97c70d9caba
parentc7b56cfe584e231ae6117bd6741db0d75ebca4d4 (diff)
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.
-rw-r--r--sys/src/cmd/cifs/pack.c6
1 files changed, 3 insertions, 3 deletions
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