]> git.pond.sub.org Git - empserver/commitdiff
show: Drop Windows-specific fmttime2822() code
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 27 Jan 2021 07:43:24 +0000 (08:43 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 13 Feb 2021 18:25:18 +0000 (19:25 +0100)
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 <armbru@pond.sub.org>
src/lib/subs/show.c

index 839922754ed289781e7b110608d5ca486bee1780..79ba622b03bdc9406df746f81938b516b6f0569e 100644 (file)
@@ -615,34 +615,10 @@ static char *
 fmttime2822(time_t t)
 {
     static char buf[32];
 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;
                        localtime(&t));
     if (CANT_HAPPEN(n == 0))
        buf[0] = 0;
-#endif
     return buf;
 }
 
     return buf;
 }