44 releases

new 0.13.0 Jan 13, 2025
0.12.7 Nov 22, 2024
0.12.6 Oct 11, 2024
0.12.4 Jul 26, 2024
0.4.0 Mar 22, 2023

#91 in Date and time

Download history 79/week @ 2024-09-21 90/week @ 2024-09-28 373/week @ 2024-10-05 129/week @ 2024-10-12 47/week @ 2024-10-19 38/week @ 2024-10-26 43/week @ 2024-11-02 91/week @ 2024-11-09 181/week @ 2024-11-16 167/week @ 2024-11-23 85/week @ 2024-11-30 128/week @ 2024-12-07 85/week @ 2024-12-14 33/week @ 2024-12-21 22/week @ 2024-12-28 57/week @ 2025-01-04

203 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