diff options
| author | eunhhu <[email protected]> | 2026-09-29 18:12:23 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-09-29 18:12:23 +0100 |
| commit | c919b5f81ad6cad55935fa7a22bfda9539dd584f (patch) | |
| tree | 35a59078aad71e90b5d9f1f23f9f80355ed9325b /surfaces/web.c | |
| parent | 434e8a9930d954494a462690739ea4ead21ff4e8 (diff) | |
| download | vega-c919b5f81ad6cad55935fa7a22bfda9539dd584f.tar.gz vega-c919b5f81ad6cad55935fa7a22bfda9539dd584f.zip | |
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.
Diffstat (limited to 'surfaces/web.c')
| -rw-r--r-- | surfaces/web.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/surfaces/web.c b/surfaces/web.c index 7103c8f..a4759c4 100644 --- a/surfaces/web.c +++ b/surfaces/web.c @@ -418,11 +418,11 @@ int vega_web(PureApp *app, const VegaScreen *screen, const char *listen_on, unsi static Client clients[CLIENTS]; for (unsigned i = 0; i < CLIENTS; ++i) clients[i].fd = -1; VegaTimers timers; - vega_timers_start(&timers, app->module, vega_now()); + vega_timers_start(&timers, app->module, vega_clock()); while (!stopping) { /* Tick what is due; every page hears of it this round, without waiting. */ bool ticked = false; - long due = vega_timers_run(&timers, app, vega_now(), &ticked); + long due = vega_timers_run(&timers, app, vega_clock(), &ticked); struct pollfd fds[CLIENTS + 1]; unsigned slot[CLIENTS + 1], count = 1; fds[0] = (struct pollfd){listener, POLLIN, 0}; @@ -441,7 +441,7 @@ int vega_web(PureApp *app, const VegaScreen *screen, const char *listen_on, unsi if (ready == 0 && screen->ticks) changed = pure_app_frame(app) == PURE_OK; if (reload && reload()) { /* a new module: every page draws it */ changed = true; - vega_timers_start(&timers, app->module, app->now); + vega_timers_start(&timers, app->module, vega_clock()); } if (fds[0].revents & POLLIN) for (int fd; (fd = accept4(listener, NULL, NULL, SOCK_NONBLOCK | SOCK_CLOEXEC)) >= 0;) { |
