diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-05-23 12:11:30 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-05-23 12:11:30 -0700 |
commit | 780fee9f3e1f3d6e461be33bd452ed8ecb1d497c (patch) | |
tree | 3aa72ccb36cef8f81431c13f373d8b8353e7a7bb /tests | |
parent | 48b7d2a76594a0136444cc666c2532c6bec70e0b (diff) |
actually implement clock_gettime()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/time/src.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/time/src.c b/tests/time/src.c index d33885fe..61faedfe 100644 --- a/tests/time/src.c +++ b/tests/time/src.c @@ -2,6 +2,8 @@ #include <stdlib.h> #include <time.h> #include <string.h> +#include <assert.h> +#include <math.h> int main() { time_t xmas2002 = 1040786563ll; @@ -64,6 +66,9 @@ int main() { // Verify time() returns reasonable value (between 2011 and 2030). time_t t4 = 0; time(&t4); + timespec ts; + assert(clock_gettime(0, &ts) == 0); + assert(abs(ts.tv_sec - t4) <= 2); printf("time: %d\n", t4 > 1309635200ll && t4 < 1893362400ll); // Verify difftime() calculates accurate time difference. |