[BUG] DateAndTime subtraction

Boris Gaertner Boris.Gaertner at gmx.net
Sat Nov 6 21:48:39 UTC 2004


From: "David T. Lewis" <lewis at mail.msen.com>
To: <squeak-dev at lists.squeakfoundation.org>
Sent: Saturday, November 06, 2004 4:21 PM
Subject: [BUG] DateAndTime subtraction


> When the clock on the wall in Detroit says 9:00am, the clock on the wall
> in London says 2:00pm. The Duration difference between the corresponding
> DateAndTime values should be zero. In Squeak, the difference is a Duration
> of ten hours.
>
> This change set documents the bug with a unit test, but does not attempt
> to fix it.
>
> Dave
>

So the time difference is seemingly 5 hours.
Now, compute this:
| thisMoment thisMomentInDetroit |
thisMoment := DateAndTime year: 2004 month: 11 day: 02 hour: 14 minute: 00.
thisMomentInDetroit := thisMoment utcOffset: -5 hours.
 {thisMoment . thisMomentInDetroit}
 #(2004-11-02T14:00:00+00:00 2004-11-02T09:00:00-05:00)

Is it possible that you have a typo in your example?
(05:00 where -05:00 should have been written?)

Anyway, I use this example to explain time arithmetic. It demonstates
the fact that
 2004-05-24T22:40:00  UTC  is
 2004-05-25/01:40:00  in Moscow

| thisMoment thisMomentInMoscow |
thisMoment := DateAndTime year: 2004 month: 5 day: 24 hour: 22 minute: 40.
thisMomentInMoscow := thisMoment utcOffset: 3 hours.
thisMoment - thisMomentInMoscow

  0:00:00:00


Greetings, Boris





More information about the Squeak-dev mailing list