summaryrefslogtreecommitdiff
path: root/libc/misc/time/ctime.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-05-11 05:40:55 +0000
committerEric Andersen <andersen@codepoet.org>2002-05-11 05:40:55 +0000
commitfd15708e6476164990e7b364dc5b2aa1600f8e89 (patch)
tree7627bd8a8c546f2fafd99fb52c1f96fdf4b242ce /libc/misc/time/ctime.c
parenta4f07581502ee212aa45e7b0049fdd126dd10b40 (diff)
Begin the process of reworking the time functions for proper
time zone and locale support (in theory). More work is still needed. -Erik
Diffstat (limited to 'libc/misc/time/ctime.c')
-rw-r--r--libc/misc/time/ctime.c26
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));
}
+