Skip to main content

Module screen_time

Module screen_time 

Source

Structs§

ScreenTimeState
Cumulative active-screen time for the current local day, plus the epoch of the most recent wind-down reminder (so we don’t re-nag every tick after the budget is crossed).

Functions§

persist_screen_time
Atomically write state to disk. Called every tick that the counter changes, plus on rollover and after firing a reminder.
rollover_if_new_day
Mutate state to a fresh-day baseline if today differs from its stored date. Returns true iff a rollover happened (so the caller can decide whether to persist).
should_remind_screen_time
Decide whether to fire the daily-budget reminder this tick. Returns true when the feature is on, the budget is non-zero, the counter has crossed the budget, and either no reminder has fired yet today or the snooze window has elapsed (remind_again_secs == 0 means fire once per day only).