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:
bors 2013-11-08 04:36:12 -08:00
commit 4ce7d573e8

View File

@ -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;