diff --git a/services/bao-console/Cargo.toml b/services/bao-console/Cargo.toml index 4ead1e736..1488e7c08 100644 --- a/services/bao-console/Cargo.toml +++ b/services/bao-console/Cargo.toml @@ -32,6 +32,9 @@ rand_core = "0.6.4" aes = { path = "../aes", default-features = false, optional = true } +# time testing +chrono = "0.4.33" + # hid bringup xous-usb-hid = { git = "https://github.com/betrusted-io/xous-usb-hid.git", branch = "main", optional = true } diff --git a/services/bao-console/src/cmds/test.rs b/services/bao-console/src/cmds/test.rs index b21f3d64a..f34588b74 100644 --- a/services/bao-console/src/cmds/test.rs +++ b/services/bao-console/src/cmds/test.rs @@ -37,6 +37,25 @@ impl<'a> ShellCmdApi<'a> for Test { } } } + "time" => { + use chrono::Utc; + let systime = std::time::SystemTime::now(); + let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap(); + log::info!("Seconds since epoch: {}", epoch.as_secs()); + log::info!("Systime: {:?}", systime); + let now = Utc::now(); + log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC")); + + log::info!("Waiting 3 seconds"); + std::thread::sleep(std::time::Duration::from_secs(3)); + + let systime = std::time::SystemTime::now(); + let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap(); + log::info!("Seconds since epoch: {}", epoch.as_secs()); + log::info!("Systime: {:?}", systime); + let now = Utc::now(); + log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC")); + } #[cfg(feature = "bmp180")] "temp" => { use bao1x_hal::bmp180::Bmp180;