|
|
@ -42,25 +42,17 @@ impl Unit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[cfg(not(nightly))]
|
|
|
|
#[cfg(not(nightly))]
|
|
|
|
fn multiplier(&self) -> u64 {
|
|
|
|
fn multiplier(&self) -> u64 {
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
match self {
|
|
|
|
use std::collections::HashMap;
|
|
|
|
Second => 1000,
|
|
|
|
|
|
|
|
Minute => Second.multiplier() * 60,
|
|
|
|
|
|
|
|
Hour => Minute.multiplier() * 60,
|
|
|
|
fn calc_table(&self) -> {
|
|
|
|
Day => Hour.multiplier() * 24,
|
|
|
|
use Unit::*;
|
|
|
|
Week => Day.multiplier() * 7,
|
|
|
|
match self {
|
|
|
|
Year => Week.multiplier() * 52,
|
|
|
|
Second => 1000,
|
|
|
|
Aeon => Year.multiplier() * 1000000,
|
|
|
|
Minute => Second.multiplier() * 60,
|
|
|
|
|
|
|
|
Hour => Minute.multiplier() * 60,
|
|
|
|
|
|
|
|
Day => Hour.multiplier() * 24,
|
|
|
|
|
|
|
|
Week => Day.multiplier() * 7,
|
|
|
|
|
|
|
|
Year => Week.multiplier() * 52,
|
|
|
|
|
|
|
|
Aeon => Year.multiplier() * 1000000,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
*MUL_TABLE.get(&self).unwrap()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// A time object parsed from the definition file.
|
|
|
|
/// A time object parsed from the definition file.
|
|
|
|