Returns the session duration as a human-readable string.
(&self)
| 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 | |
| 656 | impl fmt::Display for AgentSession { |
nothing calls this directly
no outgoing calls
no test coverage detected