-
Notifications
You must be signed in to change notification settings - Fork 0
/
Time.h
30 lines (21 loc) · 933 Bytes
/
Time.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef TIME_H_INCLUDED
#define TIME_H_INCLUDED
extern double time_limit;
/* Resets the timer, and starts it. */
void time_restart(void);
/* Resumes the timer, if it is paused. */
void time_start(void);
/* Pauses the timer, if it is running. */
void time_stop(void);
/* Returns how much time has been used; i.e. for how long the timer was running
since the last reset, not counting the time it was paused.*/
double time_used(void);
/* Returns how much time is left; which is basically time_limit - time_used() */
double time_left(void);
/* Schedules the given callback function to be called after `time' seconds.
Only one alarm can be active at any given time! */
void set_alarm(double time, void(*callback)(void *arg), void *arg);
/* Cancels the current alarm, if any is currently set. Note that the alarm may
still go off before this function returns! */
void clear_alarm(void);
#endif /* ndef TIME_H_INCLUDED */