summaryrefslogtreecommitdiff
path: root/ccan/time/test/run-monotonic.c
blob: ed70f3dbb5bddc19e15ed460c250f43fac236456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <ccan/time/time.h>
#include <ccan/time/time.c>
#include <ccan/tap/tap.h>

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();
}