From f1576e09cf4f7576ea99caed58cc1211771b7e68 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 25 Dec 2021 12:34:01 +0100 Subject: [PATCH 291/310] contrib/tzcode/stdtime: Optionally use non-standard ctime() format ... if the environment variable ISO_CTIME is set. Obtained from: ElectroBSD --- contrib/tzcode/stdtime/localtime.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/tzcode/stdtime/localtime.c b/contrib/tzcode/stdtime/localtime.c index 608842d5d432..1d5e1a3cd2b1 100644 --- a/contrib/tzcode/stdtime/localtime.c +++ b/contrib/tzcode/stdtime/localtime.c @@ -24,6 +24,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "private.h" #include "un-namespace.h" @@ -1719,6 +1720,13 @@ struct tm * const tmp; char * ctime(const time_t *const timep) { + if (getenv("ISO_CTIME") != NULL) { + /* + * Use the non-standard time format that is + * considered easier to parse. + */ + return ctime_iso(timep); + } /* ** Section 4.12.3.2 of X3.159-1989 requires that ** The ctime function converts the calendar time pointed to by timer -- 2.37.1