timer/timer.h
2024-06-22 17:51:55 -05:00

23 lines
407 B
C

#include <time.h>
enum counter_status {
COUNTER_STOPPED,
COUNTER_RUNNING,
};
struct stopwatch_time {
int32_t whole;
int32_t fraction;
};
struct running_counter {
struct timespec start; // CLOCK_MONOTONIC (relative)
struct timespec offset; // CLOCK_MONOTONIC (relative)
};
struct timer_state {
enum counter_status status;
struct running_counter counter;
struct stopwatch_time time;
};