<div dir="ltr">Oh, about this part:<div><br></div><div>+ ----- Method: Time class>>totalMicroSeconds (in category 'smalltalk-80') -----<br>+ totalMicroSeconds<br>+       "Answer the total seconds since the Squeak epoch: 1 January 1901, in local time."<br>+<br>+       ^self localMicrosecondClock // 1000000!<br></div><div><br></div><div>I'm not sure whether #totalSeconds (or anyone) should be using #localMicrosecondClock anymore, but I included the above method too, just in case.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 29, 2020 at 6:51 PM <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Chris Muller uploaded a new version of Chronology-Core to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Chronology-Core-cmm.53.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Chronology-Core-cmm.53.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Chronology-Core-cmm.53<br>
Author: cmm<br>
Time: 29 April 2020, 6:51:53.53317 pm<br>
UUID: b930b208-c85e-4c6b-8254-2837493384bd<br>
Ancestors: Chronology-Core-nice.52<br>
<br>
- Extend the API to allow an integral representation of DateAndTime's, by introducing<br>
<br>
        DateAndTime class>>#fromMicroseconds:<br>
        DateAndTime>>#asMicroseconds<br>
<br>
which go along with the existing API:<br>
<br>
        DateAndTime class>>#fromSeconds:<br>
        DateAndTime>>#asSeconds<br>
<br>
- Every Squeak with the substring "utcMicrosecond" in the selector name refers to the number of microseconds since the POSIX epoch (1/1/1971@00:00:00.000), __except for one__:  Time utcMicroseconds.  Therefore, to avoid astonishment when using it with the "utc" API of DateAndTime, rename it without the "utc" prefix.<br>
<br>
=============== Diff against Chronology-Core-nice.52 ===============<br>
<br>
Item was added:<br>
+ ----- Method: DateAndTime class>>fromMicroseconds: (in category 'smalltalk-80') -----<br>
+ fromMicroseconds: anInteger <br>
+       "Answer a DateAndTime anInteger microseconds since the Squeak epoch: 1 January 1901."<br>
+       ^ self<br>
+               utcMicroseconds: anInteger - (self epochOffset * 1000000)<br>
+               offset: self localOffsetSeconds!<br>
<br>
Item was added:<br>
+ ----- Method: DateAndTime>>asMicroseconds (in category 'smalltalk-80') -----<br>
+ asMicroseconds<br>
+       "Return the number of microseconds since the Squeak epoch, 1/1/1901 @ 00:00:00."<br>
+       ^ utcMicroseconds + self class epochOffsetMicros!<br>
<br>
Item was changed:<br>
  ----- Method: Time class>>estimateHighResClockTicksPerMillisecond (in category 'clock') -----<br>
  estimateHighResClockTicksPerMillisecond<br>
<br>
        | t0 t1 t2 t3 |<br>
<br>
        "Count the ticks ellapsed during a 10ms busy loop"<br>
+       t0 := Time microsecondClock + 200.<br>
+       [Time microsecondClock >= t0] whileFalse.<br>
-       t0 := Time utcMicrosecondClock + 200.<br>
-       [Time utcMicrosecondClock >= t0] whileFalse.<br>
        t1 := self highResClock.<br>
+       [Time microsecondClock >= (t0 + 10000)] whileFalse.<br>
+       t1 := self highResClock - t1 * 1000 // (Time microsecondClock - t0).<br>
-       [Time utcMicrosecondClock >= (t0 + 10000)] whileFalse.<br>
-       t1 := self highResClock - t1 * 1000 // (Time utcMicrosecondClock - t0).<br>
<br>
        "Count the ticks ellapsed during a 20ms busy loop"<br>
+       t0 := Time microsecondClock + 200.<br>
+       [Time microsecondClock >= t0] whileFalse.<br>
-       t0 := Time utcMicrosecondClock + 200.<br>
-       [Time utcMicrosecondClock >= t0] whileFalse.<br>
        t2 := self highResClock.<br>
+       [Time microsecondClock >= (t0 + 20000)] whileFalse.<br>
+       t2 := self highResClock - t2 * 1000 // (Time microsecondClock - t0).<br>
-       [Time utcMicrosecondClock >= (t0 + 20000)] whileFalse.<br>
-       t2 := self highResClock - t2 * 1000 // (Time utcMicrosecondClock - t0).<br>
<br>
        "Count the ticks ellapsed during a 30ms busy loop"<br>
+       t0 := Time microsecondClock + 200.<br>
+       [Time microsecondClock >= t0] whileFalse.<br>
-       t0 := Time utcMicrosecondClock + 200.<br>
-       [Time utcMicrosecondClock >= t0] whileFalse.<br>
        t3 := self highResClock.<br>
+       [Time microsecondClock >= (t0 + 30000)] whileFalse.<br>
+       t3 := self highResClock - t3 * 1000 // (Time microsecondClock - t0).<br>
-       [Time utcMicrosecondClock >= (t0 + 30000)] whileFalse.<br>
-       t3 := self highResClock - t3 * 1000 // (Time utcMicrosecondClock - t0).<br>
<br>
        "Take the median of the 3 estimates as the best"<br>
        ^ t1 <= t2<br>
                ifTrue: [t2 <= t3<br>
                                ifTrue: [t2]<br>
                                ifFalse: [t1 <= t3<br>
                                                ifTrue: [t3]<br>
                                                ifFalse: [t1]]]<br>
                ifFalse: [t1 <= t3<br>
                                ifTrue: [t1]<br>
                                ifFalse: [t2 <= t3<br>
                                                ifTrue: [t3]<br>
                                                ifFalse: [t2]]]!<br>
<br>
Item was changed:<br>
  ----- Method: Time class>>localMicrosecondClock (in category 'clock') -----<br>
  localMicrosecondClock<br>
        "Answer the local microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).<br>
         The value is derived from the current UTC wallclock time and the image's current notion of time zone."<br>
+       ^self microsecondClock + (DateAndTime localOffset asSeconds * 1000000)!<br>
-       ^self utcMicrosecondClock + (DateAndTime localOffset asSeconds * 1000000)!<br>
<br>
Item was added:<br>
+ ----- Method: Time class>>microsecondClock (in category 'clock') -----<br>
+ microsecondClock<br>
+       "Answer the UTC microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).<br>
+        The value is derived from the Posix epoch with a constant offset corresponding to elapsed microseconds<br>
+        between the two epochs according to RFC 868."<br>
+       <primitive: 240><br>
+       ^0!<br>
<br>
Item was changed:<br>
  ----- Method: Time class>>microsecondsToRun: (in category 'general inquiries') -----<br>
  microsecondsToRun: timedBlock <br>
        "Answer the number of microseconds timedBlock takes to return its value."<br>
<br>
        | startUsecs |<br>
        (self useHighResClockForTiming and: [self highResClock ~= 0])<br>
                ifTrue: [       ^(self nanosecondsToRunHighRes: timedBlock) + 500 // 1000].<br>
+       startUsecs := self microsecondClock.<br>
-       startUsecs := self utcMicrosecondClock.<br>
        timedBlock value.<br>
+       ^self microsecondClock - startUsecs!<br>
-       ^self utcMicrosecondClock - startUsecs!<br>
<br>
Item was changed:<br>
  ----- Method: Time class>>millisecondClockValue (in category 'general inquiries') -----<br>
  millisecondClockValue<br>
        "Answer the value of the millisecond clock."<br>
<br>
+       ^self microsecondClock // 1000!<br>
-       ^self utcMicrosecondClock // 1000!<br>
<br>
Item was changed:<br>
  ----- Method: Time class>>nanosecondsToRun: (in category 'general inquiries') -----<br>
  nanosecondsToRun: timedBlock<br>
        "Answer the number of nanoseconds timedBlock takes to return its value.<br>
        Use high resolution clock if available and preferred."<br>
<br>
        | startUsecs |<br>
        (self useHighResClockForTiming and: [self highResClock ~= 0])<br>
                ifTrue: [       ^(self nanosecondsToRunHighRes: timedBlock)].<br>
        "Fallback to microseconds clock"<br>
+       startUsecs := self microsecondClock.<br>
-       startUsecs := self utcMicrosecondClock.<br>
        timedBlock value.<br>
+       ^self microsecondClock - startUsecs * 1000!<br>
-       ^self utcMicrosecondClock - startUsecs * 1000!<br>
<br>
Item was added:<br>
+ ----- Method: Time class>>totalMicroSeconds (in category 'smalltalk-80') -----<br>
+ totalMicroSeconds<br>
+       "Answer the total seconds since the Squeak epoch: 1 January 1901, in local time."<br>
+ <br>
+       ^self localMicrosecondClock // 1000000!<br>
<br>
Item was changed:<br>
  ----- Method: Time class>>utcMicrosecondClock (in category 'clock') -----<br>
  utcMicrosecondClock<br>
        "Answer the UTC microseconds since the Smalltalk epoch (January 1st 1901, the start of the 20th century).<br>
         The value is derived from the Posix epoch with a constant offset corresponding to elapsed microseconds<br>
         between the two epochs according to RFC 868."<br>
        <primitive: 240><br>
+ self deprecated: 'Use #microsecondClock'.<br>
        ^0!<br>
<br>
<br>
</blockquote></div>