summaryrefslogtreecommitdiff
path: root/usr.bin/make/timestamp.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/timestamp.c')
-rw-r--r--usr.bin/make/timestamp.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/make/timestamp.c b/usr.bin/make/timestamp.c
index 0fe87c4ad06..78610157044 100644
--- a/usr.bin/make/timestamp.c
+++ b/usr.bin/make/timestamp.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: timestamp.c,v 1.2 2004/04/07 13:11:36 espie Exp $ */
+/* $OpenBSD: timestamp.c,v 1.3 2007/09/16 12:09:36 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -52,3 +52,19 @@ set_times(const char *f)
return utime(f, &times);
#endif
}
+
+char *
+time_to_string(TIMESTAMP time)
+{
+ struct tm *parts;
+ static char buf[128];
+ time_t t;
+
+ t = timestamp2time_t(time);
+
+ parts = localtime(&t);
+ strftime(buf, sizeof buf, "%H:%M:%S %b %d, %Y", parts);
+ buf[sizeof(buf) - 1] = '\0';
+ return buf;
+}
+