New function ltime() returns a struct tm of the current local time.
[u/mdw/putty] / time.c
diff --git a/time.c b/time.c
new file mode 100644 (file)
index 0000000..82488e6
--- /dev/null
+++ b/time.c
@@ -0,0 +1,10 @@
+#include <time.h>
+#include <assert.h>
+
+struct tm ltime(void)
+{
+    time_t t;
+    time(&t);
+    assert (t != ((time_t)-1));
+    return *localtime(&t);
+}