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