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
220 downloads per month
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
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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