remove >duration word and instead make a private >nanoseconds word in alarms
parent
f6ff09cc72
commit
97288b8a04
|
@ -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 ;
|
||||
|
||||
|
|
|
@ -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>> ;
|
||||
|
|
Loading…
Reference in New Issue