<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Ok, the comments that I remembered where in the Timespan>>defaultOffset that described the behaviour that #= was exhibiting.  That is, it is intentional - wheither right or not, it is intentional, and this comment needs to change when we change #= or #hash.<div><br></div><div><div><span style="white-space:pre-wrap">  </span>"Timespans created in the context of an offset will start in that offset.  When no context is available, the defaultOffset for Timespans must be nil.  For example, two ways to make a Date for today:</div><div><span style="white-space:pre-wrap">    </span>Date today.  'start is midnight without offset.  Will compare successfully to other Date today results.'</div><div><span style="white-space:pre-wrap">       </span>DateAndTime now asDate.  'In this case, the start is midnight of the local time-zone.  It can only compare equally to Dates of its time-zone or Dates without timezone.'"</div></div><div><br></div><div>That last part - "[DateAndTime now asDate] can only compare equally to Date of its time-zone or Dates without timezone."  This change makes the last part of that sentence incorrect.</div><div><br></div><div>Summary of below - I agree with this change after thinking about it for a while.  I do think that the comment above needs to change.</div><div><br></div><div>Having read Richard's email (referenced by David), I would also like a Date to just be a Date, and you can compare any Date to another Date for the same day and they are the same.  At the same time, I would like (and need to know) if a timestamp in one part of the world occurred on a specific date in another part of the world - and with just a Magnitude Date, this is hard (that is, I have to convert the timestamp to the other part of the world, stored somewhere separately from Date but linked to it, and then see if it is still the same Date.  Much easier with Dates the way they are).</div><div><br></div><div>My first inclination to fix this is that any date should compare to any other date if the date part of the start is the same - basically, ignore the offset and just check that the ticks are the same.  (For Dates, we could also ignore the duration - it is a DAY, not a random duration, after all.  But if we did this, we'd have to verify both are Date class - so skip that idea.)</div><div><br></div><div>The problem with this is that two days starting in different parts of the world may not overlap a lot, and if we care about the actual day duration, that would not be nice.</div><div><br></div><div>After validating a few more things:</div><div><div>   Date today start offset "0:00:00:00"</div><div>   '2018-10-07' asDate start offset "0:00:00:00"</div><div>   DateAndTime now asDate start offset "-0:07:00:00"</div><div>   '2018-10-17 00:00:00' asDate start offset "0:00:00:00"</div></div><div>I think that the change is about right.  I'll just have to live with Dates built off of times from different parts of the world are, in fact, different Dates.  If I want a 'Date' that works like the older Smalltalks, I can craft a very similar one by nil'ing out the offset of any Date.</div><div><br></div><div>This is also a better answer than just delegating the time comparison to start (DateAndTime), the offset gets weird in that case.  For example:</div><div><br></div><div>I do find it interesting that Timespan's with not offset, when asked the offset, return an offset that looks like UTC, though.</div><div><div>  DateAndTime now makeUTC asDate = Date today "true"</div><div>  DateAndTime now makeUTC asDate hash = Date today hash "true"</div></div><div><br></div><div>========</div><div>Once this (or an equivalent fix) is in, I'm going to take a shot at fixing DateAndTime>>= - it is doing up to 3 #isKindOf: comparisons (!) in that method.  Crazy.</div><div><br></div><div>Thanks,<br></div><div>-cbc</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 17, 2018 at 6:26 PM Chris Cunningham <<a href="mailto:cunningham.cb@gmail.com" target="_blank">cunningham.cb@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">I'm not so sure. at the very least you will need to change the comment because it specifically states this isn't what should be done. <div dir="auto"><br></div><div dir="auto">when I get back from the water polo game I'll give a better argument (or retract my statement).</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 17, 2018, 17:43 David T. Lewis <<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If I am reading this right, it says that we can test for<br>
"self start = comparand start" if and only if both of the two Timespans<br>
have no timezone information, otherwise we need to use #hasEqualTicks:<br>
to compare the two start values for the two durations.<br>
<br>
I'm not sure if there is an optimization available for the case of the<br>
two Timespans both having timezone information, but aside from that<br>
the change looks right to me.<br>
<br>
Dave<br>
<br>
On Wed, Oct 17, 2018 at 09:04:29PM +0000, <a href="mailto:commits@source.squeak.org" rel="noreferrer" target="_blank">commits@source.squeak.org</a> wrote:<br>
> Chris Muller uploaded a new version of Chronology-Core to project The Inbox:<br>
> <a href="http://source.squeak.org/inbox/Chronology-Core-cmm.13.mcz" rel="noreferrer noreferrer" target="_blank">http://source.squeak.org/inbox/Chronology-Core-cmm.13.mcz</a><br>
> <br>
> ==================== Summary ====================<br>
> <br>
> Name: Chronology-Core-cmm.13<br>
> Author: cmm<br>
> Time: 17 October 2018, 4:04:08.832696 pm<br>
> UUID: 60718249-84a8-4dc2-aa94-4ba5c8e5addc<br>
> Ancestors: Chronology-Core-tcj.12<br>
> <br>
> Fix DateAndTime today asDate = Date today even when not in GMT.<br>
> <br>
> =============== Diff against Chronology-Core-tcj.12 ===============<br>
> <br>
> Item was changed:<br>
>   ----- Method: Timespan>>= (in category 'ansi protocol') -----<br>
>   = comparand<br>
>       ^ self class = comparand class <br>
> +             and: [((self noTimezone and: [comparand noTimezone])<br>
> -             and: [((self noTimezone or: [ comparand noTimezone ])<br>
>                       ifTrue: [ self start hasEqualTicks: comparand start ]<br>
>                       ifFalse: [ self start = comparand start ])<br>
>               and: [ self duration = comparand duration ] ]<br>
>   .!<br>
> <br>
> <br>
<br>
</blockquote></div>
</blockquote></div>