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

Replace instant by web-time #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Vrixyz
Copy link
Contributor

@Vrixyz Vrixyz commented Jun 24, 2024

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

$ cargo tree -i instant
instant v0.1.13
├── rapier2d v0.21.0
│   ├── examples2d v0.1.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\examples2d)
│   ├── rapier_testbed2d v0.21.0
│   │   ├── examples2d v0.1.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\examples2d)
│   │   └── salva2d v0.9.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\build\salva2d)
│   │       └── examples2d v0.1.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\examples2d)
│   └── salva2d v0.9.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\build\salva2d) (*)
├── rapier3d v0.21.0
│   ├── examples3d v0.1.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\examples3d)
│   ├── rapier_testbed3d v0.21.0
│   │   ├── examples3d v0.1.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\examples3d)
│   │   └── salva3d v0.9.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\build\salva3d)
│   │       └── examples3d v0.1.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\examples3d)
│   └── salva3d v0.9.0 (C:\Users\thier\Documents\pro\clients\foresight\projects\salva\build\salva3d) (*)
├── rapier_testbed2d v0.21.0 (*)
└── rapier_testbed3d v0.21.0 (*)

@@ -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());
Copy link
Contributor Author

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.

@ekalosak
Copy link

ekalosak commented Jul 3, 2024

Why make this change?

@Vrixyz
Copy link
Contributor Author

Vrixyz commented Jul 3, 2024

Short answer is that instant is no longer maintained and makes web target difficult to compile.

@Vrixyz Vrixyz requested a review from sebcrozet August 26, 2024 11:53
Copy link
Member

@sebcrozet sebcrozet left a 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 Show resolved Hide resolved
src/counters/timer.rs Outdated Show resolved Hide resolved
@@ -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());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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();
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let step_time = Instant::now().elapsed().as_secs_f64();
let step_time = Instant::now();

src/integrations/rapier/harness_plugin.rs Outdated Show resolved Hide resolved
src/integrations/rapier/testbed_plugin.rs Outdated Show resolved Hide resolved
src/integrations/rapier/testbed_plugin.rs Outdated Show resolved Hide resolved
Copy link
Member

@sebcrozet sebcrozet left a 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!

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.

3 participants