Fixed get_timezone() to work on windows.

This commit is contained in:
Diogo Sousa 2013-07-02 02:22:41 +01:00
parent 9a789bc9e7
commit 4b40597c76
1 changed files with 8 additions and 0 deletions

View File

@ -1337,8 +1337,16 @@ get_timezone(void)
time (&t);
/* gmtime() and localtime() are thread-safe on windows.
* on other systems we should use {gmtime,localtime}_r().
*/
#if WIN32
tm_utc = *gmtime (&t);
tm_local = *localtime (&t);
#else
gmtime_r (&t, &tm_utc);
localtime_r (&t, &tm_local);
#endif
time_utc = mktime (&tm_utc);
time_local = mktime (&tm_local);