From 4b40597c76063e0d97c6e0b6295c72caf3dc2d07 Mon Sep 17 00:00:00 2001 From: Diogo Sousa Date: Tue, 2 Jul 2013 02:22:41 +0100 Subject: [PATCH] Fixed get_timezone() to work on windows. --- src/common/proto-irc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c index b19d9afa..29102afc 100644 --- a/src/common/proto-irc.c +++ b/src/common/proto-irc.c @@ -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);