gravity working through manager
[physics.git] / src / ticks.cpp
1 #include "ticks.h"
2
3 #include <sys/time.h>
4
5 /* this file is specific to a UNIX system */
6
7 /// ***** Public Methods *****
8
9 // returns the current microseconds from unix time
10 long 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
19 long int tickCountMilli()
20 {
21   return tickCountMicro() / 1000;
22 }
23
24 // returns the current seconds from unix time
25 long int tickCountSec()
26 {
27   return tickCountMicro() / 1000000;
28 }