[squeak-dev] How to have a fast and usable Date? (was: new Bug in
jon at huv.com
Thu Feb 2 16:54:57 UTC 2012
I agree Chris. If I'm interested in anything time-related for a given date,
I'll use DateAndTime or TimeStamp or whatever. Date objects should care
about year and month and day, and nothing more.
Incidentally, the place I'm using Dates that is screwing me up so badly is
as the key to a Dictionary, so of course the TZ offset makes it so the key
lookup fails when you change TZ's.
On Thu, Feb 2, 2012 at 11:25 AM, Chris Muller <asqueaker at gmail.com> wrote:
> On Thu, Feb 2, 2012 at 2:30 AM, Nicolas Cellier
> <nicolas.cellier.aka.nice at gmail.com> wrote:
> > I'm now inspecting implementation, and indeed, Date is an interval
> > taking start time into account.
> > So you can still compare the Date printString... (quite slow).
> Not good enough, because having TZ-specific dates in any system of
> consequence is a scourge of molasses.
> Best to strip all Dates (NOT DateAndTimes) of their timezone.
> > I read that makeUTC is like asUTC but it's not.
> > The former just erase the offset, the later does remove the offset from
> > t := DateAndTime year: 2012 month: 2 day: 1 hour: 9 minute: 8 second:
> > 23 offset: 2 hours.
> > self deny: t asUTC = t copy makeUTC
> makeUTC was intended solely to purge the molasses for apps that are
> not interested in TZ's.
> > Since midnight is used in Date creation, I now have the answer how
> > germane it is to compare the dates of two DateAndTime.
> > d1 := DateAndTime starting: (DateAndTime year: 2012 month: 2 day: 1
> > hour: 15 minute: 0 second: 0 offset: 8 hours).
> > d2 := DateAndTime starting: (DateAndTime year: 2012 month: 2 day: 1
> > hour: 20 minute: 0 second: 0 offset: 0 hours).
> > self guess: d1 asDate = d2 asDate answer: 'it depends on your local time
> > Well, why not, but good luck to write the SUnitTests, you have to
> > modify a global (time zone) to make them work reliably ;)
> We've made something wrong and we've made it slow in the process.
> Apps that care about timezones will use DateAndTimes. Apps that don't
> shouldn't be punished.
> I propose Date's, by default, be created with the UTC offset, NOT the
> local offset.
> - Chris
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev