[squeak-dev] Testing membership in a Set of Date objects

Tim Johnson digit at sonic.net
Mon Oct 22 21:24:07 UTC 2018

> On Oct 20, 2018, at 12:17 PM, Tim Johnson <digit at sonic.net> wrote:
> By adapting my method:
> timespan
> 	^ Timespan starting: (oldRecord timestamp) ending: (newRecord timestamp)
> (considering the timestamps originate from DateAndTime class>>#now)
> to:
> timespan
> 	^ (Timespan starting: (oldRecord timestamp) ending: (newRecord timestamp))
> 		beCanonical
> all my tests pass.  Great!

Sadly, this turned out to be less of a miracle than I'd originally thought.  

The Timespan class>#starting:ending: constructor retains the DateAndTime object given to #starting: .  So, when I later called #beCanonical on the Timespans I created (from the code above), I was unintentionally changing each of my "oldRecord" (see above) timestamps to be offset: nil.  Whoops.  Now I have thousands of these objects whose oldRecord timestamp is offset = nil and whose newRecord timestamp offset is still -07:00, causing all of my calculations to be off by 7 hours.  

Time to revert to my previously-saved data, and find another solution/adaptation.  :)


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

More information about the Squeak-dev mailing list