From 6555d0f34894b30c5995ae2a70e227baddd0ad8b Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sun, 16 Sep 2007 12:09:37 +0000 Subject: rename Targ_FmtTime into time_to_string and move it, as it's not related to target nodes at all (reduces modules inter-dependencies) --- usr.bin/make/timestamp.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'usr.bin/make/timestamp.c') 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, ×); #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; +} + -- cgit v1.2.3