use nanoseconds in the core-foundation run-loop
parent
9ce3e9f84f
commit
09e9293866
|
@ -397,6 +397,9 @@ M: duration time-
|
|||
: hence ( duration -- timestamp ) now swap time+ ;
|
||||
: ago ( duration -- timestamp ) now swap time- ;
|
||||
|
||||
: nano-count>timestamp ( x -- timestamp )
|
||||
nano-count - nanoseconds now time+ ;
|
||||
|
||||
: zeller-congruence ( year month day -- n )
|
||||
#! Zeller Congruence
|
||||
#! http://web.textfiles.com/computers/formulas.txt
|
||||
|
|
|
@ -101,7 +101,7 @@ TUPLE: run-loop fds sources timers ;
|
|||
{ [ dup 0 = ] [ now ((reset-timer)) ] }
|
||||
{ [ run-queue deque-empty? not ] [ 1 - (reset-timer) ] }
|
||||
{ [ sleep-queue heap-empty? ] [ 5 minutes hence ((reset-timer)) ] }
|
||||
[ sleep-queue heap-peek nip micros>timestamp ((reset-timer)) ]
|
||||
[ sleep-queue heap-peek nip nano-count>timestamp ((reset-timer)) ]
|
||||
} cond ;
|
||||
|
||||
: reset-timer ( timer -- )
|
||||
|
|
|
@ -156,7 +156,7 @@ SYMBOL: hand-click#
|
|||
SYMBOL: hand-last-button
|
||||
SYMBOL: hand-last-time
|
||||
0 hand-last-button set-global
|
||||
nano-count hand-last-time set-global
|
||||
0 hand-last-time set-global
|
||||
|
||||
SYMBOL: hand-buttons
|
||||
V{ } clone hand-buttons set-global
|
||||
|
|
Loading…
Reference in New Issue