add some test routines for checking RTC functions

This commit is contained in:
bunnie 2025-11-24 18:28:50 +08:00
parent 9ff8ab0caa
commit 62b656db8a
2 changed files with 22 additions and 0 deletions

View file

@ -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 }

View file

@ -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;