14 releases (1 stable)
✓ Uses Rust 2018 edition
|new 1.0.0||Mar 25, 2020|
|0.7.4||Mar 24, 2020|
|0.6.0||Mar 17, 2020|
|0.5.1||Mar 16, 2020|
|0.1.0||Mar 11, 2020|
#26 in Date and time
201 downloads per month
Fast abstraction for converting human-like times into milliseconds.
There are two ways to calculate milliseconds:
- In the runtime
- In the compilation time
Add this to your Cargo.toml:
[dependencies] ms-converter = "1.0"
use crate::ms_converter::ms; let value = ms("1d").unwrap(); assert_eq!(value, 86400000)
use crate::ms_converter::ms_expr; const VALUE: i64 = ms_expr!(i64, 1 d); assert_eq!(VALUE, 86400000)
use crate::ms_converter::ms_into_time; let value = ms_into_time("1d").unwrap(); assert_eq!(value.as_millis(), 86400000)
msand empty postfix
You can check the performance diff between
ms libraries here.
Also, the macro has no time in the runtime! It will be converted into the const value.
Running code style tests
cargo fmt --all -- --check
Just create pr or issue. You welcome.
- Mikhail Panfilov - Initial work - Mnwa
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details