diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/clocks.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/clocks.c b/src/clocks.c index fcb94e5..74c2fb4 100644 --- a/src/clocks.c +++ b/src/clocks.c | |||
@@ -3,6 +3,8 @@ | |||
3 | #include <sys/time.h> | 3 | #include <sys/time.h> |
4 | #include <time.h> | 4 | #include <time.h> |
5 | 5 | ||
6 | #include "litmus.h" | ||
7 | |||
6 | /* CPU time consumed so far in seconds */ | 8 | /* CPU time consumed so far in seconds */ |
7 | double cputime(void) | 9 | double cputime(void) |
8 | { | 10 | { |
@@ -21,3 +23,12 @@ double wctime(void) | |||
21 | gettimeofday(&tv, NULL); | 23 | gettimeofday(&tv, NULL); |
22 | return (tv.tv_sec + 1E-6 * tv.tv_usec); | 24 | return (tv.tv_sec + 1E-6 * tv.tv_usec); |
23 | } | 25 | } |
26 | |||
27 | int lt_sleep(lt_t timeout) | ||
28 | { | ||
29 | struct timespec delay; | ||
30 | |||
31 | delay.tv_sec = timeout / 1000000000L; | ||
32 | delay.tv_nsec = timeout % 1000000000L; | ||
33 | return nanosleep(&delay, NULL); | ||
34 | } | ||