[squeak-dev] Re: Date tomorrow - Date today "0:19:00:00"
Bert Freudenberg
bert at freudenbergs.de
Tue Jul 3 17:00:18 UTC 2012
Chris M in particular,
On 03.07.2012, at 18:33, Bert Freudenberg wrote:
> On 03.07.2012, at 18:16, glenpaling wrote:
>
>> It's just a bad reference to *self localOffset* rather than the specified
>> offset in todayAtNanoSeconds:offset: (see below). Changing the reference to
>> *aDuration* fixes the problem. Usually todayAtMilliseconds:offset: is used.
>> todayAtNanoSeconds:offset is only used when a call to nowWithOffset: results
>> in the same tick value as the previous call.
>>
>> todayAtNanoSeconds: nanoSecondsSinceMidnight offset: aDuration
>>
>> "This is usually only during system startup..."
>> self waitForOffsets.
>>
>> ^ self basicNew
>> setJdn: DaysSinceEpoch
>> seconds: (nanoSecondsSinceMidnight // 1000000000)
>> nano: (nanoSecondsSinceMidnight \\ 1000000000 )
>> offset: *self localOffset*
>
> Great! Committed to trunk.
Shouldn't this be a private method?
This method relies on DaysSinceEpoch being set to the right day. That means it's only safe to use from #nowWithOffset: which precedes it with a call to #milliSecondsSinceMidnight which is the only method that adjusts DaysSinceEpoch.
Who is using the #todayAt... methods anyway? No other sender in the image.
How about inlining these into #nowWithOffset: and removing them altogether?
- Bert -
More information about the Squeak-dev
mailing list
|