37 releases (11 breaking)

new 0.12.1 Apr 10, 2024
0.11.2 Apr 2, 2024
0.11.1 Mar 14, 2024
0.9.5 Dec 14, 2023
0.4.0 Mar 22, 2023

#73 in Date and time

Download history 75/week @ 2023-12-18 20/week @ 2023-12-25 87/week @ 2024-01-01 121/week @ 2024-01-08 302/week @ 2024-01-15 225/week @ 2024-01-22 103/week @ 2024-01-29 224/week @ 2024-02-05 246/week @ 2024-02-12 183/week @ 2024-02-19 135/week @ 2024-02-26 101/week @ 2024-03-04 204/week @ 2024-03-11 112/week @ 2024-03-18 22/week @ 2024-03-25 413/week @ 2024-04-01

753 downloads per month

MIT/Apache

65KB
1K SLoC

It's Rust time!

Low overhead implementation of time-related concepts.

Who is time for?

For applications where simplicity and low-overhead are more important than precision, safety, and time zone support.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Low overhead implementation of time related concepts.

Operator support

// | example                                       | left       | op | right    | result     |
// | ----------------------------------------------| ---------- | ---| -------- | ---------- |
let result: Duration = time - time;             // | Time       | -  | Time     | Duration   |
let result: Time = time + duration;             // | Time       | +  | Duration | Time       |
time += duration;                               // | Time       | += | Duration | Time       |
let result: Time = time - duration;             // | Time       | -  | Duration | Time       |
time -= duration;                               // | Time       | -= | Duration | Time       |
let result: Duration = duration + duration;     // | Duration   | +  | Duration | Duration   |
duration += duration;                           // | Duration   | += | Duration | Duration   |
let result: Duration = duration - duration;     // | Duration   | -  | Duration | Duration   |
duration -= duration;                           // | Duration   | -= | Duration | Duration   |
let result: Duration = duration * 1.0f64;       // | Duration   | *  | f64      | Duration   |
let result: Duration = 2.0f64 * duration;       // | f64        | *  | Duration | Duration   |
duration *= 2.0f64;                             // | Duration   | *= | f64      | Duration   |
let result: Duration = duration / 2.0f64;       // | Duration   | /  | f64      | Duration   |
duration /= 2.0f64;                             // | Duration   | /= | f64      | Duration   |
let result: Duration = duration * 7i64;         // | Duration   | *  | i64      | Duration   |
let result: Duration = 7i64 * duration;         // | i64        | *  | Duration | Duration   |
duration *= 7i64;                               // | Duration   | *= | i64      | Duration   |
let result: Duration = duration / 7i64;         // | Duration   | /  | i64      | Duration   |
duration /= 7i64;                               // | Duration   | /= | i64      | Duration   |
let result: f64 = duration / duration;          // | Duration   | /  | Duration | f64        |

Dependencies

~3.5–5.5MB
~95K SLoC