<div dir="ltr">Hi Chris,<div><br><div class="gmail_quote"><div dir="ltr">On Fri, Oct 26, 2018 at 8:27 PM Chris Muller <<a href="mailto:ma.chris.m@gmail.com">ma.chris.m@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> What's your feeling overall regarding UTCDateAndTime? Does it seem like<br>
> a worthwhile change from your point of view? And to my main worry, is<br>
<br>
I would expect the storage and performance advantage of UTCDateAndTime<br>
to be muted in 32-bit Squeak.  Chronology breaking down the "point" of<br>
a point-in-time into 3 SmallIntegers -- days, seconds, nanos   (days<br>
a.k.a., 'jdn') means there's always just three object pointers for<br>
that.  50-bits for #utcMicroseconds in a 32-bit image, however, may be<br>
nearly as expensive.<br>
<br>
But since SmallIntegers run well beyond 50-bits in 64-bit Squeak, I<br>
would expect a slight performance and storage advantage.<br>
<br>
There's also the claimed understandability advantage, which is<br>
something, but somewhat offset by the conversion / compatibility<br>
issues users must face and endure.  "Worthwhile" is definitely the key<br>
question we need to decide.  For me, it seems worth it in theory<br>
because it seems like it shouldn't be too hard to convert.  The only<br>
way to find out is to attempt to convert one of my most date-intensive<br>
applications (including database) see how it goes, see what issues<br>
arise.<br></blockquote><div><br></div><div>The simplicity of the large integer utcMicroseconds representation trumps all the nonsense of breaking it down into sub components.  In any case the 32-bit VM is communicating time up to the image as 64-bit large integer microseconds anyway.  Not decomposing gives much faster instantiation, and very simple arithmetic (simply compare the utcMicroseconds).</div><div><br></div><div>Note that it would be trivial to extend the representation with the decomposed elements, an d these could be nil initially and instantiated on demand.  Forcing the large integer arithmetic to decompose on every instantiation would kill any performance advantage one might expect to get from using immediate instead of there large integer.  And of course in 64-bits, utcMicroseconds is an immediate anyway.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
> there anything about the different layout of instance variables that is<br>
> likely to cause problems for Magma, or for applications that use other<br>
> databases for persistence? I think that it will be OK, but it's better<br>
> to ask now than to be sorry later.<br>
<br>
There is the layout, there is also the hash calculation.  Could you<br>
make it the same as in Chronology?  It could ease migration, but we<br>
want it to remain fast.<br>
<br>
We need to think about how different migrations could and should work.<br>
Bulk conversions?  Lazy migrations?  We may need some way for apps to<br>
be able to (quickly) ask if they're running the new UTCDateAndTime or<br>
the old Chronology, to help support those...<br>
<br>
  - Chris<br>
<br>
<br>
 - Chris<br>
<br>
> Thanks,<br>
> Dave<br>
><br>
><br>
> ><br>
> >  - Chris<br>
> > On Mon, Oct 22, 2018 at 10:22 PM David T. Lewis <<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>> wrote:<br>
> > ><br>
> > > On Mon, Oct 22, 2018 at 09:02:57PM -0400, David T. Lewis wrote:<br>
> > > > Hi Chris,<br>
> > > ><br>
> > > > On Mon, Oct 22, 2018 at 04:30:52PM -0500, Chris Muller wrote:<br>
> > > > > Hi Dave,<br>
> > > > ><br>
> > > > > Thanks for making UTCDateAndTime available on SqueakMap that "just<br>
> > > > > works" -- not having to go research how to properly install it left me<br>
> > > > > some time to actually start looking at it today.<br>
> > > > ><br>
> > > > > A cursory look reveals that, at least functionally, everything appears<br>
> > > > > to be essentially the same as original Chronology except the on-going<br>
> > > > > million-dollar question:<br>
> > > > ><br>
> > > > >              What are the point-in-time endpoints of a timespan<br>
> > > > > identified by a particular "Date"?<br>
> > > > >              There are two reasonable answers to this question:<br>
> > > > ><br>
> > > > >                  1) "local" e.g., a period that begins from 12am to<br>
> > > > > 11:59:59.999999 of my LOCAL time,<br>
> > > > >              or 2) "global" e.g., a period that begins from 12am to<br>
> > > > > 11:59:59.999999 of UTC (offset 0).<br>
> > > > ><br>
> > > > > We already know that original Chronlology supports ability for<br>
> > > > > applications to represent their Dates either way.  What about<br>
> > > > > UTCDateAndTime?   When I do:<br>
> > > > ><br>
> > > > >         DateAndTime now asDate = Date today<br>
> > > > ><br>
> > > > > I get "true", even though MY 22-Oct-2018 begins and ends at a<br>
> > > > > different point-in-time than those in the UTC timezone..<br>
> > > > ><br>
> > > > > I realize most applications want a canonical representation of Dates,<br>
> > > > > but where does this leave the timespan use-cases?  Are they even<br>
> > > > > possible at all?   What if I truly need the same local representation<br>
> > > > > of  22-Oct-2018 that everyone else recognizes in my local area?<br>
> > > > ><br>
> > > ><br>
> > > > I think the difference is when we get to Date class>>starting: which<br>
> > > > sets the starting point to be aDateAndTime midnight.<br>
> > > ><br>
> > > > In classic Chronology:<br>
> > > >   DateAndTime now asDate start ==> 2018-10-22T00:00:00-04:00<br>
> > > ><br>
> > > > In UTCDateAndTime Chronology:<br>
> > > >   DateAndTime now asDate start ==> 2018-10-22T00:00:00+00:00<br>
> > > ><br>
> > > > So I think you are right. Given that a date is modeled as a duration, the<br>
> > > > start time of the date should align with the timezone of the DateAndTime<br>
> > > > from which it was created.<br>
> > > ><br>
> > > > The likely fix is to change DateAndTime>>midnight:<br>
> > > ><br>
> > > >   DateAndTime>>midnight<br>
> > > >       "Answer a DateAndTime starting at midnight of the same timezone offset as the receiver."<br>
> > > >       ^ self class basicNew<br>
> > > >               setJdn: self julianDayNumber<br>
> > > >               seconds: 0<br>
> > > >               nano: 0<br>
> > > >               offset: (Duration seconds: localOffsetSeconds)<br>
> > > ><br>
> > > > But fixing that triggers one other test failure so I need to sort that<br>
> > > > out before posting anything.<br>
> > > ><br>
> > > > Thanks for looking at this, much appreciated.<br>
> > > ><br>
> > ><br>
> > > I added a test to cover this case in Chronology-Tests in trunk, and a<br>
> > > fix in the UTCDateAndTime repository in Chronology-Core-dtl.30.<br>
> > ><br>
> > > Dave<br>
> > ><br>
> > ><br>
> ><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div>