gravity working through manager
[physics.git] / src / ticks.cpp
CommitLineData
ad9f1fb6
PG
1#include "ticks.h"
2
33b8c69b
PG
3#include <sys/time.h>
4
ad9f1fb6
PG
5/* this file is specific to a UNIX system */
6
7/// ***** Public Methods *****
8
9// returns the current microseconds from unix time
10long int tickCountMicro()
11{
12 struct timeval tv;
13 gettimeofday(&tv, 0);
14
15 return (long int)tv.tv_sec * 1000000 + tv.tv_usec;
16}
17
18// returns the current milliseconds from unix time
19long int tickCountMilli()
20{
21 return tickCountMicro() / 1000;
22}
23
24// returns the current seconds from unix time
25long int tickCountSec()
26{
27 return tickCountMicro() / 1000000;
28}