X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftime%2Ftest%2Frun-monotonic.c;fp=ccan%2Ftime%2Ftest%2Frun-monotonic.c;h=ed70f3dbb5bddc19e15ed460c250f43fac236456;hb=95ff2139520130dd98a0503e3c4f441c69a68f5a;hp=0000000000000000000000000000000000000000;hpb=daf9ee7d8e2b683ff05283beb1843611ad8c9e8a;p=ccan diff --git a/ccan/time/test/run-monotonic.c b/ccan/time/test/run-monotonic.c new file mode 100644 index 00000000..ed70f3db --- /dev/null +++ b/ccan/time/test/run-monotonic.c @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(void) +{ + struct timemono t1, t2; + struct timerel t3; + + plan_tests(2); + + /* Test time_mono */ + t1 = time_mono(); + t2 = time_mono(); + + ok1(!time_less_(t2.ts, t1.ts)); + + t3.ts.tv_sec = 1; + t3.ts.tv_nsec = 0; + + ok1(time_less(timemono_between(t1, t2), t3)); + + return exit_status(); +}