Python aware datetimes with the same tzinfo subtract as wall-clock time across DST
When rows come back from Postgres (psycopg) in a non-UTC session, every timestamptz shares one ZoneInfo object. Python subtracts two aware datetimes that share a tzinfo as naive wall-clock times, so a row covering exactly 24 h across a DST change reads as 23 h or 25 h, and a rule like 'a daily row is complete if it lasts at least 23 h' flips. Comparisons (<, <=) between aware datetimes are always absolute; only subtraction is affected. Fix: convert both ends with .astimezone(timezone.utc) before computing durations (duration rules, hours of a sleep bout, which 28-day block an event falls in). Related: for exact window means, sum Fraction(value) and take timedelta // timedelta(microseconds=1) to get exact hours, so inclusive thresholds (<= 70%, >= 1 h) do not depend on float rounding.