From 7ea17db2d22e5bff7e74e045bb089a78a25178bd Mon Sep 17 00:00:00 2001 From: Boris Lytochkin Date: Mon, 23 Nov 2020 23:21:42 +0300 Subject: [PATCH] make 'utc = yes' works for converting strings into unix timestamp as well. --- src/modules/rlm_date/rlm_date.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/rlm_date/rlm_date.c b/src/modules/rlm_date/rlm_date.c index 86a7d6220f9..79191e73d87 100644 --- a/src/modules/rlm_date/rlm_date.c +++ b/src/modules/rlm_date/rlm_date.c @@ -95,7 +95,11 @@ static ssize_t xlat_date_convert(void *instance, REQUEST *request, char const *f goto error; } - date = mktime(&tminfo); + if (!inst->utc) { + date = mktime(&tminfo); + } else { + date = timegm(&tminfo); + } if (date < 0) { REDEBUG("Failed converting parsed time into unix time"); -- 2.47.3