Time seconds in 3.10

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

Time seconds in 3.10

Jimmie Houchin-3
Before Squeak 3.10

Time now seconds.

returned a SmallInteger.

Now it returns a Fraction.

This was discovered in Seaside when I was using 3.10 and encountered a DNU.

I fixed what I thought was a bug in Seaside only to find it is the
Squeak behavior that changed.

But I am having difficulty finding the code that returns the Fraction in
3.10.
Just trying to learn the behavior and difference between 3.10 and before.

Philippe on the Seaside suggested this _might_ be a bug 3.10.

Why the change and is this a bug? And any help showing me where the
Fraction enters the picture, greatly appreciated. :)

Thoughts.

Thanks.

Jimmie

Reply | Threaded
Open this post in threaded view
|

Re: Time seconds in 3.10

keith1y
Jimmie Houchin wrote:

> Before Squeak 3.10
>
> Time now seconds.
>
> returned a SmallInteger.
>
> Now it returns a Fraction.
>
> This was discovered in Seaside when I was using 3.10 and encountered a DNU.
>
>  

It has to be said that the time is set via a fairly roundabout route
which could be simplified somewhat
in the light of recent changes in 3.10 which now has a millisecondClock.

The cuprit is the following code

Duration-seconds
    "Answer the number of seconds the receiver represents."

    ^ (seconds rem: SecondsInMinute) + (nanos / NanosInSecond)

which can be fixed with the follwoing small change
 
Duration-seconds
    "Answer the number of whole seconds the receiver represents."

    ^ (seconds rem: SecondsInMinute) + (nanos // NanosInSecond)

assuming that other users of #seconds are also expecting an integer result.

best regards

Keith



Reply | Threaded
Open this post in threaded view
|

Re: Time seconds in 3.10

Andreas.Raab
In reply to this post by Jimmie Houchin-3
The difference appears to be in Time>>now which for some inexplicable
reason now includes a milliseconds value. Albeit incorrectly I might add
since the msecs clock is not actually synchronized with the seconds
clock. Looks like a regression to me.

Cheers,
   - Andreas

Jimmie Houchin wrote:

> Before Squeak 3.10
>
> Time now seconds.
>
> returned a SmallInteger.
>
> Now it returns a Fraction.
>
> This was discovered in Seaside when I was using 3.10 and encountered a DNU.
>
> I fixed what I thought was a bug in Seaside only to find it is the
> Squeak behavior that changed.
>
> But I am having difficulty finding the code that returns the Fraction in
> 3.10.
> Just trying to learn the behavior and difference between 3.10 and before.
>
> Philippe on the Seaside suggested this _might_ be a bug 3.10.
>
> Why the change and is this a bug? And any help showing me where the
> Fraction enters the picture, greatly appreciated. :)
>
> Thoughts.
>
> Thanks.
>
> Jimmie
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Time seconds in 3.10

keith1y
In reply to this post by keith1y
I raised an issue on Mantis. http://bugs.squeak.org/view.php?id=6805 and
have uploaded a changeset which contains a fix.

To load the fix into 3.10 execute.

Installer mantis fixBug: 6805.

best regards

Keith


=====
Installer viewBug: 6805 output follows.

Bug ID: 0006805
Category: [Squeak] Chronology
Severity: minor
Reproducibility: always
Date Submitted: 12-08-07 21:41
Date Updated: 12-08-07 21:49
Reporter: Keith_Hodges
View Status: public
Handler:
Priority: normal
Resolution: open
Status: new
Product Version: 3.10
Summary: 0006805: Time now seconds returns a fraction.
Description: Before Squeak 3.10<br />
<br />
Time now seconds.<br />
<br />
returned a SmallInteger.<br />
<br />
Now it returns a Fraction.
Additional Information:
Notes:
(0011520 - 92 - 124 - 124 - 124 - 124 - 124)
Keith_Hodges    12-08-07 21:49
"fix begin"
Installer mantis bug: 6805 fix: 'Mantis6805-FixTimeNowSeconds.1.cs'.
"fix end"

Files: #('Mantis6805-FixTimeNowSeconds.1.cs')

Reply | Threaded
Open this post in threaded view
|

Re: Time seconds in 3.10

keith1y
In reply to this post by Andreas.Raab
Andreas Raab wrote:
> The difference appears to be in Time>>now which for some inexplicable
> reason now includes a milliseconds value. Albeit incorrectly I might
> add since the msecs clock is not actually synchronized with the
> seconds clock. Looks like a regression to me.
>
> Cheers,
>   - Andreas
It is "actually" synchronised.

Keith

Reply | Threaded
Open this post in threaded view
|

Re: Time seconds in 3.10

Andreas.Raab
Keith Hodges wrote:
> Andreas Raab wrote:
>> The difference appears to be in Time>>now which for some inexplicable
>> reason now includes a milliseconds value. Albeit incorrectly I might
>> add since the msecs clock is not actually synchronized with the
>> seconds clock. Looks like a regression to me.
>>
>> Cheers,
>>   - Andreas
> It is "actually" synchronised.

Oh, I see. You're keeping an offset manually. I was referring to
primMsecsClock which has no relation (at least on Windows) to the value
obtained by primTotalSeconds. Do you know if this adjustment will
survive standby/suspend and power cycling?

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Time seconds in 3.10

Edgar J. De Cleene
In reply to this post by Jimmie Houchin-3



El 12/8/07 5:58 PM, "Jimmie Houchin" <[hidden email]> escribió:

> Before Squeak 3.10
>
> Time now seconds.
>
> returned a SmallInteger.
>
> Now it returns a Fraction.
>
> This was discovered in Seaside when I was using 3.10 and encountered a DNU.
>
> I fixed what I thought was a bug in Seaside only to find it is the
> Squeak behavior that changed.
>
> But I am having difficulty finding the code that returns the Fraction in
> 3.10.
> Just trying to learn the behavior and difference between 3.10 and before.
>
> Philippe on the Seaside suggested this _might_ be a bug 3.10.
>
> Why the change and is this a bug? And any help showing me where the
> Fraction enters the picture, greatly appreciated. :)
>
> Thoughts.
>
> Thanks.
>
> Jimmie

For 3.10gamma7159

This simulation took 0.0 seconds.
**Tree**
1 Time class>>now
  1 Time class>>seconds:nanoSeconds:
    |1 Duration class>>seconds:nanoSeconds:
    |  |1 SmallInteger(Number)>>fractionPart
    |  |1 Duration>>seconds:nanoSeconds:
    |1 Duration>>ticks
    |  |1 Duration>>days
    |  |1 Array class(ArrayedCollection class)>>with:with:with:
    |1 Time>>ticks:
  1 Time class>>milliSecondsSinceMidnight
    1 DateAndTime class>>milliSecondsSinceMidnight
      1 DateAndTime class>>millisecondClockValue
        1 DateAndTime class>>clock

**Leaves**
1 Duration>>days
          1 Duration>>ticks
1 DateAndTime class>>clock
          1 DateAndTime class>>millisecondClockValue
1 Time class>>milliSecondsSinceMidnight
          1 Time class>>now
1 Time>>ticks:
          1 Time class>>seconds:nanoSeconds:
1 Duration>>ticks
          1 Time class>>seconds:nanoSeconds:
1 DateAndTime class>>millisecondClockValue
          1 DateAndTime class>>milliSecondsSinceMidnight
1 Time class>>seconds:nanoSeconds:
          1 Time class>>now
1 DateAndTime class>>milliSecondsSinceMidnight
          1 Time class>>milliSecondsSinceMidnight
1 SmallInteger(Number)>>fractionPart
          1 Duration class>>seconds:nanoSeconds:
1 Duration class>>seconds:nanoSeconds:
          1 Time class>>seconds:nanoSeconds:
1 Array class(ArrayedCollection class)>>with:with:with:
          1 Duration>>ticks
1 Duration>>seconds:nanoSeconds:
          1 Duration class>>seconds:nanoSeconds:
1 Time class>>now
          1 UndefinedObject>>DoIt

>

'kph 12/9/2006 10:18 Time class now {ansi protocol

I DNU ?

Edgar



Reply | Threaded
Open this post in threaded view
|

Re: Time seconds in 3.10

keith1y
In reply to this post by Andreas.Raab
Andreas Raab wrote:

> Keith Hodges wrote:
>> Andreas Raab wrote:
>>> The difference appears to be in Time>>now which for some inexplicable
>>> reason now includes a milliseconds value. Albeit incorrectly I might
>>> add since the msecs clock is not actually synchronized with the
>>> seconds clock. Looks like a regression to me.
>>>
>>> Cheers,
>>>   - Andreas
>> It is "actually" synchronised.
>
> Oh, I see. You're keeping an offset manually. I was referring to
> primMsecsClock which has no relation (at least on Windows) to the
> value obtained by primTotalSeconds. Do you know if this adjustment
> will survive standby/suspend and power cycling?
>
> Cheers,
>   - Andreas
Hi, Andreas,

I agree with you it is difficult to know whether this scheme is robust
with regard to the scenarios mentioned. does the image/vm get informed
when it is resumed?

Keith