9 releases
0.0.9 | Oct 10, 2024 |
---|---|
0.0.8 | Oct 10, 2024 |
0.0.7 | Apr 28, 2024 |
0.0.6 | Jan 26, 2024 |
#56 in Simulation
273 downloads per month
Used in 17 crates
(13 directly)
6KB
51 lines
📦 tick-id
Session unique Tick ID that specifies a specific tick in a deterministic simulation.
A tick represents any positive integer time period, excluding zero, with typical durations being 16 ms or 32 ms.
TickId is represented as a u32. With each tick equivalent to 16 ms, the maximum duration is approximately 68,719,476 seconds, which translates to about 2.18 years.
“2.18 years should be enough for everyone!”
Installation
[dependencies]
tick-id = "0.0.8"
lib.rs
:
The TickId
type represents a specific tick in a deterministic simulation.
A tick typically corresponds to a duration of 16 ms or 32 ms, but it can denote any positive integer time
period, excluding zero. The TickId
is implemented as a u32
, allowing for a wide range of tick values.
Example
use tick_id::TickId;
let tick_id = TickId::new(1);
println!("Tick ID: {}", tick_id);
Operations
The TickId
type supports addition and subtraction operations, allowing for easy manipulation of tick values.
Overflow and underflow are checked during arithmetic operations to ensure safety.