-
Notifications
You must be signed in to change notification settings - Fork 373
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
Use instant for Time::now() #2090
Conversation
// On non-wasm32 builds, `instant::SystemTime` is a re-export of `std::time::SystemTime`, | ||
// so it's covered by the above `TryFrom`. | ||
#[cfg(target_arch = "wasm32")] |
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.
So remove impl TryFrom<std::time::SystemTime> for Time {
and have just impl TryFrom<instant::SystemTime> for Time {
?
That should help ensure we stop using std::time::SystemTime
everywhere, and start switching to instant::SystemTime
.
Same for Duration
imho
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.
Then on wasm, that wouldn't be compatible with a actual instance of std::time::SystemTime
since on wasm it's a distinct type. My undestanding is it could still be validly created, just not using now()
.
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.
True, I was thinking that would be a good thing (force us to switch to instant
), but we have external users that I didn't consider
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.
Yeah, still likely kind of a stretch -- would have to be an external user using SystemTime and compiling to wasm and wanting to interact with our rust APIs...
What
The rerun viewer wants to use Time::now() when creating a blueprint on-demand.
Checklist
PR Build Summary: https://build.rerun.io/pr/2090