MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / duration_display

Method duration_display

atomic-agent/src/turn/session.rs:639–653  ·  view source on GitHub ↗

Returns the session duration as a human-readable string.

(&self)

Source from the content-addressed store, hash-verified

637
638 /// Returns the session duration as a human-readable string.
639 pub fn duration_display(&self) -> String {
640 let end = self.ended_at.unwrap_or_else(Utc::now);
641 let duration = end.signed_duration_since(self.started_at);
642 let secs = duration.num_seconds();
643
644 if secs < 60 {
645 format!("{}s", secs)
646 } else if secs < 3600 {
647 format!("{}m {}s", secs / 60, secs % 60)
648 } else {
649 let hours = secs / 3600;
650 let minutes = (secs % 3600) / 60;
651 format!("{}h {}m", hours, minutes)
652 }
653 }
654}
655
656impl fmt::Display for AgentSession {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected