42 releases

0.12.6 Oct 11, 2024
0.12.4 Jul 26, 2024
0.11.1 Mar 14, 2024
0.9.5 Dec 14, 2023
0.4.0 Mar 22, 2023

#91 in Date and time

Download history 139/week @ 2024-07-28 36/week @ 2024-08-04 35/week @ 2024-08-11 15/week @ 2024-08-18 19/week @ 2024-08-25 74/week @ 2024-09-01 66/week @ 2024-09-08 57/week @ 2024-09-15 78/week @ 2024-09-22 91/week @ 2024-09-29 406/week @ 2024-10-06 96/week @ 2024-10-13 47/week @ 2024-10-20 38/week @ 2024-10-27 42/week @ 2024-11-03 92/week @ 2024-11-10

220 downloads per month

MIT/Apache

72KB
1.5K 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
~96K SLoC