use nanoseconds in the core-foundation run-loop

db4
Doug Coleman 2009-11-19 19:22:36 -06:00
parent 9ce3e9f84f
commit 09e9293866
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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 -- )

View File

@ -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