diff options
Diffstat (limited to 'src/module')
| -rw-r--r-- | src/module/time.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/module/time.rs b/src/module/time.rs index f334fd0..0388f62 100644 --- a/src/module/time.rs +++ b/src/module/time.rs @@ -1,8 +1,7 @@ use crate::error::Result; use crate::facility::FacilityType; -use crate::module::Module; +use crate::module::{ CreatableModule, Module }; -use std::sync::{ Arc, Mutex }; use std::time::Duration; use time::OffsetDateTime; @@ -15,22 +14,24 @@ pub struct TimeModule { } -impl Module for TimeModule { +impl CreatableModule for TimeModule { const REQUIRED_FACILITIES: FacilityType = FacilityType::empty(); - fn new() -> Result<Arc<Mutex<TimeModule>>> { + fn new() -> Result<TimeModule> { let format_string = "[weekday repr:short] [year]-[month]-[day] ".to_owned() + "[hour repr:24]:[minute]:[second]"; let time_format = parse_owned::<3>(&format_string).unwrap(); - Ok(Arc::new(Mutex::new(TimeModule { + Ok(TimeModule { time_format, most_recent_report: None, - }))) + }) } +} +impl Module for TimeModule { fn format(&mut self) -> String { let time = OffsetDateTime::now_local().unwrap(); |