[squeak-dev] efficient DateAndTime

Chris Muller asqueaker at gmail.com
Wed Apr 29 00:53:05 UTC 2020


I have a bunch of two-element Array log entries, where the first element is
the timestamp, the second is the object being logged.  But these entries
may never be consumed, so I wish to minimize their cost.  So, instead of
storing the timestamps as DateAndTimes, I wanted to keep them as
SmallIntegers.  I thought I could use Time utcMicroseconds, now a
SmallInteger in 64-bit Squeak.

However, when I went to instantiate the DateAndTime lazily from that number
it's said it's year 2089...

        DateAndTime utcMicroseconds: Time utcMicrosecondClock offset: 0
" 2089-04-29T00:49:26.3326+00:00"

I realized this is because a different epoch being used (1901 vs. 1971)
between the two.  This seems inconsistent and confusing, but that's less
important to me at the moment than the efficiency I'm looking for.  Is
there another way?

 - Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200428/e2bc04b2/attachment.html>


More information about the Squeak-dev mailing list