AbstractOperatingSystem.st
changeset 20127 9268d5186b15
parent 20124 ae0aa60493c9
child 20134 cab81d17f2d9
child 20199 9d0734f75a9e
--- a/AbstractOperatingSystem.st	Fri Jul 08 01:04:22 2016 +0200
+++ b/AbstractOperatingSystem.st	Sat Jul 09 13:31:01 2016 +0200
@@ -6078,7 +6078,7 @@
      that they can deal with timestamps after 2038 (especially: win32 will do so).
      Notice that timestamp is prepared to compensate for any OS limitation by computing the timeInfo
      components itself.
-     So it is usually (except for a little performance) no problem to return a reange too small here."
+     So it is usually (except for a little performance) no problem to return a range too small here."
 
     ^ (SmallInteger maxVal * 2 + 1) * 1000
 !
@@ -6200,7 +6200,7 @@
      timer wraps."
 
 %{  /* NOCONTEXT */
-    RETURN ( __mkSmallInteger(0x0FFFFFFF) );
+    RETURN ( __mkSmallInteger(_MAX_INT >> 2) );
 %}
 !
 
@@ -6235,31 +6235,27 @@
      This should really be moved to some RelativeTime class."
 
     (msTime1 > msTime2) ifTrue:[
-	((msTime1 - msTime2) < 16r10000000) ifTrue:[
-	    ^ true
-	].
+        ^ (msTime1 - msTime2) <= (SmallInteger maxVal // 4).
     ] ifFalse:[
-	((msTime2 - msTime1) > 16r10000000) ifTrue:[
-	    ^ true
-	].
+        ^ (msTime2 - msTime1) > ((SmallInteger maxVal // 4) + 1)
     ].
-    ^ false
 !
 
 millisecondTimeAdd:msTime1 and:msTime2
     "Add two millisecond times (such as returned getMillisecondTime).
-     The returned value is msTime1 + msTime2 where a wrap occurs at:16r1FFFFFFF.
+     The returned value is msTime1 + msTime2 where a wrap occurs 
+     at:16r1FFFFFFF (32-bit systems) or:16r1FFFFFFFFFFFFFFF (64-bit systems).
 
      This should really be moved to some RelativeTime class."
 
     |sum|
 
     sum := msTime1 + msTime2.
-    (sum > 16r1FFFFFFF) ifTrue:[
-	self assert:(sum <= 16r3FFFFFFF) message:'overflow in timer computation'.
-	^ sum - 16r20000000.
+    (sum > (SmallInteger maxVal // 2)) ifTrue:[
+        self assert:(sum <= SmallInteger maxVal) message:'overflow in timer computation'.
+        ^ sum - (SmallInteger maxVal // 2 + 1).
     ].
-    (sum < 0) ifTrue:[^ sum + 16r20000000].
+    (sum < 0) ifTrue:[^ sum + (SmallInteger maxVal // 2 + 1)].
     ^ sum
 !
 
@@ -6276,14 +6272,16 @@
     |diff|
 
     diff := msTime1 - msTime2.
-    diff > 16r-10000000 ifTrue:[
-	(diff < 16r10000000) ifTrue:[
-	    ^ diff.
-	] ifFalse:[
-	    ^ diff - 16r20000000.
-	].
+
+    diff < (SmallInteger maxVal // -4) ifTrue:[
+        ^ diff + (SmallInteger maxVal // 2) + 1.
     ].
-    ^ diff + 16r20000000
+
+    diff <= (SmallInteger maxVal // 4) ifTrue:[
+        ^ diff.
+    ] ifFalse:[
+        ^ diff - (SmallInteger maxVal // 2 + 1).
+    ].
 
 
     "