diff --git a/src/uu/dmesg/src/dmesg.rs b/src/uu/dmesg/src/dmesg.rs index 58c4d57..5392e67 100644 --- a/src/uu/dmesg/src/dmesg.rs +++ b/src/uu/dmesg/src/dmesg.rs @@ -27,6 +27,22 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { if matches.get_flag(options::JSON) { dmesg.output_format = OutputFormat::Json; } + if let Some(time_format) = matches.get_one::(options::TIME_FORMAT) { + match &time_format[..] { + "delta" => dmesg.time_format = TimeFormat::Delta, + "reltime" => dmesg.time_format = TimeFormat::Reltime, + "ctime" => dmesg.time_format = TimeFormat::Ctime, + "notime" => dmesg.time_format = TimeFormat::Notime, + "iso" => dmesg.time_format = TimeFormat::Iso, + "raw" => dmesg.time_format = TimeFormat::Raw, + _ => { + return Err(USimpleError::new( + 1, + format!("unknown time format: {time_format}"), + )) + } + } + } dmesg.parse()?.print(); Ok(()) } @@ -159,6 +175,7 @@ enum TimeFormat { Delta, Reltime, Ctime, + Notime, Iso, Raw, }