summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDiogo Sousa <diogogsousa@gmail.com>2013-07-02 02:22:41 +0100
committerDiogo Sousa <diogogsousa@gmail.com>2013-07-02 02:22:41 +0100
commit4b40597c76063e0d97c6e0b6295c72caf3dc2d07 (patch)
treeb55d77d33b763da47d7924f208133f35ddcc75c8
parent9a789bc9e79ffa29e1f333ebc0242cff013b815b (diff)
Fixed get_timezone() to work on windows.
-rw-r--r--src/common/proto-irc.c8
1 files changed, 8 insertions, 0 deletions
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);