OSDN Git Service

libc: Fix mktime returns an uncorrect time in empty TZ case
authorSatoru Takeuchi <satoru.x.takeuchi@sonymobile.com>
Tue, 27 May 2014 08:04:04 +0000 (17:04 +0900)
committerElliott Hughes <enh@google.com>
Sat, 15 Nov 2014 02:13:07 +0000 (18:13 -0800)
commit154e2026c83575eb17101df3a8d1192e305588d4
tree754fa359b8acbe2be4049c45d8976056dc7c95cd
parent38569312bc5a3a4688d45997d81b59abb0a60825
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
libc/tzcode/localtime.c
tests/time_test.cpp