The Trunk: Kernel-bf.995.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Kernel-bf.995.mcz

commits-2
Bert Freudenberg uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-bf.995.mcz

==================== Summary ====================

Name: Kernel-bf.995
Author: bf
Time: 18 February 2016, 3:16:12.729637 pm
UUID: d871efd5-be20-4ad9-9a1d-c1b24dce73b5
Ancestors: Kernel-bf.994

Add preference to disable automatic timezone adjustment.

=============== Diff against Kernel-bf.994 ===============

Item was changed:
  Magnitude subclass: #DateAndTime
  instanceVariableNames: 'seconds offset jdn nanos'
+ classVariableNames: 'AutomaticTimezone ClockProvider LastClockValue LocalTimeZone NanoOffset'
- classVariableNames: 'ClockProvider LastClockValue LocalTimeZone NanoOffset'
  poolDictionaries: 'ChronologyConstants'
  category: 'Kernel-Chronology'!
 
  !DateAndTime commentStamp: 'brp 5/13/2003 08:07' prior: 0!
  I represent a point in UTC time as defined by ISO 8601. I have zero duration.
 
 
  My implementation uses three SmallIntegers
   and a Duration:
  jdn - julian day number.
  seconds - number of seconds since midnight.
  nanos - the number of nanoseconds since the second.
 
  offset - duration from UTC.
 
  The nanosecond attribute is almost always zero but it defined for full ISO compliance and is suitable for timestamping.
  !

Item was added:
+ ----- Method: DateAndTime class>>automaticTimezone (in category 'preferences') -----
+ automaticTimezone
+ "Accessor for the system-wide preference"
+
+ <preference: 'Automatically set local timezone'
+ category: 'general'
+ description: 'If enabled, the timezone will automatically be kept in sync with the system''s time (daylight savings changes etc.)'
+ type: #Boolean>
+ ^AutomaticTimezone ifNil: [ true ]!

Item was added:
+ ----- Method: DateAndTime class>>automaticTimezone: (in category 'preferences') -----
+ automaticTimezone: aBoolean
+ "Accessor for the system-wide preference"
+
+ AutomaticTimezone := aBoolean!

Item was changed:
  ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
  now
  | clockAndOffset |
  clockAndOffset := self clock localMicrosecondClockWithOffset.
+ (self automaticTimezone and:
+ [self localOffset asSeconds ~= clockAndOffset second])
+ ifTrue: [self localOffset: (Duration seconds: clockAndOffset second)].
- self localOffset asSeconds ~= clockAndOffset second ifTrue: [
- self localOffset: (Duration seconds: clockAndOffset second)].
  ^self now: clockAndOffset first offset: self localOffset!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-bf.995.mcz

Chris Muller-3
I thought #useLocale would be sufficient here.  If one is has
#useLocale turned on, it would mean automatic update, otherwise, not.

On Thu, Feb 18, 2016 at 5:16 PM,  <[hidden email]> wrote:

> Bert Freudenberg uploaded a new version of Kernel to project The Trunk:
> http://source.squeak.org/trunk/Kernel-bf.995.mcz
>
> ==================== Summary ====================
>
> Name: Kernel-bf.995
> Author: bf
> Time: 18 February 2016, 3:16:12.729637 pm
> UUID: d871efd5-be20-4ad9-9a1d-c1b24dce73b5
> Ancestors: Kernel-bf.994
>
> Add preference to disable automatic timezone adjustment.
>
> =============== Diff against Kernel-bf.994 ===============
>
> Item was changed:
>   Magnitude subclass: #DateAndTime
>         instanceVariableNames: 'seconds offset jdn nanos'
> +       classVariableNames: 'AutomaticTimezone ClockProvider LastClockValue LocalTimeZone NanoOffset'
> -       classVariableNames: 'ClockProvider LastClockValue LocalTimeZone NanoOffset'
>         poolDictionaries: 'ChronologyConstants'
>         category: 'Kernel-Chronology'!
>
>   !DateAndTime commentStamp: 'brp 5/13/2003 08:07' prior: 0!
>   I represent a point in UTC time as defined by ISO 8601. I have zero duration.
>
>
>   My implementation uses three SmallIntegers
>    and a Duration:
>   jdn           - julian day number.
>   seconds       - number of seconds since midnight.
>   nanos - the number of nanoseconds since the second.
>
>   offset        - duration from UTC.
>
>   The nanosecond attribute is almost always zero but it defined for full ISO compliance and is suitable for timestamping.
>   !
>
> Item was added:
> + ----- Method: DateAndTime class>>automaticTimezone (in category 'preferences') -----
> + automaticTimezone
> +       "Accessor for the system-wide preference"
> +
> +       <preference: 'Automatically set local timezone'
> +               category: 'general'
> +               description: 'If enabled, the timezone will automatically be kept in sync with the system''s time (daylight savings changes etc.)'
> +               type: #Boolean>
> +       ^AutomaticTimezone ifNil: [ true ]!
>
> Item was added:
> + ----- Method: DateAndTime class>>automaticTimezone: (in category 'preferences') -----
> + automaticTimezone: aBoolean
> +       "Accessor for the system-wide preference"
> +
> +       AutomaticTimezone := aBoolean!
>
> Item was changed:
>   ----- Method: DateAndTime class>>now (in category 'ansi protocol') -----
>   now
>         | clockAndOffset |
>         clockAndOffset := self clock localMicrosecondClockWithOffset.
> +       (self automaticTimezone and:
> +               [self localOffset asSeconds ~= clockAndOffset second])
> +                       ifTrue: [self localOffset: (Duration seconds: clockAndOffset second)].
> -       self localOffset asSeconds ~= clockAndOffset second ifTrue: [
> -               self localOffset: (Duration seconds: clockAndOffset second)].
>         ^self now: clockAndOffset first offset: self localOffset!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-bf.995.mcz

Bert Freudenberg

> On 18.02.2016, at 16:05, Chris Muller <[hidden email]> wrote:
>
> I thought #useLocale would be sufficient here.  If one is has
> #useLocale turned on, it would mean automatic update, otherwise, not.

useLocale is off by default, and means a lot more than automatic timezone updates (it loads translation files etc).

- Bert -






smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-bf.995.mcz

Chris Muller-3
Then how about we change the useLocale default to true?

If I fly to another continent, and need to use an image and keep it in
my home TZ, before I leave I'll set the useLocale to false so it will
leave my desired TZ alone.  Done.  Except, now, even though I did
that, it will now still keep picking up information from my
always-changing locale from the OS (i.e., at every layover stop), and
blowing away my explicit TZ setting.

Turning off useLocale is the exceptional case, that's why on those
rare cases I would need to do it, I won't remember to flip
AutomaticTimezone too.  It is sure to create confusion in the users
mind ("I thought I set it?  did I not save my image?" etc) and
investigation that requires them to delve all the way into the
implementation of #now before they discover why.

Auto-DST switching is cool, but blowing away the users TZ setting
isn't.  How about we go to useLocale -> true by default?

On Thu, Feb 18, 2016 at 6:07 PM, Bert Freudenberg <[hidden email]> wrote:

>
>> On 18.02.2016, at 16:05, Chris Muller <[hidden email]> wrote:
>>
>> I thought #useLocale would be sufficient here.  If one is has
>> #useLocale turned on, it would mean automatic update, otherwise, not.
>
> useLocale is off by default, and means a lot more than automatic timezone updates (it loads translation files etc).
>
> - Bert -
>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Kernel-bf.995.mcz

Bert Freudenberg
Just leave useLocale disabled. Why would you change it? Until we have proper locale support we don’t want to turn it on.

- Bert -

On 18.02.2016, at 18:18, Chris Muller <[hidden email]> wrote:

>
> Then how about we change the useLocale default to true?
>
> If I fly to another continent, and need to use an image and keep it in
> my home TZ, before I leave I'll set the useLocale to false so it will
> leave my desired TZ alone.  Done.  Except, now, even though I did
> that, it will now still keep picking up information from my
> always-changing locale from the OS (i.e., at every layover stop), and
> blowing away my explicit TZ setting.
>
> Turning off useLocale is the exceptional case, that's why on those
> rare cases I would need to do it, I won't remember to flip
> AutomaticTimezone too.  It is sure to create confusion in the users
> mind ("I thought I set it?  did I not save my image?" etc) and
> investigation that requires them to delve all the way into the
> implementation of #now before they discover why.
>
> Auto-DST switching is cool, but blowing away the users TZ setting
> isn't.  How about we go to useLocale -> true by default?
>
> On Thu, Feb 18, 2016 at 6:07 PM, Bert Freudenberg <[hidden email]> wrote:
>>
>>> On 18.02.2016, at 16:05, Chris Muller <[hidden email]> wrote:
>>>
>>> I thought #useLocale would be sufficient here.  If one is has
>>> #useLocale turned on, it would mean automatic update, otherwise, not.
>>
>> useLocale is off by default, and means a lot more than automatic timezone updates (it loads translation files etc).
>>
>> - Bert -




smime.p7s (5K) Download Attachment