]> git.ozlabs.org Git - ccan/blobdiff - ccan/timer/timer.h
timer: cache the minimal value.
[ccan] / ccan / timer / timer.h
index 7b5d199470c49e829aa19c0363eaa715c6324fee..3bf28d0fbda2cdd8f4e3396bc19928d2b1ac7960 100644 (file)
@@ -61,7 +61,7 @@ void timer_del(struct timers *timers, struct timer *timer);
  * timers.  Otherwise, it sets @first to the expiry time of the first
  * timer (rounded to TIMER_GRANULARITY nanoseconds), and returns true.
  */
-bool timer_earliest(const struct timers *timers, struct timespec *first);
+bool timer_earliest(struct timers *timers, struct timespec *first);
 
 /**
  * timer_expire - update timers structure and remove expired timers.
@@ -123,6 +123,7 @@ struct timers {
        /* Far in the future. */
        struct list_head far;
        uint64_t base;
+       uint64_t first;
 
        struct timer_level *level[(64 + TIMER_LEVEL_BITS-1) / TIMER_LEVEL_BITS];
 };