Files
cudoku/timer.h
T

30 lines
599 B
C
Raw Normal View History

#pragma once
#include <stdbool.h>
#include <stdio.h>
#include <sys/time.h>
2023-11-30 00:44:00 +02:00
typedef enum TimerState {
TIMER_RUNNING,
TIMER_PAUSED,
TIMER_STOPPED,
} TimerState;
typedef struct Timer {
2023-11-30 00:44:00 +02:00
float start;
float elapsed;
float duration;
2023-11-30 00:44:00 +02:00
TimerState state;
} Timer;
double get_time();
void start_internal_timer();
bool timer_ended(Timer *timer);
void timer_start(Timer *timer, float duration);
void timer_stop(Timer *timer);
void timer_reset(Timer *timer);
float timer_remaining(Timer *timer);
float timer_elapsed(Timer *timer);
2023-11-30 00:44:00 +02:00
void timer_pause(Timer *timer);
void timer_resume(Timer *timer);