[Glass] understanding the DateTime instance creation API

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Fri Jul 15 13:08:45 PDT 2016


Could you provide some Smalltalk code that exhibits the problems so I 
can understand how you are creating the various instances of DateTime?

There is "squeak compatible" protocol and GemStone protocol so the 
fix/answer to your question will depend upon which methods you are using 
... it could be that you are hitting base image bugs or bugs introduced 
by the GLASS/GsDevKit code...

Dale

On 07/15/2016 12:47 PM, PAUL DEBRUICKER via Glass wrote:
> I'm trying to create a DateTime in a 3.3.1 stone set to use UTC as its current & default timezone.
>
> When I specify the year, month, day, hour, minute, second and time zone I sometimes wind up with DateTimes I don't understand.
>
>
> As an example if I run the below code the two ISO8601 strings that print are for UTC '2016-07-15T10:10:10+0000' and for PST '2016-07-15T17:10:10-0700'.
>
>
> I think the PST ISO8601 string generated by GemStone should be  '2016-07-15T10:10:10-0700'
>
>
> If I then go to another platform e.g. wolframalpha.com and convert from the ISO strings to Unix time, the difference between the UTC ISO8601 string (1468577410 in unix time) and the GemStone generated PST ISO8601 string (1468627810 in unix time) is greater (14 hours) than the difference in their time zone offsets (7 hours).
>
>
> What am I doing wrong?  IT seems like I can only reliably specify a DateTime by setting the year, month, day, hour, minute, second and time zone if I use UTC as the time zone.
>
> Thanks for any guidance you can provide.
>
> Paul
>
>
>
>
> | yr month day hour min second utc pst utcTime pstTime |
>    yr := 2016.
>    month := 7.
>    day := 15.
>    hour := 10.
>    min := 10.
>    second := 10.
>    utc := TimeZone named: 'UTC'.
>    pst := TimeZone named: 'America/Los_Angeles'.
>
>    utcTime := DateTime
>      newWithYear: yr
>      month: month
>      day: day
>      hours: hour
>      minutes: min
>      seconds: second
>      timeZone: utc.
>
>    pstTime := DateTime
>      newWithYear: yr
>      month: month
>      day: day
>      hours: hour
>      minutes: min
>      seconds: second
>      timeZone: pst.
>
>    ^ Array
>      with: (Array with: utcTime with: utcTime hour with: utcTime asStringISO8601)
>      with: (Array with: pstTime with: pstTime hour with: pstTime asStringISO8601)
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass



More information about the Glass mailing list