summaryrefslogtreecommitdiff
path: root/gdate.c
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>1999-01-07 16:17:42 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>1999-01-07 16:17:42 +0000
commit81f8d0bb10c945c459b2a8063bf70039be113771 (patch)
treeca4b4ce4df360d0a728e542beeb92aa455e3f712 /gdate.c
parent9200f444626fd7b814c30f351f872a11e0d9a64c (diff)
downloadglib-81f8d0bb10c945c459b2a8063bf70039be113771.tar.gz
Here we must replace getpwuid by getpwuid_r, but as I do not know how for
1999-01-07 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gutils.c (g_get_any_init): Here we must replace getpwuid by getpwuid_r, but as I do not know how for now, I just made a FIXME note ;-) * gdate.c (g_date_set_time): localtime --> localtime_r to make it thread safe. * configure.in: We do not need to check for broken solaris mutex intitializer any longer. Provide a macro to show the used thread implementation. Not nice, but this is needed until thread support is completed here inside glib. * gthread/testgthread.c: conditionally compile according to the G_THREADS_IMPL_??? macros. (test_private_func): use rand_r instead of rand to make it thread safe.
Diffstat (limited to 'gdate.c')
-rw-r--r--gdate.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/gdate.c b/gdate.c
index 471aaadf7..08b3b0b08 100644
--- a/gdate.c
+++ b/gdate.c
@@ -790,28 +790,21 @@ g_date_set_time (GDate *d,
GTime time)
{
time_t t = time;
- struct tm *tm;
+ struct tm tm;
g_return_if_fail (d != NULL);
- tm = localtime (&t);
+ localtime_r (&t, &tm);
- if (tm)
- {
- d->julian = FALSE;
-
- d->month = tm->tm_mon + 1;
- d->day = tm->tm_mday;
- d->year = tm->tm_year + 1900;
-
- g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
-
- d->dmy = TRUE;
- }
- else
- {
- g_date_clear (d, 1);
- }
+ d->julian = FALSE;
+
+ d->month = tm.tm_mon + 1;
+ d->day = tm.tm_mday;
+ d->year = tm.tm_year + 1900;
+
+ g_return_if_fail (g_date_valid_dmy (d->day, d->month, d->year));
+
+ d->dmy = TRUE;
}
void