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

#64 in Simulation

Download history 81/week @ 2024-09-17 48/week @ 2024-09-24 44/week @ 2024-10-01 298/week @ 2024-10-08 94/week @ 2024-10-15 92/week @ 2024-10-22 24/week @ 2024-10-29 14/week @ 2024-11-05 4/week @ 2024-11-12 23/week @ 2024-11-19 33/week @ 2024-11-26 44/week @ 2024-12-03 107/week @ 2024-12-10 10/week @ 2024-12-17 5/week @ 2024-12-24

128 downloads per month
Used in 17 crates (13 directly)

MIT license

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.

No runtime deps