diff --git a/src/timeapp.rs b/src/timeapp.rs index 3ec199d..ce6de0c 100644 --- a/src/timeapp.rs +++ b/src/timeapp.rs @@ -70,7 +70,10 @@ impl Applet for TimeApplet { } fn new() -> Box { - Box::new(Self { local: false, verbose: false }) + Box::new(Self { + local: false, + verbose: false, + }) } fn parse_args(&self, args: &clap::ArgMatches) -> Result> { @@ -96,28 +99,37 @@ impl Applet for TimeApplet { (12, _) => /* Epoch centiseconds */ { - (decode_epoch_subseconds(ts_int, 100), "Centiseconds since Epoch") + ( + decode_epoch_subseconds(ts_int, 100), + "Centiseconds since Epoch", + ) } (13, _) => /* Epoch milliseconds */ { - (decode_epoch_subseconds(ts_int, 1000), "Milliseconds since Epoch") + ( + decode_epoch_subseconds(ts_int, 1000), + "Milliseconds since Epoch", + ) } (16, _) => /* Epoch microseconds */ { - (decode_epoch_subseconds(ts_int, 1_000_000), "Microseconds since Epoch") + ( + decode_epoch_subseconds(ts_int, 1_000_000), + "Microseconds since Epoch", + ) } (18, _) => /* Windows FILETIME */ { (decode_windows_filetime(ts_int), "Windows FILETIME") } - _ => (decode_epoch_seconds(ts_int), "Seconds since Epoch") + _ => (decode_epoch_seconds(ts_int), "Seconds since Epoch"), }; let tse = ts.with_context(|| "Could not convert timestamp")?; if self.verbose { - eprintln!("Used format: {}", type_str); + eprintln!("Used format: {}", type_str); } let ts = if self.local { let offset = UtcOffset::current_local_offset().unwrap_or(UtcOffset::UTC); @@ -142,7 +154,10 @@ mod tests { #[test] fn test_decimal() { - let ts = TimeApplet { local: false, verbose: false }; + let ts = TimeApplet { + local: false, + verbose: false, + }; assert_eq!(run_decode(&ts, "0"), "1970-01-01T00:00:00Z"); assert_eq!(run_decode(&ts, "1420070400"), "2015-01-01T00:00:00Z"); assert_eq!(run_decode(&ts, "142007040000"), "2015-01-01T00:00:00Z"); @@ -166,7 +181,10 @@ mod tests { #[test] fn test_hex() { - let ts = TimeApplet { local: false, verbose: false }; + let ts = TimeApplet { + local: false, + verbose: false, + }; assert_eq!(run_decode(&ts, "0x0"), "1970-01-01T00:00:00Z"); assert_eq!(run_decode(&ts, "0x1"), "1970-01-01T00:00:01Z"); }