summaryrefslogtreecommitdiff
path: root/usr.bin/make/timestamp.c
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-09-16 12:09:37 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-09-16 12:09:37 +0000
commit6555d0f34894b30c5995ae2a70e227baddd0ad8b (patch)
treec9f7b180bd3a30b74dba203b0c9f4bc11485ff27 /usr.bin/make/timestamp.c
parentefd08e944942d0060ea6b889d7eddc409d56eaec (diff)
rename Targ_FmtTime into time_to_string and move it, as it's not related
to target nodes at all (reduces modules inter-dependencies)
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;
+}
+