]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 22 Nov 2009 00:16:23 +0000 (18:16 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 22 Nov 2009 00:16:23 +0000 (18:16 -0600)
basis/alarms/alarms.factor
basis/calendar/calendar.factor

index 251d82eec8f096704be879493699c5f599cfda64..b006131182bf2a506f32267da8fd8e89150d7344 100644 (file)
@@ -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 fd51feeed97e8e4fc64fe87196c54210c42ee25b..25cf35c062a57082df6ea1d7e319dbc55f55048f 100644 (file)
@@ -143,8 +143,7 @@ GENERIC: easter ( obj -- obj' )
     32 2 e * + 2 i * + h - k - 7 mod :> l
     a 11 h * + 22 l * + 451 /i :> m
 
-    h l + 7 m * - 114 + 31 /mod 1 + :> ( month day )
-    month day ;
+    h l + 7 m * - 114 + 31 /mod 1 + ;
 
 M: integer easter ( year -- timestamp )
     dup easter-month-day <date> ;
@@ -171,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>> ;