X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fgettimeofday.c;h=48f286945d7171eeb25bafe6a0e91c7eb8507921;hb=7518b4fbb51d5c858aa79f9e9eef676258efde23;hp=59c565c78bf0ecc4123886bd495af00420dda226;hpb=bf133a41bf9dfb387f5ae52876f0d1380d53928b;p=gnulib.git diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c index 59c565c78..48f286945 100644 --- a/lib/gettimeofday.c +++ b/lib/gettimeofday.c @@ -39,17 +39,9 @@ #endif #include -#include "gtod.h" static struct tm *localtime_buffer_addr; -void -GTOD_init (void) -{ - time_t t = 0; - localtime_buffer_addr = localtime (&t); -} - /* This is a wrapper for gettimeofday. It is used only on systems for which gettimeofday clobbers the static buffer used for localtime's result. @@ -60,8 +52,13 @@ int rpl_gettimeofday (struct timeval *tv, struct timezone *tz) { struct tm save; + int result; + if (! localtime_buffer_addr) - abort (); + { + time_t t = 0; + localtime_buffer_addr = localtime (&t); + } save = *localtime_buffer_addr; result = gettimeofday (tv, tz);