2023-11-17 06:16:32 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <sys/time.h>
|
2023-11-17 18:36:05 +02:00
|
|
|
|
2023-11-17 06:16:32 +02:00
|
|
|
extern struct timeval start_time;
|
|
|
|
|
|
|
|
|
|
typedef struct Timer {
|
|
|
|
|
float time;
|
|
|
|
|
float duration;
|
|
|
|
|
bool is_running;
|
|
|
|
|
} Timer;
|
|
|
|
|
|
|
|
|
|
double get_time();
|
|
|
|
|
void start_internal_timer();
|
|
|
|
|
bool timer_ended(Timer *timer);
|
|
|
|
|
void timer_start(Timer *timer, float duration);
|
2023-11-21 02:52:15 +02:00
|
|
|
void timer_stop(Timer *timer);
|
2023-11-17 06:16:32 +02:00
|
|
|
void timer_reset(Timer *timer);
|
|
|
|
|
float timer_remaining(Timer *timer);
|
|
|
|
|
float timer_elapsed(Timer *timer);
|