Expand description
Port of the timing helpers from box2d-cpp-reference/src/timer.c
(b2GetTicks, b2GetMilliseconds, b2GetMillisecondsAndReset).
Mutex / semaphore / thread wrappers from that file are not ported — Rust’s standard library covers them. Only the profiling clock remains.
Uses std::time::Instant for relative durations. On wasm32 Instant is backed
by performance.now() in current rustc, which is enough for demo profiling
(Capacity’s 20 ms threshold) as well as native.
SPDX-FileCopyrightText: 2023 Erin Catto SPDX-License-Identifier: MIT
Structs§
- Ticks
- Opaque tick capture. (return value of
b2GetTicks)
Functions§
- get_
milliseconds - Milliseconds elapsed since
ticks. (b2GetMilliseconds) - get_
milliseconds_ and_ reset - Milliseconds elapsed since
ticks, then resetticksto now. (b2GetMillisecondsAndReset) - get_
ticks - Capture the current time. (
b2GetTicks)