system call mod

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

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