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

Test time::tests::instant_math fails on Windows (GNU) with +/-1 error #29970

Closed
petrochenkov opened this issue Nov 21, 2015 · 2 comments
Closed

Comments

@petrochenkov
Copy link
Contributor

Windows 8.1 64-bit / MSYS2 / MinGW-w64

thread '<unnamed>' panicked at 'assertion failed: `(left == right)` (left: `Instant { t: 3793243355088 }`, right: `Instant { t: 3793243355087 }`)', src/libstd\time/mod.rs:252
test time::tests::instant_math ... FAILED

cc @alexcrichton

@alexcrichton
Copy link
Member

Interesting! This is testing the property that the duration between two instants plus the first is the same as the second. Unfortunately this isn't true on Windows due to the +/- one problem on multiple cores.

Have to think about what's the best course of action here.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Nov 23, 2015
Typical algebra currently doesn't work on the types in std::time currently (see
[this comment][comment]), so tweak the tests to account for this property.

[comment]: rust-lang#29866 (comment)

Closes rust-lang#29970
bors added a commit that referenced this issue Nov 24, 2015
Typical algebra currently doesn't work on the types in std::time currently (see
[this comment][comment]), so tweak the tests to account for this property.

[comment]: #29866 (comment)

Closes #29970
@petrochenkov
Copy link
Contributor Author

This still fails, btw

thread '<unnamed>' panicked at 'assertion failed: a - Duration::new(0, 1) <= b', src/libstd\time/mod.rs:262

alexcrichton added a commit to alexcrichton/rust that referenced this issue Nov 30, 2015
I believe that because Windows' unit of resolution is 100ns that this unit of
time will ensure that the assertions will hold true as it's representable in the
native format.

cc rust-lang#29970
bors added a commit that referenced this issue Dec 1, 2015
I believe that because Windows' unit of resolution is 100ns that this unit of
time will ensure that the assertions will hold true as it's representable in the
native format.

cc #29970
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

No branches or pull requests

2 participants