From c919b5f81ad6cad55935fa7a22bfda9539dd584f Mon Sep 17 00:00:00 2001 From: eunhhu Date: Tue, 29 Sep 2026 18:12:23 +0100 Subject: Wait for timers on the monotonic clock; events still see the wall clock The terminal, the pixel surfaces and the web page reckoned when a timer was due on the wall clock: set back, a timer waited until the clock came again to the tick it had waited for (Pure's review 004). vega_clock is the monotonic clock; timers are due on it, and a tick sets the time its event sees from the wall clock (vega_now), as before. check.py's clock_set_back runs a timer of 20 ms in the terminal with the wall clock set back an hour 0.2 s in (Pure's build/clock-back.so, an LD_PRELOAD of clock_gettime): 40 ticks in 0.8 s, where Vega before this stops at 9. make check passes it --clock-back. --- surfaces/vega.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'surfaces/vega.h') diff --git a/surfaces/vega.h b/surfaces/vega.h index ff880c5..0ab87dd 100644 --- a/surfaces/vega.h +++ b/surfaces/vega.h @@ -43,12 +43,16 @@ void vega_screen(VegaScreen *, const PureModule *); /* The wall-clock time events see on a live surface: milliseconds since 1970 * (UTC). Scripts set their own (time MS). */ double vega_now(void); -/* When each timer input ticks next. run ticks every one due at now (a tick - * sees now) and gives the milliseconds until the next, or -1 without timers; - * ticked says whether any did. Missed ticks are not made up. */ +/* A clock that only goes on (milliseconds, from boot): when timers are due, + * which setting the wall clock back must not hold up. */ +double vega_clock(void); +/* When each timer input ticks next, on vega_clock. run ticks every one due + * at clock (a tick sees the wall clock, vega_now) and gives the + * milliseconds until the next, or -1 without timers; ticked says whether + * any did. Missed ticks are not made up. */ typedef struct { double next[PURE_MODULE_INPUTS]; } VegaTimers; -void vega_timers_start(VegaTimers *, const PureModule *, double now); -long vega_timers_run(VegaTimers *, PureApp *, double now, bool *ticked); +void vega_timers_start(VegaTimers *, const PureModule *, double clock); +long vega_timers_run(VegaTimers *, PureApp *, double clock, bool *ticked); /* What a module seems to mean but does not meet: a list label that is not * text, a _focus view without its table, a column a list never shows, a * second text input. Each finding names the view or input it is about; -- cgit v1.2.3