On 17.02.2016, at 18:11, David T. Lewis lewis@mail.msen.com wrote:
On Wed, Feb 17, 2016 at 05:35:45PM -0800, tim Rowledge wrote:
On 17-02-2016, at 5:15 PM, David T. Lewis lewis@mail.msen.com wrote:
I will post an update to DataAndTime class>>nowWithOffset that seems to me to be the LHTTCPW (least horrible thing that could possibly work).
Ah sorry Dave, you can???t do that (as in http://source.squeak.org/trunk/Kernel-dtl.990.mcz)
The code is working ok if the TZ is set correctly. If I set PST DateAndTime localTimeZone: (TimeZone offset: -8 hours name: 'Pacific Standard Time' abbreviation: 'PST???). then DateAndTime now -> 2016-02-18T01:30:48.40668-08:00 which is correct - the UTC is 8 hrs ahead of my local time.
Since introduction of the UTC changes, none of this is going to work without the time zone being set. So if you set your time zone and it seems to work, that is good. Or at least it is less horrible than before.
Now, ???DateAndTime now asLocal??? seems to me to be wrong since it returns just the same time. And asUTC appears to go the wrong way, showing it to be 9:30 in the morning
Dunno. There is no method comment for DateAndTime>>asLocal. I would expect it to answer an instance that represents the same absolute time, but with with the offset set to local time zone and other instance variables set to make it look like the same time. It does seem to be doing this.
This also seems to do what I would expect:
now := DateAndTime now. { now . now asUTC asLocal } ==> {2016-02-17T21:06:53.482839-05:00 . 2016-02-17T21:06:53.482839-05:00}
Dave
I committed a more invasive “fix”. Looking forward to your overhaul!
- Bert -