lib/, src/: Use local time for human-readable dates

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>
This commit is contained in:
Alejandro Colomar
2024-07-31 14:35:15 +02:00
committed by Iker Pedrosa
parent f3f501c81c
commit 3f5b4b5626
2 changed files with 2 additions and 2 deletions
+1 -1
View 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;
}
+1 -1
View 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;
}