summaryrefslogtreecommitdiff
path: root/compat/ctime_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'compat/ctime_r.c')
-rw-r--r--compat/ctime_r.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/compat/ctime_r.c b/compat/ctime_r.c
new file mode 100644
index 0000000..4ffd8b7
--- /dev/null
+++ b/compat/ctime_r.c
@@ -0,0 +1,16 @@
+#ifdef HAVE_CONFIG_H
+#include <ldns/config.h>
+#endif
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+char *ctime_r(const time_t *timep, char *buf)
+{
+ /* no thread safety. */
+ char* result = ctime(timep);
+ if(buf && result)
+ strcpy(buf, result);
+ return result;
+}