From 3f5b4b56268269fefed55aa106f382037297d663 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 31 Jul 2024 14:35:15 +0200 Subject: [PATCH] lib/, src/: Use local time for human-readable dates That is, use localtime_r(3) instead of gmtime_r(3). Closes: Reported-by: Gus Kenion Cc: Serge Hallyn Cc: Paul Eggert Signed-off-by: Alejandro Colomar --- lib/time/day_to_str.h | 2 +- src/chage.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/time/day_to_str.h b/lib/time/day_to_str.h index 374240f5..f908a752 100644 --- a/lib/time/day_to_str.h +++ b/lib/time/day_to_str.h @@ -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; } diff --git a/src/chage.c b/src/chage.c index 1e296fca..5146fde0 100644 --- a/src/chage.c +++ b/src/chage.c @@ -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; }