timer: change to use time_mono (api break!)
[ccan] / ccan / timer / test / run-add.c
index 79f029a9dd7b85d1685f1c5a77211184574c20a3..9ad44b7e347608f9040310a40292271669b76a80 100644 (file)
@@ -20,24 +20,25 @@ int main(void)
        struct timer t;
        uint64_t diff;
        unsigned int i;
+       struct timemono epoch = { { 0, 0 } };
 
        /* This is how many tests you plan to run */
        plan_tests(2 + (18 + (MAX_ORD - 4) * 3) * (18 + (MAX_ORD - 4) * 3));
 
-       timers_init(&timers, time_from_nsec(0));
+       timers_init(&timers, epoch);
        ok1(timers_check(&timers, NULL));
 
        for (i = 0; i < 4; i++)
                add_level(&timers, i);
 
        i = 0;
+       timer_init(&t);
        for (diff = 0; diff < (1ULL << MAX_ORD)+2; diff = next(diff)) {
                i++;
                for (timers.base = 0;
                     timers.base < (1ULL << MAX_ORD)+2;
                     timers.base = next(timers.base)) {
-                       t.time = timers.base + diff;
-                       timer_add_raw(&timers, &t);
+                       timer_addmono(&timers, &t, grains_to_time(timers.base + diff));
                        ok1(timers_check(&timers, NULL));
                        timer_del(&timers, &t);
                }