Delay.st
changeset 1316 248a8cb2ae3b
parent 1294 e26bbb61f6b2
child 1348 183876a4e085
--- a/Delay.st	Sat Apr 27 19:59:23 1996 +0200
+++ b/Delay.st	Sat Apr 27 20:02:36 1996 +0200
@@ -56,6 +56,7 @@
 
     [see also:]
         Semaphore Process ProcessorScheduler
+        Time AbsoluteTime
         (using delay : programming/timing.html#DELAY)
 
     [author:]
@@ -67,7 +68,7 @@
 "
     Check your systems resolution with:
     (make certain, that no other timed processes are running in the background when doing this)
-
+                                                                        [exBegin]
         |d t1 t2 res|
 
         Processor activeProcess priority:24.
@@ -78,62 +79,68 @@
         res := (OperatingSystem millisecondTimeDeltaBetween:t2 and:t1) // 100.
         Transcript show:'minimum delta is about '; show:res; showCr:' milliseconds'.
         Processor activeProcess priority:8.
+                                                                        [exEnd]
 
 
     examples:
 
-        delaying for some time-delta:
-        (notice: you cannot use this without time-errors in a loop,
-         since the errors will accumulate; after 5 runs through the loop,
-         more than 5 seconds have passed)
+    delaying for some time-delta:
+    (notice: you cannot use this without time-errors in a loop,
+     since the errors will accumulate; after 5 runs through the loop,
+     more than 5 seconds have passed)
 
-                |d|
-                d := Delay forMilliseconds:500.
-                10 timesRepeat:[d wait]
+            |d|
+            d := Delay forMilliseconds:500.
+            10 timesRepeat:[d wait]
 
-        prove:
-                |d t1 t2 deltaT|
-                d := Delay forMilliseconds:500.
-                t1 := Time millisecondClockValue.
-                10 timesRepeat:[
-                    d wait
-                ].
-                t2 := Time millisecondClockValue.
-                deltaT := OperatingSystem millisecondTimeDeltaBetween:t2 and:t1.
-                Transcript show:'average delay: '; show:deltaT // 10; showCr:' milliseconds'
+    prove:
+                                                                    [exBegin]
+            |d t1 t2 deltaT|
+            d := Delay forMilliseconds:500.
+            t1 := Time millisecondClockValue.
+            10 timesRepeat:[
+                d wait
+            ].
+            t2 := Time millisecondClockValue.
+            deltaT := OperatingSystem millisecondTimeDeltaBetween:t2 and:t1.
+            Transcript show:'average delay: '; show:deltaT // 10; showCr:' milliseconds'
+                                                                    [exEnd]
 
-        delaying until a specific time is reached:
-        (this can be used to fix the above problem)
-
-                |now then t1 t2 deltaT|
+    delaying until a specific time is reached:
+    (this can be used to fix the above problem)
+                                                                    [exBegin]
+            |now then t1 t2 deltaT|
 
-                t1 := Time millisecondClockValue.
-                now := Time millisecondClockValue.
-                10 timesRepeat:[
-                    then := OperatingSystem millisecondTimeAdd:now and:1000.
-                    (Delay untilMilliseconds:then) wait.
-                    now := then
-                ].
-                t2 := Time millisecondClockValue.
-                deltaT := OperatingSystem millisecondTimeDeltaBetween:t2 and:t1.
-                Transcript show:'average delay: '; show:deltaT // 10; showCr:' milliseconds'
-
-        instead of recreating new delays, you can also reuse it:
+            t1 := Time millisecondClockValue.
+            now := Time millisecondClockValue.
+            10 timesRepeat:[
+                then := OperatingSystem millisecondTimeAdd:now and:1000.
+                (Delay untilMilliseconds:then) wait.
+                now := then
+            ].
+            t2 := Time millisecondClockValue.
+            deltaT := OperatingSystem millisecondTimeDeltaBetween:t2 and:t1.
+            Transcript show:'average delay: '; show:deltaT // 10; showCr:' milliseconds'
+                                                                    [exEnd]
 
-                |d now then t1 t2 deltaT|
+    instead of recreating new delays all over, 
+    you can also reuse it:
+                                                                    [exBegin]
+            |d now then t1 t2 deltaT|
 
-                t1 := Time millisecondClockValue.
-                now := Time millisecondClockValue.
-                d := Delay new.
-                10 timesRepeat:[
-                    then := OperatingSystem millisecondTimeAdd:now and:1000.
-                    d resumtionTime:then.
-                    d wait.
-                    now := then
-                ].
-                t2 := Time millisecondClockValue.
-                deltaT := OperatingSystem millisecondTimeDeltaBetween:t2 and:t1.
-                Transcript show:'average delay: '; show:deltaT // 10; showCr:' milliseconds'
+            t1 := Time millisecondClockValue.
+            now := Time millisecondClockValue.
+            d := Delay new.
+            10 timesRepeat:[
+                then := OperatingSystem millisecondTimeAdd:now and:1000.
+                d resumtionTime:then.
+                d wait.
+                now := then
+            ].
+            t2 := Time millisecondClockValue.
+            deltaT := OperatingSystem millisecondTimeDeltaBetween:t2 and:t1.
+            Transcript show:'average delay: '; show:deltaT // 10; showCr:' milliseconds'
+                                                                    [exEnd]
 "
 ! !
 
@@ -261,5 +268,5 @@
 !Delay class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Delay.st,v 1.20 1996-04-25 16:54:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Delay.st,v 1.21 1996-04-27 18:02:28 cg Exp $'
 ! !