glib r6393 - in trunk: . glib
- From: matthiasc svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r6393 - in trunk: . glib
- Date: Mon, 28 Jan 2008 06:27:28 +0000 (GMT)
Author: matthiasc
Date: Mon Jan 28 06:27:28 2008
New Revision: 6393
URL: http://svn.gnome.org/viewvc/glib?rev=6393&view=rev
Log:
2008-01-28 Matthias Clasen <mclasen redhat com>
* configure.in: Check for gmtime_r.
* glib/gtimer.c: Use gmtime_r when available. (#511807,
Sebastian DrÃge)
Modified:
trunk/ChangeLog
trunk/glib/gtimer.c
Modified: trunk/glib/gtimer.c
==============================================================================
--- trunk/glib/gtimer.c (original)
+++ trunk/glib/gtimer.c Mon Jan 28 06:27:28 2008
@@ -402,16 +402,24 @@
g_time_val_to_iso8601 (GTimeVal *time_)
{
gchar *retval;
-
+#ifdef HAVE_GMTIME_R
+ struct tm tm_;
+#endif
+
g_return_val_if_fail (time_->tv_usec >= 0 && time_->tv_usec < G_USEC_PER_SEC, NULL);
#define ISO_8601_LEN 21
#define ISO_8601_FORMAT "%Y-%m-%dT%H:%M:%SZ"
retval = g_new0 (gchar, ISO_8601_LEN + 1);
-
+
strftime (retval, ISO_8601_LEN,
ISO_8601_FORMAT,
- gmtime (&(time_->tv_sec)));
+#ifdef HAVE_GMTIME_R
+ gmtime_r (&(time_->tv_sec), &tm_)
+#else
+ gmtime (&(time_->tv_sec))
+#endif
+ );
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]