Time oddity

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

Time oddity

Stéphane Rollandin
Hello,

Any reason why

t := Time now.
(t to: (t addSeconds: 5)) asDuration

never return the same value, which should be 5 seconds if I'm not
missing something... ?

Stef

Reply | Threaded
Open this post in threaded view
|

Re: Time oddity

Hans-Martin Mosner
Am 18.02.2014 13:10, schrieb Stéphane Rollandin:

> Hello,
>
> Any reason why
>
> t := Time now.
> (t to: (t addSeconds: 5)) asDuration
>
> never return the same value, which should be 5 seconds if I'm not
> missing something... ?
>
> Stef

Time now has sub-second accuracy, but #addSeconds rounds to an integer
second value (which is arguably wrong).
The difference is of course not exactly 5 seconds (unless you hit
exactly a full second with Time now).

Cheers,
Hans-Martin

Reply | Threaded
Open this post in threaded view
|

Re: Time oddity

Stéphane Rollandin
Ok, thanks !

Stef