diff options
author | Satoru Takeuchi <satoru.x.takeuchi@sonymobile.com> | 2014-05-27 17:04:04 +0900 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-11-14 18:13:07 -0800 |
commit | 154e2026c83575eb17101df3a8d1192e305588d4 (patch) | |
tree | 754fa359b8acbe2be4049c45d8976056dc7c95cd /libc/tzcode | |
parent | 38569312bc5a3a4688d45997d81b59abb0a60825 (diff) | |
download | bionic-154e2026c83575eb17101df3a8d1192e305588d4.zip bionic-154e2026c83575eb17101df3a8d1192e305588d4.tar.gz bionic-154e2026c83575eb17101df3a8d1192e305588d4.tar.bz2 |
libc: Fix mktime returns an uncorrect time in empty TZ case
The mktime API returned an uncorrect time when TZ is set as empty.
A timezone UTC/GMT+0 should be implied in the empty case. However
mktime keeps previous information about timezone. If mktime was called
with a timezone which has DST before, the "defaulttype" member of
"state" structure wouldn't be 0. Then it would be used next time,
even though UTC/GMT+0 doesn't have DST.
Added initialization of the "defaulttype" in the empty TZ case.
Change-Id: Ic480c63c548c05444134e0aefb30a7b380e3f40b
Diffstat (limited to 'libc/tzcode')
-rw-r--r-- | libc/tzcode/localtime.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libc/tzcode/localtime.c b/libc/tzcode/localtime.c index 28d13f4..29f605c 100644 --- a/libc/tzcode/localtime.c +++ b/libc/tzcode/localtime.c @@ -1257,6 +1257,7 @@ tzset_locked(void) lclptr->ttis[0].tt_gmtoff = 0; lclptr->ttis[0].tt_abbrind = 0; (void) strcpy(lclptr->chars, gmt); + lclptr->defaulttype = 0; } else if (tzload(name, lclptr, TRUE) != 0) if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0) (void) gmtload(lclptr); |