MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / format_timestamp_ms

Function format_timestamp_ms

crates/openshell-cli/src/run.rs:7823–7836  ·  view source on GitHub ↗

Format a millisecond timestamp into a readable string.

(ms: i64)

Source from the content-addressed store, hash-verified

7821
7822/// Format a millisecond timestamp into a readable string.
7823fn format_timestamp_ms(ms: i64) -> String {
7824 if ms <= 0 {
7825 return "-".to_string();
7826 }
7827 let secs = ms / 1000;
7828 let mins = (secs / 60) % 60;
7829 let hours = (secs / 3600) % 24;
7830 let days = secs / 86400;
7831 if days > 0 {
7832 format!("{days}d {hours:02}:{mins:02}")
7833 } else {
7834 format!("{hours:02}:{mins:02}")
7835 }
7836}
7837
7838#[cfg(test)]
7839mod tests {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected