system call mod

master
Avril 4 years ago
parent b07b68d587
commit 908c520b35
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -45,20 +45,20 @@ impl Unit
use lazy_static::lazy_static; use lazy_static::lazy_static;
use std::collections::HashMap; use std::collections::HashMap;
fn calc_table(&self) -> {
use Unit::*; use Unit::*;
lazy_static! { match self {
static ref MUL_TABLE: HashMap<Unit, u64> = { Second => 1000,
let mut map = HashMap::with_capacity(8); Minute => Second.multiplier() * 60,
map.insert(Second, 1000); Hour => Minute.multiplier() * 60,
map.insert(Minute, Second.multiplier() * 60); Day => Hour.multiplier() * 24,
map.insert(Hour, Minute.multiplier() * 60); Week => Day.multiplier() * 7,
map.insert(Day, Hour.multiplier() * 24); Year => Week.multiplier() * 52,
map.insert(Week, Day.multiplier() * 7); Aeon => Year.multiplier() * 1000000,
map.insert(Year, Week.multiplier() * 52); }
map.insert(Aeon, Year.multiplier() * 1000000);
map
};
} }
*MUL_TABLE.get(&self).unwrap() *MUL_TABLE.get(&self).unwrap()
} }
} }

@ -0,0 +1,2 @@
use super::*;
Loading…
Cancel
Save