diff options
Diffstat (limited to 'libc/misc/time/ctime.c')
-rw-r--r-- | libc/misc/time/ctime.c | 26 |
1 files changed, 7 insertions, 19 deletions
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 <time.h> #include <sys/time.h> -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)); } + |