date.rs
1 use alloc::string::String as AllocString; 2 use core::fmt::Write; 3 4 use crate::time; 5 6 pub fn run() -> AllocString { 7 let mut out = AllocString::new(); 8 let epoch = time::get_current_epoch_secs(); 9 10 if epoch == 0 { 11 let _ = write!(out, "\x1b[2mtime not synced\x1b[0m\r\n"); 12 } else { 13 let _ = write!(out, "{}\r\n", time::format_iso8601(epoch)); 14 } 15 16 out 17 }