Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider daylight savings in _dateStr() #163

Merged
merged 1 commit into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions MiniScript-cpp/src/DateTimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
14 changes: 14 additions & 0 deletions MiniScript-cpp/tests/testDaylight.ms
Original file line number Diff line number Diff line change
@@ -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