summaryrefslogtreecommitdiff
path: root/libc/misc/time/ctime_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/time/ctime_r.c')
-rw-r--r--libc/misc/time/ctime_r.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libc/misc/time/ctime_r.c b/libc/misc/time/ctime_r.c
new file mode 100644
index 000000000..ac267b04e
--- /dev/null
+++ b/libc/misc/time/ctime_r.c
@@ -0,0 +1,26 @@
+
+#include <time.h>
+
+extern void __tm_conv();
+extern void __asctime();
+
+char *
+ctime_r(timep, buf)
+__const time_t * timep;
+char * buf;
+{
+ 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(buf, &tmb);
+
+ return buf;
+}