auto merge of #10348 : ksh8281/rust/fix_android_timegm, r=yichoi
fix timegm bug on android TZ restore not correctly before. and it cause test case fail (time::tests::run_tests::test_convertions) with @sammykim
This commit is contained in:
commit
4ce7d573e8
@ -43,12 +43,15 @@ timegm(struct tm *tm)
|
||||
char *tz;
|
||||
|
||||
tz = getenv("TZ");
|
||||
if (tz)
|
||||
tz = strdup(tz);
|
||||
setenv("TZ", "", 1);
|
||||
tzset();
|
||||
ret = mktime(tm);
|
||||
if (tz)
|
||||
if (tz) {
|
||||
setenv("TZ", tz, 1);
|
||||
else
|
||||
free(tz);
|
||||
} else
|
||||
unsetenv("TZ");
|
||||
tzset();
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user