#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Sat, 30 Dec 2017 23:36:45 +0100
changeset 22400 ef3fe12cb204
parent 22399 cb8919387ef4
child 22401 6d41c49ab4c5
#FEATURE by cg class: ProcessorScheduler changed: #addTimedBlock:after:
ProcessorScheduler.st
--- a/ProcessorScheduler.st	Sat Dec 30 15:04:00 2017 +0100
+++ b/ProcessorScheduler.st	Sat Dec 30 23:36:45 2017 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
               All Rights Reserved
@@ -2897,7 +2899,7 @@
 
 !ProcessorScheduler methodsFor:'timeout handling'!
 
-addTimedBlock:aBlock after:timeDuration
+addTimedBlock:aBlock after:timeDurationOrSeconds
     "add the argument, aBlock to the list of time-scheduled-blocks; to be
      evaluated after timeDuration. The process which installs this timed
      block will be interrupted for execution of the block.
@@ -2907,7 +2909,12 @@
      (i.e. it will trigger only once).
      Returns an ID, which can be used in #removeTimeoutWithID:"
 
-    ^ self addTimedBlock:aBlock for:activeProcess afterMilliseconds:timeDuration getMilliseconds
+    |millis|
+
+    millis := timeDurationOrSeconds isNumber 
+                ifTrue:[ timeDurationOrSeconds * 1000 ]
+                ifFalse:[ timeDurationOrSeconds getMilliseconds ].
+    ^ self addTimedBlock:aBlock for:activeProcess afterMilliseconds:millis
 
     "Modified (comment): / 20-07-2017 / 16:43:12 / cg"
 !