[squeak-dev] How to have a fast and usable Date? (was: new Bug in Locale)

Chris Muller asqueaker at gmail.com
Thu Feb 2 16:25:27 UTC 2012

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 time.
> 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 zone'.
> 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

More information about the Squeak-dev mailing list