summaryrefslogtreecommitdiff
path: root/glib/gdate.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@src.gnome.org>1999-01-09 19:14:16 +0000
committerJeff Garzik <jgarzik@src.gnome.org>1999-01-09 19:14:16 +0000
commit2a6789be13c4def678ae612d6cdf236d347374eb (patch)
tree144e050d51c6e66a8461e51ac212982ae1ef84ba /glib/gdate.c
parentdc602866312bff134f4d827190f5c24934970e19 (diff)
downloadglib-2a6789be13c4def678ae612d6cdf236d347374eb.tar.gz
Add checks for vasprintf, localtime_r.
* configure.in: Add checks for vasprintf, localtime_r. * gdate.c (g_date_set_time): Use localtime if localtime_r is not available. * gstrfuncs.c (g_strdup_vprintf): Use glibc vasprintf if possible; it's a bit faster than using GLib routines, and makes output code a bit smaller. * acconfig.h: Remove HAVE_VSNPRINTF and HAVE_VPRINTF. autoheader picks these up automatically and puts them in config.h.in.
Diffstat (limited to 'glib/gdate.c')
-rw-r--r--glib/gdate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/glib/gdate.c b/glib/gdate.c
index 08b3b0b08..04d0a9a8f 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -790,11 +790,16 @@ g_date_set_time (GDate *d,
GTime time)
{
time_t t = time;
- struct tm tm;
+ struct tm tm, *ptm;
g_return_if_fail (d != NULL);
+#if HAVE_LOCALTIME_R
localtime_r (&t, &tm);
+#else
+ ptm = localtime (&t);
+ memcpy((void *) &tm, (void *) ptm, sizeof(struct tm));
+#endif
d->julian = FALSE;