]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/, src/: Use local time for human-readable dates
authorAlejandro Colomar <alx@kernel.org>
Wed, 31 Jul 2024 12:35:15 +0000 (14:35 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Thu, 1 Aug 2024 08:12:44 +0000 (10:12 +0200)
That is, use localtime_r(3) instead of gmtime_r(3).

Closes: <https://github.com/shadow-maint/shadow/issues/1057>
Reported-by: Gus Kenion <https://github.com/kenion>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/time/day_to_str.h
src/chage.c

index 374240f55ae4791b621f2206d232ff4b9d8991e7..f908a75243959615aba29ac07e88bffdff6bbfcd 100644 (file)
@@ -38,7 +38,7 @@ day_to_str(size_t size, char buf[size], long day)
                return;
        }
 
-       if (gmtime_r(&date, &tm) == NULL) {
+       if (localtime_r(&date, &tm) == NULL) {
                strtcpy(buf, "future", size);
                return;
        }
index 1e296fca500358fd11c112f1950930396878b7d0..5146fde0aba3943c738673ebd90a085050e8dd16 100644 (file)
@@ -242,7 +242,7 @@ print_day_as_date(long day)
                return;
        }
 
-       if (gmtime_r(&date, &tm) == NULL) {
+       if (localtime_r(&date, &tm) == NULL) {
                (void) printf ("time_t: %lu\n", (unsigned long)date);
                return;
        }