Skip to main content

as_weeks

Macro as_weeks 

Source
macro_rules! as_weeks {
    ($x:expr) => { ... };
}
Expand description

Converts total attoseconds (i128) → whole weeks (i128).

Equivalent to Dt::attos_to_weeks.

Truncates toward zero.

§Examples

Example shows attos inputs being built with macros rather than counting attosecond zeros by hand.

use deep_time::macros::{as_weeks, days, hours, weeks};

// an amount of attoseconds that is equal to
// −1.5 wk becomes −1 weeks
assert_eq!(as_weeks!(-weeks!(1) - days!(3) - hours!(12)), -1);