-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix test_time failure in non-DST time zones #5624
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good, just 2 minor questions to address.
tests/test_core.py
Outdated
@@ -2083,7 +2083,16 @@ def test_tcgetattr(self): | |||
def test_time(self): | |||
src = open(path_from_root('tests', 'time', 'src.cpp'), 'r').read() | |||
expected = open(path_from_root('tests', 'time', 'output.txt'), 'r').read() | |||
self.do_run(src, expected); | |||
try: | |||
for tz in ['EST+05EDT', 'UTC+0']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the current execution without TZ set, that is, that this PR only adds 2 more executions? (can do it before the loop, if so)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/library.js
Outdated
@@ -1913,7 +1913,7 @@ LibraryManager.library = { | |||
var winterOffset = start.getTimezoneOffset(); | |||
var dstOffset = Math.min(winterOffset, summerOffset); // DST is in December in South | |||
if (dst < 0) { | |||
{{{ makeSetValue('tmPtr', C_STRUCTS.tm.tm_isdst, 'Number(dstOffset == guessedOffset)', 'i32') }}}; | |||
{{{ makeSetValue('tmPtr', C_STRUCTS.tm.tm_isdst, 'Number(summerOffset != winterOffset && dstOffset == guessedOffset)', 'i32') }}}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, so the issue is that some regions don't have DST at all?
Please add a comment mentioning that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks! |
Fixes: #5617