diff --git a/MiniScript-cpp/src/DateTimeUtils.cpp b/MiniScript-cpp/src/DateTimeUtils.cpp index 8cf5984..0bc1b18 100644 --- a/MiniScript-cpp/src/DateTimeUtils.cpp +++ b/MiniScript-cpp/src/DateTimeUtils.cpp @@ -307,6 +307,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