summaryrefslogtreecommitdiff
path: root/contrib/file/print.c
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2001-10-08 22:50:54 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2001-10-08 22:50:54 +0000
commit649d615c25f64d6f740ad79df7d6d25d98c9a88b (patch)
tree51ee57c1f591278e5d817e2260d7e1132323a26f /contrib/file/print.c
parent2e67ec0205346336544da4aeebec926df199ee19 (diff)
Notes
Diffstat (limited to 'contrib/file/print.c')
-rw-r--r--contrib/file/print.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/contrib/file/print.c b/contrib/file/print.c
index bf2c66799e56..b6803994448e 100644
--- a/contrib/file/print.c
+++ b/contrib/file/print.c
@@ -41,7 +41,7 @@
#include <time.h>
#ifndef lint
-FILE_RCSID("@(#)$Id: print.c,v 1.33 2001/07/22 21:04:15 christos Exp $")
+FILE_RCSID("@(#)$Id: print.c,v 1.34 2001/08/07 16:01:26 christos Exp $")
#endif /* lint */
#define SZOF(a) (sizeof(a) / sizeof(a[0]))
@@ -234,10 +234,24 @@ fmttime(v, local)
{
char *pp, *rt;
time_t t = (time_t)v;
+ struct tm *tm;
+
if (local) {
pp = ctime(&t);
} else {
- struct tm *tm;
+#ifndef HAVE_DAYLIGHT
+ static int daylight = 0;
+#ifdef HAVE_TM_ISDST
+ static time_t now = (time_t)0;
+
+ if (now == (time_t)0) {
+ struct tm *tm1;
+ (void)time(&now);
+ tm1 = localtime(&now);
+ daylight = tm1->tm_isdst;
+ }
+#endif /* HAVE_TM_ISDST */
+#endif /* HAVE_DAYLIGHT */
if (daylight)
t += 3600;
tm = gmtime(&t);