[Glass] understanding the DateTime instance creation API

Paul DeBruicker via Glass glass at lists.gemtalksystems.com
Fri Jul 15 12:37:56 PDT 2016


Hi Dale,

I pasted my testDt.st tode file below my name in my prior message.  If you
run it you get two arrays with containing the DateTimes, their #hour, and
the ISO8601 string.



also interesting is if I use the #newGmtWithYear:........   method rather
than the #newWithYear:....... method the duration you get when subtracting
the utcTime from the pstTime is zero, but the ISO8601 strings are correct. 
When using #newWithYear... the duration is correct at -7 hrs but the ISO8601
strings are wrong.


Hope this helps


Paul





GLASS mailing list wrote
> 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 .gemtalksystems

>> http://lists.gemtalksystems.com/mailman/listinfo/glass
> 
> _______________________________________________
> Glass mailing list

> Glass at .gemtalksystems

> http://lists.gemtalksystems.com/mailman/listinfo/glass





--
View this message in context: http://forum.world.st/understanding-the-DateTime-instance-creation-API-tp4906741p4906745.html
Sent from the GLASS mailing list archive at Nabble.com.


More information about the Glass mailing list