mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
fix android timegm
This commit is contained in:
parent
d26776a775
commit
09257df055
@ -43,12 +43,15 @@ timegm(struct tm *tm)
|
|||||||
char *tz;
|
char *tz;
|
||||||
|
|
||||||
tz = getenv("TZ");
|
tz = getenv("TZ");
|
||||||
|
if (tz)
|
||||||
|
tz = strdup(tz);
|
||||||
setenv("TZ", "", 1);
|
setenv("TZ", "", 1);
|
||||||
tzset();
|
tzset();
|
||||||
ret = mktime(tm);
|
ret = mktime(tm);
|
||||||
if (tz)
|
if (tz) {
|
||||||
setenv("TZ", tz, 1);
|
setenv("TZ", tz, 1);
|
||||||
else
|
free(tz);
|
||||||
|
} else
|
||||||
unsetenv("TZ");
|
unsetenv("TZ");
|
||||||
tzset();
|
tzset();
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user