timer/timer.h
Zack Buhman 7a0518c35b serial_forwarder: serial parsing
This removes the dependency on libserialport
2024-06-22 23:45:08 -05:00

27 lines
464 B
C

#pragma once
#include <time.h>
enum timer_status {
TIMER_STOPPED,
TIMER_RUNNING,
};
struct stopwatch_time {
int integer_value;
int integer_digits;
int fraction_value;
int fraction_digits;
};
struct running_counter {
struct timespec start; // CLOCK_MONOTONIC (relative)
struct timespec offset; // CLOCK_MONOTONIC (relative)
};
struct timer_state {
enum timer_status status;
struct running_counter counter;
struct stopwatch_time time;
};