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

Method activity_datetime

atomic-core/src/change/session.rs:661–671  ·  view source on GitHub ↗

Latest turn time, or the session end/start time if it has no turns. Handles current milliseconds and historical seconds without changing them.

(
        &self,
        turns: &[SessionTurn],
    )

Source from the content-addressed store, hash-verified

659 /// Latest turn time, or the session end/start time if it has no turns.
660 /// Handles current milliseconds and historical seconds without changing them.
661 pub fn activity_datetime(
662 &self,
663 turns: &[SessionTurn],
664 ) -> Option<chrono::DateTime<chrono::Utc>> {
665 let timestamp = turns
666 .last()
667 .map(|turn| turn.timestamp)
668 .or(self.ended_at)
669 .unwrap_or(self.started_at);
670 crate::types::timestamp::epoch_datetime(timestamp)
671 }
672
673 pub fn to_bytes(&self) -> Vec<u8> {
674 postcard::to_allocvec(self).expect("SessionRecord serialization")

Callers 1

render_recent_sessionsFunction · 0.80

Calls 2

epoch_datetimeFunction · 0.85
lastMethod · 0.80

Tested by

no test coverage detected