You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
816 B
C

#ifdef __cplusplus
extern "C" {
#endif
#ifndef _TIMER_H
#define _TIMER_H
#include <stdbool.h>
/* This file defines a simple timer Types, and declares functions to initialize it,
and keep track of time elapsed. The actual definition of the Timer struct is in timer.c
It was copied from https://github.com/raysan5/raylib/wiki/Frequently-Asked-Questions#how-do-i-make-a-timer */
typedef struct Timer_s {
double start_time; // Start time (seconds)
double lifetime; // Lifetime (seconds)
} Timer;
/* Starts a timer for given number of seconds */
Timer timer_init(double lifetime_secs);
/* Returns true when timer finishes, false if not */
bool timer_done(Timer timer);
/* Returns amount of time elapsed since start of timer */
double timer_get_elapsed(Timer timer);
#endif
#ifdef __cplusplus
}
#endif