feat(analysis): _max_zero_streak su flag fetch_ok

This commit is contained in:
root
2026-05-13 09:31:38 +00:00
parent 75fe803296
commit aeac8f2a95
2 changed files with 30 additions and 0 deletions
+13
View File
@@ -126,6 +126,19 @@ def _expected_ticks(since: datetime, until: datetime) -> int:
return math.ceil(span_seconds / (_TICK_INTERVAL_MIN * 60))
def _max_zero_streak(flags: list[int]) -> int:
"""Longest run of consecutive zeros."""
longest = 0
current = 0
for v in flags:
if v == 0:
current += 1
longest = max(longest, current)
else:
current = 0
return longest
def _detect_gaps(timestamps: list[datetime]) -> tuple[GapRecord, ...]:
"""Return gaps where consecutive timestamps differ by > threshold."""
out: list[GapRecord] = []