From 598669673e8b08a8bdc763a54da3808f2307cf27 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 27 Jan 2021 08:43:24 +0100 Subject: [PATCH 1/1] show: Drop Windows-specific fmttime2822() code fmttime2822() works around Windows strftime() lacking %z and %T. This is no longer the case, although MinGW still warns about %T. Replace %T by the %H:%M:%S, and drop the work-around. Signed-off-by: Markus Armbruster --- src/lib/subs/show.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/src/lib/subs/show.c b/src/lib/subs/show.c index 839922754..79ba622b0 100644 --- a/src/lib/subs/show.c +++ b/src/lib/subs/show.c @@ -615,34 +615,10 @@ static char * fmttime2822(time_t t) { static char buf[32]; -#if defined(_WIN32) - size_t n; - int nn; - TIME_ZONE_INFORMATION tzi; - long time_offset; - struct tm *time; - - time = localtime(&t); - - n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S", time); - if (CANT_HAPPEN(n == 0)) { - buf[0] = 0; - return buf; - } - GetTimeZoneInformation(&tzi); - time_offset = -(tzi.Bias + - (time->tm_isdst ? tzi.DaylightBias : tzi.StandardBias)); - - nn = _snprintf(buf + n, sizeof(buf) - n, " %+03ld%02ld", - time_offset / 60, labs(time_offset) % 60); - if (CANT_HAPPEN(nn <= 0 || nn + n >= sizeof(buf))) - buf[0] = 0; -#else - size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z", + size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S %z", localtime(&t)); if (CANT_HAPPEN(n == 0)) buf[0] = 0; -#endif return buf; } -- 2.43.0