From 355c8ae57d582974f4f6a4ba42f635f2253b84a7 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 6 Nov 2026 14:24:04 +0100 Subject: Add a wall clock helper so that statedumps can be written and re-read --- src/trackerlogic.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/trackerlogic.h') diff --git a/src/trackerlogic.h b/src/trackerlogic.h index d03d3b1..241b6a7 100644 --- a/src/trackerlogic.h +++ b/src/trackerlogic.h @@ -114,6 +114,11 @@ static inline ot_time time_since_minutes(ot_time then) { /* Has a deadline the tracker set on itself gone by? */ static inline int time_is_past(ot_time deadline) { return time_now_seconds() > deadline; } + +/* The wall clock, which the state file uses and nothing else does: it has to + survive a restart, and the clock above counts from boot. */ +static inline ot_time time_wall_minutes(void) { return time(NULL) / 60; } + /* Cleared from the interrupt handler and read by every worker */ extern _Atomic int g_opentracker_running; -- cgit v1.3