[squeak-dev] The Inbox: KernelTests-cbc.291.mcz

David T. Lewis lewis at mail.msen.com
Sun Mar 8 00:14:35 UTC 2015


On Fri, Mar 06, 2015 at 09:10:13PM -0800, Chris wrote:
> 
> > On Mar 6, 2015, at 5:00 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> > 
> >> On Fri, Mar 06, 2015 at 11:52:04PM +0000, commits at source.squeak.org wrote:
> >> A new version of KernelTests was added to project The Inbox:
> >> http://source.squeak.org/inbox/KernelTests-cbc.291.mcz
> >> 
> >> ==================== Summary ====================
> >> 
> >> Name: KernelTests-cbc.291
> >> Author: cbc
> >> Time: 6 March 2015, 3:52:01.005 pm
> >> UUID: 54afce93-39e9-4c4a-92a4-ecbe32540c69
> >> Ancestors: KernelTests-ul.290, KernelTests-cbc.278
> >> 
> >> Added DateAndTimeArithmeticTest - to test adding things to DateAndTime instances.  This includes things like: DateAndTime now + 3 days.
> > 
> > This would be a good time to check our tests. In my locale, the springtime
> > daylight savings time change is going to happen this weekend. If I evaluate
> > "DateAndTime now + 3 days" what is the expected result?
>
> It should be three days from now, same hour of the day I think.  That was not part of the tests, though. Something to add. 
> 
> This change is part of a set ( including new kernel and be collection packages ). Adding days though was not changed. 
>

Hi Chris,

My comment was not meant as a criticism of your changes, it is more a
general observation about our murky definitions of time in Squeak.

If "3 days" means a duration of 259200 seconds, and if the time in my
(Detroit) time zone right now is 2015-03-07T18:00:00-05:00 (6:00 pm),
then the DateAndTime that I should see three days from now is
2015-03-10T19:00:00-04:00 (7:00 pm, 259200 seconds from now).

On the other hand, if "3 days" means three calendar days (as I think that
you are expecting it to mean), then the DateAndTime three days from now
would be 2015-03-10T18:00:00-04:00 (still 6:00 pm on the wall clock, but
actually an hour earlier in terms of elapsed time).

These are two different points in time, separated by 3600 seconds of
actual duration.

So conceptually, we need to agree if "3 days" is a duration, or if it is
a count of days on the calendar. The current implementation of "3 days"
in Squeak implies that we mean it to be a duration (259200 seconds). If
that is the case, then thinking of "3 days" as an count of calendar days
is not the same thing at all, and the question "what DateAndTime will it
be be 3 days from now" is ambiguous when a daylight savings transition
is involved.

The daylight savings time transition illustrates the problem nicely, but
IMO the real issue is lack of clear definitions of what we mean by words
like "day" and "month" and "year". In everyday spoken language, it is OK
for those words to have different meanings in different contexts. But
even Squeak is not smart enough to resolve those ambiguities without a
little help from us :)

Dave



More information about the Squeak-dev mailing list