mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
test what local time returns
This commit is contained in:
parent
4ec0eda2b5
commit
b702a68c1c
1 changed files with 5 additions and 1 deletions
|
|
@ -38,13 +38,15 @@ impl<'a> ShellCmdApi<'a> for Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"time" => {
|
"time" => {
|
||||||
use chrono::Utc;
|
use chrono::{Local, Utc};
|
||||||
let systime = std::time::SystemTime::now();
|
let systime = std::time::SystemTime::now();
|
||||||
let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap();
|
let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap();
|
||||||
log::info!("Seconds since epoch: {}", epoch.as_secs());
|
log::info!("Seconds since epoch: {}", epoch.as_secs());
|
||||||
log::info!("Systime: {:?}", systime);
|
log::info!("Systime: {:?}", systime);
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
||||||
|
let local_now = Local::now();
|
||||||
|
log::info!("Local time: {}", local_now.format("%Y-%m-%d %H:%M:%S %Z"));
|
||||||
|
|
||||||
log::info!("Waiting 3 seconds");
|
log::info!("Waiting 3 seconds");
|
||||||
std::thread::sleep(std::time::Duration::from_secs(3));
|
std::thread::sleep(std::time::Duration::from_secs(3));
|
||||||
|
|
@ -55,6 +57,8 @@ impl<'a> ShellCmdApi<'a> for Test {
|
||||||
log::info!("Systime: {:?}", systime);
|
log::info!("Systime: {:?}", systime);
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
||||||
|
let local_now = Local::now();
|
||||||
|
log::info!("Local time: {}", local_now.format("%Y-%m-%d %H:%M:%S %Z"));
|
||||||
}
|
}
|
||||||
#[cfg(feature = "bmp180")]
|
#[cfg(feature = "bmp180")]
|
||||||
"temp" => {
|
"temp" => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue