1 #include <ccan/timer/timer.h>
2 /* Include the C files directly. */
3 #include <ccan/timer/timer.c>
4 #include <ccan/tap/tap.h>
6 static struct timeabs timeabs_from_usec(unsigned long long usec)
8 struct timeabs epoch = { { 0, 0 } };
9 return timeabs_add(epoch, time_from_usec(usec));
15 struct timer t, *expired;
17 /* This is how many tests you plan to run */
20 timers_init(&timers, timeabs_from_usec(1364726722653919ULL));
21 timer_add(&timers, &t, timeabs_from_usec(1364726722703919ULL));
22 ok1(!timers_expire(&timers, timeabs_from_usec(1364726722653920ULL)));
23 expired = timers_expire(&timers, timeabs_from_usec(1364726725454187ULL));
25 ok1(!timers_expire(&timers, timeabs_from_usec(1364726725454187ULL)));
26 timers_cleanup(&timers);
28 /* This exits depending on whether all tests passed */