From 1961b4b237083f4cfac9ca6b249c1d6cb665d149 Mon Sep 17 00:00:00 2001 From: Paul Oliver Date: Tue, 14 Jul 2026 17:29:02 +0200 Subject: Initial (refactor) --- core/timer.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core/timer.h (limited to 'core/timer.h') diff --git a/core/timer.h b/core/timer.h new file mode 100644 index 0000000..3d0a82f --- /dev/null +++ b/core/timer.h @@ -0,0 +1,23 @@ +// file : core/timer.h +// project : Salis-VM +// author : Paul Oliver +// +// Utilities to help measure time intervals and simulation speed. + +#pragma once + +struct Timer { + struct timespec time_start; + float time_delta; +}; + +struct TimerSPS { + struct Timer timer; + uint64_t step_start; + float steps_per_sec; +}; + +void timer_reset(struct Timer *timer); +void timer_measure(struct Timer *timer); +void timer_sps_reset(struct TimerSPS *timer_sps); +void timer_sps_measure(struct TimerSPS *timer_sps); -- cgit v1.2.1