From 94cfe52a780c07be3df03368fc1c46a244e28d0a Mon Sep 17 00:00:00 2001 From: Troltsch Date: Fri, 11 Oct 2024 17:57:11 +0200 Subject: [PATCH] Disabled DST by setting tm_isdst to -1 so that mktime() won't adjust for daylight saving time. This is especially important for custom DST settings --- src/tree_schema_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tree_schema_common.c b/src/tree_schema_common.c index 0faaa3c2c..e6af579b6 100644 --- a/src/tree_schema_common.c +++ b/src/tree_schema_common.c @@ -91,8 +91,8 @@ lysp_check_date(struct lysp_ctx *ctx, const char *date, size_t date_len, const c } memcpy(&tm_, &tm, sizeof tm); - /* DST may move the hour back resulting in a different day */ - tm_.tm_hour = 1; + /* Disabling DST: Set tm_isdst to -1 so that mktime() won't adjust for daylight saving time. */ + tm_.tm_isdst = -1; mktime(&tm_); /* mktime modifies tm_ if it refers invalid date */ if (tm.tm_mday != tm_.tm_mday) { /* e.g 2018-02-29 -> 2018-03-01 */