Coarse `[start, end]` window from the widest pair of known bounds, or `None` when the session carries no usable timestamp at all. Each bound is normalized to unix seconds (see [`normalize_activity_ts`]) so mixed seconds/millis rows on legacy stores produce a seconds-scale window.
(&self)
| 42 | /// normalized to unix seconds (see [`normalize_activity_ts`]) so mixed |
| 43 | /// seconds/millis rows on legacy stores produce a seconds-scale window. |
| 44 | pub fn window(&self) -> Option<(i64, i64)> { |
| 45 | let mut lo: Option<i64> = None; |
| 46 | let mut hi: Option<i64> = None; |
| 47 | for ts in [ |
| 48 | self.started_at, |
| 49 | self.ended_at, |
| 50 | self.message_min_ts, |
| 51 | self.message_max_ts, |
| 52 | ] |
| 53 | .into_iter() |
| 54 | .flatten() |
| 55 | .map(normalize_activity_ts) |
| 56 | { |
| 57 | lo = Some(lo.map_or(ts, |cur| cur.min(ts))); |
| 58 | hi = Some(hi.map_or(ts, |cur| cur.max(ts))); |
| 59 | } |
| 60 | match (lo, hi) { |
| 61 | (Some(lo), Some(hi)) => Some((lo, hi)), |
| 62 | _ => None, |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | /// One `HEAD` position in a worktree's reflog timeline: the branch `HEAD` |
no outgoing calls