strat9_kernel/shell/commands/util/date.rs
1use super::*;
2
3/// Display the current kernel time.
4///
5/// Shows uptime-based time since boot and the nanosecond timestamp
6/// from the kernel clock source.
7pub fn cmd_date(_args: &[String]) -> Result<(), ShellError> {
8 let ns = crate::syscall::time::current_time_ns();
9 let secs = ns / 1_000_000_000;
10 let hours = (secs / 3600) % 24;
11 let minutes = (secs % 3600) / 60;
12 let s = secs % 60;
13 shell_println!(
14 "Kernel time: {:02}:{:02}:{:02} ({}ns since boot)",
15 hours,
16 minutes,
17 s,
18 ns
19 );
20 Ok(())
21}