From fd15708e6476164990e7b364dc5b2aa1600f8e89 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sat, 11 May 2002 05:40:55 +0000 Subject: Begin the process of reworking the time functions for proper time zone and locale support (in theory). More work is still needed. -Erik --- libc/misc/time/ctime.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'libc/misc/time/ctime.c') diff --git a/libc/misc/time/ctime.c b/libc/misc/time/ctime.c index 8783d284e..027f5d5a7 100644 --- a/libc/misc/time/ctime.c +++ b/libc/misc/time/ctime.c @@ -2,25 +2,13 @@ #include #include -extern void __tm_conv(); -extern void __asctime(); - -char *ctime(timep) -__const time_t *timep; +char * ctime (const time_t *t) { - static char cbuf[26]; - struct tm tmb; - struct timezone tz; - time_t offt; - - gettimeofday((void *) 0, &tz); - - offt = -tz.tz_minuteswest * 60L; - /* tmb.tm_isdst = ? */ - __tm_conv(&tmb, timep, offt); - - __asctime(cbuf, &tmb); - - return cbuf; + /* According to IEEE Std 1003.1-2001: The ctime() function shall + * convert the time pointed to by clock, representing time in + * seconds since the Epoch, to local time in the form of a string. + * It shall be equivalent to: asctime(localtime(clock)) */ + return asctime (localtime (t)); } + -- cgit v1.2.3