added 3dengfx into the repo, probably not the correct version for this
[summerhack] / src / 3dengfx / src / common / timer.h
1 /*
2 Copyright 2004 John Tsiombikas <nuclear@siggraph.org>
3
4 This is a cross-platform millisecond resolution timer library.
5
6 This library is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #ifndef _TIMER_H_
22 #define _TIMER_H_
23
24 enum timer_state {TSTATE_RUNNING, TSTATE_PAUSED, TSTATE_RESET};
25
26 typedef struct ntimer {
27         long stop, start, stopped_interval;
28         long offset;
29         enum timer_state state;
30 } ntimer;
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif  /* __cplusplus */
35
36 void timer_start(ntimer *timer);
37 void timer_stop(ntimer *timer);
38 void timer_reset(ntimer *timer);
39
40 void timer_fwd(ntimer *timer, unsigned long msec);
41 void timer_back(ntimer *timer, unsigned long msec);
42
43 unsigned long timer_getmsec(ntimer *timer);
44 unsigned long timer_getsec(ntimer *timer); 
45
46 #ifdef __cplusplus
47 }
48 #endif  /* __cplusplus */
49
50 #endif  /* _TIMER_H_ */