summaryrefslogtreecommitdiffstats
path: root/Lib/stdwin/WindowSched.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-08-01 11:34:53 (GMT)
committerGuido van Rossum <guido@python.org>1994-08-01 11:34:53 (GMT)
commitb6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af (patch)
tree9362939305b2d088b8f19a530c9015d886bc2801 /Lib/stdwin/WindowSched.py
parent2979b01ff88ac4c5b316d9bf98edbaaaffac8e24 (diff)
downloadcpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.zip
cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.gz
cpython-b6775db241f5fe5e3dc2ca09fc6c9e6164d4b2af.tar.bz2
Merge alpha100 branch back to main trunk
Diffstat (limited to 'Lib/stdwin/WindowSched.py')
-rwxr-xr-xLib/stdwin/WindowSched.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/stdwin/WindowSched.py b/Lib/stdwin/WindowSched.py
index 56ca6f8..b2fbe76 100755
--- a/Lib/stdwin/WindowSched.py
+++ b/Lib/stdwin/WindowSched.py
@@ -1,5 +1,5 @@
# Combine a real-time scheduling queue and stdwin event handling.
-# Uses the millisecond timer.
+# Keeps times in milliseconds.
import stdwin, stdwinq
from stdwinevents import WE_TIMER
@@ -19,11 +19,11 @@ def delayfunc(msecs):
mainloop.dispatch(event)
return
#
- # Use millisleep for very short delays or if there are no windows
+ # Use sleep for very short delays or if there are no windows
#
if msecs < 100 or mainloop.countwindows() == 0:
if msecs > 0:
- time.millisleep(msecs)
+ time.sleep(msecs * 0.001)
return
#
# Post a timer event on an arbitrary window and wait for it
@@ -35,7 +35,10 @@ def delayfunc(msecs):
if event[0] <> WE_TIMER:
mainloop.dispatch(event)
-q = sched.scheduler(time.millitimer, delayfunc)
+def millitimer():
+ return int(1000 * time.time())
+
+q = sched.scheduler(millitimer, delayfunc)
# Export functions enter, enterabs and cancel just like a scheduler
#