aboutsummaryrefslogtreecommitdiffstats
path: root/src/vega.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-26 17:58:26 +0100
committereunhhu <[email protected]>2026-09-26 17:58:26 +0100
commitb466603358f8fa5a74551a9819fdd54ad124ef0c (patch)
tree6f34265f30455589201222521c1a452274a0601d /src/vega.h
parent15c4616e19d997c64a983e39501289c7d9f50d0a (diff)
downloadvega-b466603358f8fa5a74551a9819fdd54ad124ef0c.tar.gz
vega-b466603358f8fa5a74551a9819fdd54ad124ef0c.zip
Give live surfaces a clock and run timers; add a stopwatch
The terminal and the web page set the time events see to the wall clock and tick an app's timers on time: each round ticks what is due, draws, then waits for input, a frame or the next tick, and a tick is news to every open page at once. Scripts have no clock: time MS sets the time the next events see and tick TIMER ticks, so an app that uses time replays exactly. A module swap reschedules the timers. examples/stopwatch.aup runs on every surface; the checks drive it by script, on a pseudo-terminal by the clock, and on the web page.
Diffstat (limited to 'src/vega.h')
-rw-r--r--src/vega.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vega.h b/src/vega.h
index 47e7e91..f01667b 100644
--- a/src/vega.h
+++ b/src/vega.h
@@ -36,6 +36,16 @@ typedef struct {
} VegaScreen;
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. */
+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);
/* 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;