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

#62 in Simulation

Download history 1/week @ 2024-08-26 1/week @ 2024-09-02 10/week @ 2024-09-09 54/week @ 2024-09-16 82/week @ 2024-09-23 48/week @ 2024-09-30 280/week @ 2024-10-07 78/week @ 2024-10-14 126/week @ 2024-10-21 19/week @ 2024-10-28 20/week @ 2024-11-04 2/week @ 2024-11-11 24/week @ 2024-11-18 25/week @ 2024-11-25 51/week @ 2024-12-02

102 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