fix android timegm

This commit is contained in:
sh8281.kim 2013-11-08 15:44:36 +09:00
parent d26776a775
commit 09257df055

View File

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