changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > plan9front / changeset: upas/fs: fix handling of numeric timezone offsets in strtotm

changeset 7422: 714b929020e9
parent 7421: fe8aefb6ab34
child 7423: fb55099449b9
author: Alex Musolino <alex@musolino.id.au>
date: Thu, 31 Oct 2019 09:41:03 +1030
files: sys/src/cmd/upas/fs/strtotm.c
description: upas/fs: fix handling of numeric timezone offsets in strtotm

Since numeric timezone offsets are relative to GMT, initialise zone to
GMT so tm2sec(2) does not assume local time.

Note that if strtotm encounters a timezone *string* and consequently
overwrites zone then we will end up in the same mess since tm2sec(2)
only deals with GMT or local time.
     1.1--- a/sys/src/cmd/upas/fs/strtotm.c
     1.2+++ b/sys/src/cmd/upas/fs/strtotm.c
     1.3@@ -38,6 +38,7 @@ strtotm(char *p, Tm *t)
     1.4 	tm.min = -1;
     1.5 	tm.year = -1;
     1.6 	tm.mday = -1;
     1.7+	memcpy(tm.zone, "GMT", 3);
     1.8 	for(p = skipwhite(p); *p; p = skipwhite(q)){
     1.9 		q = skiptext(p);
    1.10