 M: real >nanoseconds >integer ;
 M: duration >nanoseconds duration>nanoseconds >integer ;
 
-: set-next-timer-time ( timer -- timer )
+TYPED: set-next-timer-time ( timer: timer -- timer )
     ! start + delay + ceiling((now - (start + delay)) / interval) * interval
-    nano-count 
+    nano-count
     over start-nanos>> -
     over delay-nanos>> [ - ] when*
     over interval-nanos>> / ceiling

<PRIVATE

: (start-timer) ( quot start-duration interval-duration -- timer )
    <timer> [ start-timer ] keep ;

PRIVATE>


! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs calendar combinators.short-circuit fry
heaps init kernel math math.functions math.parser namespaces
quotations sequences system threads typed ;
IN: timers

TUPLE: timer
