[squeak-dev] [BUG?] TimeStamp now date = Date today. "-> false"

Chris Muller asqueaker at gmail.com
Fri Aug 9 22:28:48 UTC 2013


Thank you, Dave, very much for reminding us about the discussion from
18 months ago.  The rationale for the way it is was very heavily
analyzed and discussed.


On Fri, Aug 9, 2013 at 7:57 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> On 2013-08-09, at 14:18, "David T. Lewis" <lewis at mail.msen.com> wrote:
>
>> On Fri, Aug 09, 2013 at 01:59:03PM +0200, Bert Freudenberg wrote:
>>>
>>> On 2013-08-09, at 09:56, Marcel Taeumel <marcel.taeumel at student.hpi.uni-potsdam.de> wrote:
>>>
>>>> What is it with those timezone offsets? Should this evaluate to true:
>>>>
>>>> "TimeStamp now date = Date today" ?
>>>
>>>
>>> It should indeed. Apparently there are two bugs here: Date today not using the local time zone, and Dates not ignoring the time zone when comparing.
>>>
>>
>> This may be related to the changes that we introduced in Kernel-cmm.669
>> through Kernel-cmm.671. This was in February 2012, and there was discussion
>> of it on the list at that time. From the update comments:
>>
>> Name: Kernel-cmm.669
>>
>> Introduced Timespan class>>defaultOffset.  This is the offset that will
>> be used for creation of all Timespans when an offset is not specified.
>> When an offset is specified or involved in construction or calculation,
>> the result is now produced in terms of the source offset.
>>
>> For example, Date today now produces a globalized date by default.
>> However, "Date starting: (DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours)"
>> produces a Date whose start is expressed in terms of UTC+2.
>>
>> The default defaultOffset is Duration zero so that Squeak will have fast,
>> globalized Dates out of the box.  Globalized Dates are common for applications.
>> Legacy localized Dates can be obtained by evaluating "Date localize" so
>> that, when an offset is not specified or otherwise involved in the input,
>> the local offset will be used.
>>
>> Name: Kernel-cmm.671
>>
>> Decided against the localized vs. globalized mode.  Timespans created in
>> the context of an offset will start in that offset.  When no context is
>> available, the defaultOffset for Timespans must be zero.  For example,
>> two ways to make a Date for today:
>>
>> Date today.  'start is midnight at offset zero.  Will compare successfully
>> to other Date today results.'
>>
>> DateAndTime now asDate.  'In this case, the start is midnight of the local
>> time-zone.  It can only compare equally to Dates of its time-zone.'
>
>
>
> Maybe the source of the confusion is a missing class Day? Both Day and Date seem rolled into one, so Date is now a Timespan subclass when it really should not depend on time ...
>
> - Bert -
>
>
>


More information about the Squeak-dev mailing list