[−][src]Macro ms_converter::ms_expr
Zero cost converter from human-like time into a number.
In the first argument, you need to pass type of your number (i64
, f64
and etc).
The second argument is human-time construction, like 1 day
, 2 h
.
The output will be a number with type what you set in the first argument.
This macro will be precalculated in compilation time. Also, you can use ms_expr with constants:
use crate::ms_converter::ms_expr; const VALUE: f64 = ms_expr!(f64, 2.5 hrs); assert_eq!(VALUE, 9000000.)
Usage
use crate::ms_converter::ms_expr; assert_eq!(ms_expr!(i64, 1 d), 86400000)