Skip to content

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

Merged
merged 1 commit into from
Oct 5, 2017

Conversation

hujiajie
Copy link
Contributor

@hujiajie hujiajie commented Oct 4, 2017

Fixes: #5617

Copy link
Member

@kripken kripken left a 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.

@@ -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']:
Copy link
Member

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)

Copy link
Contributor Author

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') }}};
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@kripken kripken merged commit 74c1c5c into emscripten-core:incoming Oct 5, 2017
@kripken
Copy link
Member

kripken commented Oct 5, 2017

Thanks!

@hujiajie hujiajie deleted the test_time branch December 7, 2017 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants