aboutsummaryrefslogtreecommitdiff
path: root/tools/plink/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/plink/time.c')
-rw-r--r--tools/plink/time.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/plink/time.c b/tools/plink/time.c
new file mode 100644
index 000000000..d873d44cc
--- /dev/null
+++ b/tools/plink/time.c
@@ -0,0 +1,16 @@
+/*
+ * Portable implementation of ltime() for any ISO-C platform where
+ * time_t behaves. (In practice, we've found that platforms such as
+ * Windows and Mac have needed their own specialised implementations.)
+ */
+
+#include <time.h>
+#include <assert.h>
+
+struct tm ltime(void)
+{
+ time_t t;
+ time(&t);
+ assert (t != ((time_t)-1));
+ return *localtime(&t);
+}