mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 07:26:15 +01:00
Check for gmtime_r. Use gmtime_r when available. (#511807, Sebastian
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) svn path=/trunk/; revision=6393
This commit is contained in:
parent
cf9b04e7df
commit
c4bad41855
@ -1,3 +1,9 @@
|
|||||||
|
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)
|
||||||
|
|
||||||
2008-01-27 Matthias Clasen <mclasen@redhat.com>
|
2008-01-27 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* glib/gnode.[hc]: Move docs inline. (#316260, Philippe Blain)
|
* glib/gnode.[hc]: Move docs inline. (#316260, Philippe Blain)
|
||||||
|
@ -402,16 +402,24 @@ gchar *
|
|||||||
g_time_val_to_iso8601 (GTimeVal *time_)
|
g_time_val_to_iso8601 (GTimeVal *time_)
|
||||||
{
|
{
|
||||||
gchar *retval;
|
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);
|
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_LEN 21
|
||||||
#define ISO_8601_FORMAT "%Y-%m-%dT%H:%M:%SZ"
|
#define ISO_8601_FORMAT "%Y-%m-%dT%H:%M:%SZ"
|
||||||
retval = g_new0 (gchar, ISO_8601_LEN + 1);
|
retval = g_new0 (gchar, ISO_8601_LEN + 1);
|
||||||
|
|
||||||
strftime (retval, ISO_8601_LEN,
|
strftime (retval, ISO_8601_LEN,
|
||||||
ISO_8601_FORMAT,
|
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;
|
return retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user