From db986900be7563fcfa60d7e4545b3ce747dabbb6 Mon Sep 17 00:00:00 2001 From: Marc Gurevitx Date: Mon, 15 Jul 2024 13:37:53 +0200 Subject: [PATCH] Fix for #159 --- MiniScript-cpp/src/DateTimeUtils.cpp | 1 + MiniScript-cpp/tests/testDaylight.ms | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 MiniScript-cpp/tests/testDaylight.ms diff --git a/MiniScript-cpp/src/DateTimeUtils.cpp b/MiniScript-cpp/src/DateTimeUtils.cpp index b0da71d..f172d36 100644 --- a/MiniScript-cpp/src/DateTimeUtils.cpp +++ b/MiniScript-cpp/src/DateTimeUtils.cpp @@ -304,6 +304,7 @@ time_t ParseDate(const String dateStr) { dateTime.tm_mon = now.tm_mon; dateTime.tm_mday = now.tm_mday; } + dateTime.tm_isdst = -1; return mktime(&dateTime); } diff --git a/MiniScript-cpp/tests/testDaylight.ms b/MiniScript-cpp/tests/testDaylight.ms new file mode 100644 index 0000000..7a7380d --- /dev/null +++ b/MiniScript-cpp/tests/testDaylight.ms @@ -0,0 +1,14 @@ +import "qa" + +testDaylight = function + + // This test always only tests a half of functionality depending on whether the host system has "daylight savings" on or off. + + d = "2000-01-01 11:00:00" + qa.assertEqual _dateStr(d, "%H"), "11" + + d = "2000-07-01 11:00:00" + qa.assertEqual _dateStr(d, "%H"), "11" +end function + +if refEquals(locals, globals) then testDaylight