]> gitweb.factorcode.org Git - factor.git/commitdiff
remove >duration word and instead make a private >nanoseconds word in alarms
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 22 Nov 2009 00:01:25 +0000 (18:01 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 22 Nov 2009 00:01:25 +0000 (18:01 -0600)
basis/alarms/alarms.factor
basis/calendar/calendar.factor

index 251d82eec8f096704be879493699c5f599cfda64..b006131182bf2a506f32267da8fd8e89150d7344 100755 (executable)
@@ -19,13 +19,15 @@ SYMBOL: alarm-thread
 : notify-alarm-thread ( -- )
     alarm-thread get-global interrupt ;
 
-: normalize-argument ( obj -- nanoseconds )
-    >duration duration>nanoseconds >integer ;
+GENERIC: >nanoseconds ( obj -- duration/f )
+M: f >nanoseconds ;
+M: real >nanoseconds >integer ;
+M: duration >nanoseconds duration>nanoseconds >integer ;
 
 : <alarm> ( quot start interval -- alarm )
     alarm new
-        swap dup [ normalize-argument ] when >>interval
-        swap dup [ normalize-argument nano-count + ] when >>start
+        swap >nanoseconds >>interval
+        swap >nanoseconds nano-count + >>start
         swap >>quot
         <box> >>entry ;
 
index ff55d26cdb26b09d8664ce4addc3e947ed882a48..25cf35c062a57082df6ea1d7e319dbc55f55048f 100644 (file)
@@ -170,11 +170,6 @@ M: timestamp easter ( timestamp -- timestamp )
 : microseconds ( x -- duration ) 1000000 / seconds ;
 : nanoseconds ( x -- duration ) 1000000000 / seconds ;
 
-GENERIC: >duration ( obj -- duration/f )
-M: duration >duration ;
-M: real >duration seconds ;
-M: f >duration ;
-
 GENERIC: year ( obj -- n )
 M: integer year ;
 M: timestamp year year>> ;