[Glass] TimeZone

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Tue Jun 30 15:40:53 PDT 2015


Another tidbit that I learned while investigating this is that when 
creating a month, the timeZone of the image is used unconditionally 
(true in both GemStone and Pharo). So the following can happen (on my 
machine):

   start := DateAndTime fromString: '2015-04-01T00:00:00+01:00'.
   month := Month starting: start.
   month start.

     ==>   2015-04-01T00:00:00-07:00

It's also true (and a bit less surprising) if you use a Date to create 
the month:

   (Month starting: (Date fromString: '04.01.2015')) start

     ==>  2015-04-01T00:00:00-07:00

Dale

On 06/30/2015 01:57 PM, Dale Henrichs wrote:
>
> On 06/29/2015 06:09 AM, Trussardi Dario Romano via Glass wrote:
>>
>>
>> After update the TimeZone as upper, the problematic reported into my 
>> email: Re: [Glass] Timespan Month  questions
>>
>> remain open.
>>
>>
> It seems that the problem is that you are comparing the same local 
> time from two different time zones:
>
> {a} . -> 2015-04-30T23:59:59.99999898672104+02:00
> (class)@ -> DateAndTime
> (oop)@ -> 324717569
> offset@ -> 7200
> seconds@ -> 4,5212399999999899E+08
>
> {b} . -> 2015-04-30T23:59:59.99999898672104+01:00
> (class)@ -> DateAndTime
> (oop)@ -> 324726017
> offset@ -> 3600
> seconds@ -> 4,5212759999999899E+08
>
> Note that the local time in both cases is the exactly the same and 
> that the offsets are different.
>
> Consequently the seconds (UTC) are different and time {b} being from 
> an earlier time zone has a greater UTC and therefore compares greater 
> than {a}.
>
> For consistency of record keeping, I think that you need to settle on 
> a single TimeZone of record and use that for all timestamps.
> That should then make the timestamp comparisons manageable.
>
> Dale
>
>
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150630/ab2a46c5/attachment.html>


More information about the Glass mailing list