[squeak-dev] What do you expect to get from Duration>>seconds and Time>>seconds?

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

[squeak-dev] What do you expect to get from Duration>>seconds and Time>>seconds?

Ken Causey-3
One of the issues reported against 3.10 is that 'Time now seconds'
returns a fraction and not an integer as it did in 3.9 (and presumably
before).  It turns out the fact that it was an integer previously was an
artifact of the fact that the clock did not provide sub-second
precision.  Now that it does it returns a fraction.  All along the
actual calculation of seconds was done in Duration>>seconds and since
2003 that calculation has taken nanoseconds into consideration and
clearly would return a fraction if nanoseconds is non-zero.

I think it's reasonable to get a fraction from Duration>>seconds since
sub-second durations are not unusual.  Maybe someone else expects to get
a 0 in that case, if so please speak up.

However what about Time>>seconds?  The ANSI protocol specifies
Duration>>seconds simply specifying that it returns a number, but there
is no specification for Time>>seconds or DateAndTime>>seconds at all.
It does however specify DateAndTime>>second though and again it only
says 'number'.  So it seems to be time to gather opinions.

Ken



signature.asc (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] What do you expect to get from Duration>>seconds and Time>>seconds?

Igor Stasenko
2008/5/10 Ken Causey <[hidden email]>:

> One of the issues reported against 3.10 is that 'Time now seconds'
> returns a fraction and not an integer as it did in 3.9 (and presumably
> before).  It turns out the fact that it was an integer previously was an
> artifact of the fact that the clock did not provide sub-second
> precision.  Now that it does it returns a fraction.  All along the
> actual calculation of seconds was done in Duration>>seconds and since
> 2003 that calculation has taken nanoseconds into consideration and
> clearly would return a fraction if nanoseconds is non-zero.
>
> I think it's reasonable to get a fraction from Duration>>seconds since
> sub-second durations are not unusual.  Maybe someone else expects to get
> a 0 in that case, if so please speak up.
>
> However what about Time>>seconds?  The ANSI protocol specifies
> Duration>>seconds simply specifying that it returns a number, but there
> is no specification for Time>>seconds or DateAndTime>>seconds at all.
> It does however specify DateAndTime>>second though and again it only
> says 'number'.  So it seems to be time to gather opinions.
>

One glitch, which i found, is how Seaside interprets it and uses

Time seconds asTwoCharacterString  to display date&time in tests.

this leads to DNU because #asTwoCharacterString implemented for
Integer class, not for Fraction.

> Ken
>
>
>
>



--
Best regards,
Igor Stasenko AKA sig.

Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Re: What do you expect to get from Duration>>seconds and Time>>seconds?

Nicolas Cellier-3
In reply to this post by Ken Causey-3
Ken Causey a écrit :

> One of the issues reported against 3.10 is that 'Time now seconds'
> returns a fraction and not an integer as it did in 3.9 (and presumably
> before).  It turns out the fact that it was an integer previously was an
> artifact of the fact that the clock did not provide sub-second
> precision.  Now that it does it returns a fraction.  All along the
> actual calculation of seconds was done in Duration>>seconds and since
> 2003 that calculation has taken nanoseconds into consideration and
> clearly would return a fraction if nanoseconds is non-zero.
>
> I think it's reasonable to get a fraction from Duration>>seconds since
> sub-second durations are not unusual.  Maybe someone else expects to get
> a 0 in that case, if so please speak up.
>
> However what about Time>>seconds?  The ANSI protocol specifies
> Duration>>seconds simply specifying that it returns a number, but there
> is no specification for Time>>seconds or DateAndTime>>seconds at all.
> It does however specify DateAndTime>>second though and again it only
> says 'number'.  So it seems to be time to gather opinions.
>
> Ken
>
>

Then why Time now minutes and Time now hours return an Integer instead
of a Fraction?

The most consistent behaviour is to answer number of seconds truncated
to an Integer.
That's the least surprising behaviour I would expect.

Nicolas


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: What do you expect to get from Duration>>seconds and Time>>seconds?

Igor Stasenko
2008/5/10 nicolas cellier <[hidden email]>:

> Ken Causey a écrit :
>>
>> One of the issues reported against 3.10 is that 'Time now seconds'
>> returns a fraction and not an integer as it did in 3.9 (and presumably
>> before).  It turns out the fact that it was an integer previously was an
>> artifact of the fact that the clock did not provide sub-second
>> precision.  Now that it does it returns a fraction.  All along the
>> actual calculation of seconds was done in Duration>>seconds and since
>> 2003 that calculation has taken nanoseconds into consideration and
>> clearly would return a fraction if nanoseconds is non-zero.
>>
>> I think it's reasonable to get a fraction from Duration>>seconds since
>> sub-second durations are not unusual.  Maybe someone else expects to get
>> a 0 in that case, if so please speak up.
>>
>> However what about Time>>seconds?  The ANSI protocol specifies
>> Duration>>seconds simply specifying that it returns a number, but there
>> is no specification for Time>>seconds or DateAndTime>>seconds at all.
>> It does however specify DateAndTime>>second though and again it only
>> says 'number'.  So it seems to be time to gather opinions.
>>
>> Ken
>>
>>
>
> Then why Time now minutes and Time now hours return an Integer instead of a
> Fraction?
>
Right, and if user wants more precise values, we can always add
Time>>milliseconds microseconds nanoseconds picaseconds e.t.c

> The most consistent behaviour is to answer number of seconds truncated to an
> Integer.
> That's the least surprising behaviour I would expect.
>
> Nicolas
>
>
>



--
Best regards,
Igor Stasenko AKA sig.


Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Re: What do you expect to get from Duration>>seconds and Time>>seconds?

Ken Causey-3
OK, it sounds like concensus is that Duration seconds should return an
Integer.  So that's what it will do for 3.10.1.

Ken

On Sat, 2008-05-10 at 19:13 +0300, Igor Stasenko wrote:

> 2008/5/10 nicolas cellier <[hidden email]>:
> > Ken Causey a écrit :
> >>
> >> One of the issues reported against 3.10 is that 'Time now seconds'
> >> returns a fraction and not an integer as it did in 3.9 (and presumably
> >> before).  It turns out the fact that it was an integer previously was an
> >> artifact of the fact that the clock did not provide sub-second
> >> precision.  Now that it does it returns a fraction.  All along the
> >> actual calculation of seconds was done in Duration>>seconds and since
> >> 2003 that calculation has taken nanoseconds into consideration and
> >> clearly would return a fraction if nanoseconds is non-zero.
> >>
> >> I think it's reasonable to get a fraction from Duration>>seconds since
> >> sub-second durations are not unusual.  Maybe someone else expects to get
> >> a 0 in that case, if so please speak up.
> >>
> >> However what about Time>>seconds?  The ANSI protocol specifies
> >> Duration>>seconds simply specifying that it returns a number, but there
> >> is no specification for Time>>seconds or DateAndTime>>seconds at all.
> >> It does however specify DateAndTime>>second though and again it only
> >> says 'number'.  So it seems to be time to gather opinions.
> >>
> >> Ken
> >>
> >>
> >
> > Then why Time now minutes and Time now hours return an Integer instead of a
> > Fraction?
> >
> Right, and if user wants more precise values, we can always add
> Time>>milliseconds microseconds nanoseconds picaseconds e.t.c
>
> > The most consistent behaviour is to answer number of seconds truncated to an
> > Integer.
> > That's the least surprising behaviour I would expect.
> >
> > Nicolas



signature.asc (196 bytes) Download Attachment