[libgda/LIBGDA_4.2] Use localtime on Windows instead of localtime_r



commit 7308d31b8033086d715bdacf99b77d27310c300c
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Jun 1 21:37:15 2011 +0200

    Use localtime on Windows instead of localtime_r

 tools/browser/ldap-browser/entry-properties.c |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/tools/browser/ldap-browser/entry-properties.c b/tools/browser/ldap-browser/entry-properties.c
index 3bccc9f..c534e71 100644
--- a/tools/browser/ldap-browser/entry-properties.c
+++ b/tools/browser/ldap-browser/entry-properties.c
@@ -575,20 +575,25 @@ ad_1601_timestamp_to_string (const gchar *value, const gchar *attname)
 		return NULL;
 
 	GdaDataHandler *dh;
-	struct tm stm;
+	struct tm stm, *pstm;
 	GValue tvalue;
 	GdaTimestamp ts;
 	time_t nsec = (time_t) i64;
 	gchar *str;
-	 
+
+#ifdef G_OS_WIN32
+	pstm = localtime (&nsec);
+#else
 	localtime_r (&nsec, &stm);
+	pstm = &stm;
+#endif
 	memset (&ts, 0, sizeof (GdaTimestamp));
-	ts.year = stm.tm_year + 1900;
-	ts.month = stm.tm_mon + 1;
-	ts.day = stm.tm_mday;
-	ts.hour = stm.tm_hour;
-	ts.minute = stm.tm_min;
-	ts.second = stm.tm_sec;
+	ts.year = pstm->tm_year + 1900;
+	ts.month = pstm->tm_mon + 1;
+	ts.day = pstm->tm_mday;
+	ts.hour = pstm->tm_hour;
+	ts.minute = pstm->tm_min;
+	ts.second = pstm->tm_sec;
 	ts.timezone = GDA_TIMEZONE_INVALID;
 	memset (&tvalue, 0, sizeof (GValue));
 	gda_value_set_timestamp (&tvalue, &ts);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]