43 releases

new 0.12.7 Nov 22, 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 47/week @ 2024-08-02 39/week @ 2024-08-09 18/week @ 2024-08-16 17/week @ 2024-08-23 44/week @ 2024-08-30 83/week @ 2024-09-06 68/week @ 2024-09-13 79/week @ 2024-09-20 84/week @ 2024-09-27 246/week @ 2024-10-04 250/week @ 2024-10-11 53/week @ 2024-10-18 42/week @ 2024-10-25 43/week @ 2024-11-01 85/week @ 2024-11-08 98/week @ 2024-11-15

277 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
~95K SLoC