[GemStone-Smalltalk] Possible Date bug in GS64 3.1 or 3.x??

Dennis Smith dennis at cherniaksoftware.com
Wed May 7 16:28:16 PDT 2014


Yes "Date today" returns the date of the server (server is PST).
However, as of 3.x "Time now" returns NOT the time of the server, but 
the timezone-shifted time (the database is MST which is shifted one hour 
from PST).

So "Time now" respects the timezone of the database, while "Date today" 
does not.

Thus you get, as I noted earlier ...

     Date today 'and' Time now

     May 7 11:59pm
     May 7 00:01am

The Date/Time of the server (as reported by "date") was
     May 7 10:59pm PDT
     May 7 11:01am PDT
The "DateAndTime now", when parsed was
     May 7 11:59pm MDT
     May 8 00:01am MDT
but Date today, Time now reported ..
     May 7 11:59pm
     May 7 00:01am

Timezone's hurt my brain!

I just think that if "Time now" was updated to obey the gemstone 
timezone, then so should "Date today".   In my patched versions, they both
use "DateAndTime now" so they come out as noted above for that.




On 2014-05-07 6:44 PM, James Foster wrote:
> The comment for Date class>>#’today’ is: "Creates and returns an instance of the receiver from the system calendar on the machine that is running the Gem process, which is assumed to represent the current date."
>
> Are both databases running on the same server? What is the TZ setting for the server?
>
> Date today. "05/07/2014"
> TimeZone sampleTokyo installAsCurrentTimeZone. “JST"
> DateTime now. "08/05/2014 07:37:03"
> Date today. "05/07/2014”
> DateAndTime now. "2014-05-08T07:38:29.0072650909423+09:00"
> System performOnServer: 'date'. ‘"Wed May  7 15:39:19 PDT 2014”
> TimeZone default installAsCurrentTimeZone. "PST"
> DateTime now. "07/05/2014 15:40:56”
>
> I think that Date is behaving as it is documented to behave and if you want TimeZone consideration then you need to use a class that deals with TimeZone.
>
> James
>
> On May 7, 2014, at 12:42 PM, Dennis Smith <dennis at CherniakSoftware.com> wrote:
>
>> In 3.x "Time now" was corrected to take into account the Gemstone current TimeZone -- that was nice, fixed
>> a problem we had, so I copied the fix to 2.x and it worked.
>>
>> However, in both 2.x and the 3.1.0.2 that we are using, "Date today" does not have a similar fix, so you get strange results.
>>
>> We have a client with 2 databases.  The client is in Vancouver which is "PST", and one GS is PST but the other is MST, which is one our East.
>>
>> So we get
>>     May 7 11:59pm    ->     May 7 00:01am   ->   May 8 01:00 am
>>
>> In other words the date does not slip over until 1am.
>>
>> It was simple enough to get "Date today" from "DateAndTime" like "Time now".
>>
>> So, maybe this is fixed in a later 3.x??   I don't have one to look at.
>>
>> -- 
>> Dennis Smith
>> Cherniak Software Development Corporation
>> Phone  416.798.7948 ext 314
>> Email  dennis at cherniaksoftware.com
>>
>> _______________________________________________
>> GemStone-Smalltalk mailing list
>> GemStone-Smalltalk at lists.gemtalksystems.com
>> http://lists.gemtalksystems.com/mailman/listinfo/gemstone-smalltalk

-- 
Dennis Smith
Cherniak Software Development Corporation
416.798.7948  x208



More information about the GemStone-Smalltalk mailing list