Skip to content

Commit

Permalink
Fix math time
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueZeeKing committed May 10, 2024
1 parent ae51fdb commit 691372e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/math/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ pub fn get_time() -> Duration {
Duration::from_micros(time)
}

#[cfg(not(all(feature = "std", feature = "frc")))]
fn get_time() -> Duration {
use std::{sync::OnceLock, time::Instant};

static START: OnceLock<Instant> = OnceLock::new();

START.get_or_init(|| Instant::now()).elapsed()
}

/// Constrain an angle to 0 and 2 pi. All angles are in radians
pub fn normalize_angle(angle: f32) -> f32 {
if angle > 2.0 * PI {
Expand Down

0 comments on commit 691372e

Please sign in to comment.