Timestamp.st
changeset 22940 92a205803803
parent 22926 663fa103b1e9
child 22946 80d58e6fcf9f
--- a/Timestamp.st	Tue May 15 18:16:11 2018 +0200
+++ b/Timestamp.st	Tue May 15 18:26:47 2018 +0200
@@ -2597,6 +2597,25 @@
     "Created: / 08-01-2011 / 16:20:55 / cg"
 !
 
+microsecondDeltaFrom:aTimestamp
+    "return the delta in microseconds between 2 absolute times.
+     The argument is supposed to be BEFORE the receiver,
+        computes self - aTimestamp"
+
+    ^ self getMicroseconds - (aTimestamp getMicroseconds)
+
+    "
+     |t1 t2|
+
+     t1 := Timestamp now.
+     Delay waitForSeconds:0.5.
+     t2 := Timestamp now.
+     t2 microsecondDeltaFrom:t1
+    "
+
+    "Modified: / 10-07-2010 / 09:37:18 / cg"
+!
+
 millisecondDeltaFrom:aTimestamp
     "return the delta in milliseconds between 2 absolute times.
      The argument is supposed to be BEFORE the receiver,
@@ -3532,6 +3551,20 @@
     "
 !
 
+getMicroseconds
+    "strictly private: return the truncated microseconds (since the epoch) in utc"
+
+    |millisAsMicros|
+
+    millisAsMicros := osTime * 1000.
+    additionalPicoseconds notNil ifTrue:[
+        ^ millisAsMicros + (additionalPicoseconds // (1000 * 1000)).   
+    ].
+    ^ millisAsMicros
+
+    "Created: 1.7.1996 / 14:33:56 / cg"
+!
+
 getMilliseconds
     "strictly private: return the truncated milliseconds (since the epoch) in utc"