-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Replace instant by web-time #53
base: master
Are you sure you want to change the base?
Conversation
src/counters/timer.rs
Outdated
@@ -54,7 +55,7 @@ impl Timer { | |||
/// Resume the timer. | |||
pub fn resume(&mut self) { | |||
if self.enabled { | |||
self.start = Some(instant::now()); | |||
self.start = Some(Instant::now().elapsed().as_secs_f64()); |
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.
I'm not sure if there's a less verbose way to get that.
Why make this change? |
Short answer is that instant is no longer maintained and makes web target difficult to compile. |
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.
Thank you for the PR!
src/counters/timer.rs
Outdated
@@ -54,7 +55,7 @@ impl Timer { | |||
/// Resume the timer. | |||
pub fn resume(&mut self) { | |||
if self.enabled { | |||
self.start = Some(instant::now()); | |||
self.start = Some(Instant::now().elapsed().as_secs_f64()); |
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.
self.start = Some(Instant::now().elapsed().as_secs_f64()); | |
self.start = Some(Instant::now()); |
@@ -57,7 +58,7 @@ impl HarnessPlugin for FluidsHarnessPlugin { | |||
} | |||
|
|||
fn step(&mut self, physics: &mut PhysicsState, _run_state: &RunState) { | |||
let step_time = instant::now(); | |||
let step_time = Instant::now().elapsed().as_secs_f64(); |
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.
let step_time = Instant::now().elapsed().as_secs_f64(); | |
let step_time = Instant::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.
Looking good now, thanks!
TODO: I'll want a changelog line once #54 is merged
To be noted instant is still used somewhere in the dependencies, mostly optionally and through rapier_testbed
Details