X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftimer%2Ftest%2Frun-ff.c;h=0f398d55721075aa21182994c05edbb812245bab;hb=daf9ee7d8e2b683ff05283beb1843611ad8c9e8a;hp=c40e3b104d92744587af0ae74a6db9125933ab67;hpb=c92b496623f29cfb3ac1ade8e52ffbfa95ab5bcf;p=ccan diff --git a/ccan/timer/test/run-ff.c b/ccan/timer/test/run-ff.c index c40e3b10..0f398d55 100644 --- a/ccan/timer/test/run-ff.c +++ b/ccan/timer/test/run-ff.c @@ -3,6 +3,12 @@ #include #include +static struct timeabs timeabs_from_usec(unsigned long long usec) +{ + struct timeabs epoch = { { 0, 0 } }; + return timeabs_add(epoch, time_from_usec(usec)); +} + int main(void) { struct timers timers; @@ -12,11 +18,11 @@ int main(void) /* This is how many tests you plan to run */ plan_tests(3); - timers_init(&timers, time_from_usec(1364726722653919ULL)); - timer_add(&timers, &t, time_from_usec(1364726722703919ULL)); - timers_expire(&timers, time_from_usec(1364726722653920ULL), &expired); + timers_init(&timers, timeabs_from_usec(1364726722653919ULL)); + timer_add(&timers, &t, timeabs_from_usec(1364726722703919ULL)); + timers_expire(&timers, timeabs_from_usec(1364726722653920ULL), &expired); ok1(list_empty(&expired)); - timers_expire(&timers, time_from_usec(1364726725454187ULL), &expired); + timers_expire(&timers, timeabs_from_usec(1364726725454187ULL), &expired); ok1(!list_empty(&expired)); ok1(list_top(&expired, struct timer, list) == &t);