diff options
Diffstat (limited to 'tests/time/src.c')
-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. |