Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/cvslatest - use UTC



details:   https://anonhg.NetBSD.org/src/rev/fd497f0485fb
branches:  trunk
changeset: 349856:fd497f0485fb
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Dec 26 14:53:17 2016 +0000

description:
- use UTC
- initialize tm_isdst
- use accpath to handle relative paths

diffstat:

 usr.bin/cvslatest/cvslatest.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (47 lines):

diff -r 787be1b03810 -r fd497f0485fb usr.bin/cvslatest/cvslatest.c
--- a/usr.bin/cvslatest/cvslatest.c     Mon Dec 26 13:55:13 2016 +0000
+++ b/usr.bin/cvslatest/cvslatest.c     Mon Dec 26 14:53:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cvslatest.c,v 1.3 2016/12/19 01:48:00 christos Exp $   */
+/*     $NetBSD: cvslatest.c,v 1.4 2016/12/26 14:53:17 christos Exp $   */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: cvslatest.c,v 1.3 2016/12/19 01:48:00 christos Exp $");
+__RCSID("$NetBSD: cvslatest.c,v 1.4 2016/12/26 14:53:17 christos Exp $");
 
 /*
  * Find the latest timestamp in a set of CVS trees, by examining the
@@ -113,6 +113,7 @@
                        if (!ignore)
                                exit(EXIT_FAILURE);
                }
+               tm.tm_isdst = 0;        // We are in GMT anyway
                if ((t = mktime(&tm)) == (time_t)-1)
                        errx(EXIT_FAILURE, "Time conversion `%s' in `%s'",
                            dt, name);
@@ -152,8 +153,8 @@
                if (strcmp(entry->fts_name, name) != 0)
                         continue;
 
-               getrepo(entry->fts_path, repo, sizeof(repo));
-               getlatest(entry->fts_path, repo, lat);
+               getrepo(entry->fts_accpath, repo, sizeof(repo));
+               getlatest(entry->fts_accpath, repo, lat);
         }
 
         (void)fts_close(dh);
@@ -192,6 +193,9 @@
        if (argc == optind)
                usage();
 
+       // So that mktime behaves consistently
+       setenv("TZ", "UTC", 1);
+
        cvsscan(argv + optind, name, &lat);
        if (debug)
                printlat(&lat);



Home | Main Index | Thread Index | Old Index