Date&Time api

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

Date&Time api

Uko2
Hi,

there are some weird things around the data & time API. So time-related classes are using methods like #asNanoSeconds. And numbers do not implements it. But they do implement methods as #nanoSeconds, #milliSeconds, #seconds and #asSeconds. Of course "5 nanoSeconds” are nicer than “5 asNanoSeconds”. Maybe we can do something to maintain polymorphism?

Uko
Reply | Threaded
Open this post in threaded view
|

Re: Date&Time api

Sean P. DeNigris
Administrator
Uko2 wrote
"5 nanoSeconds” are nicer than “5 asNanoSeconds”
And "5 nanoseconds" would be even nicer ;) http://forum.world.st/milliseconds-versus-milliSeconds-tt4809142.html
Cheers,
Sean
cbc
Reply | Threaded
Open this post in threaded view
|

Re: Date&Time api

cbc
In reply to this post by Uko2
To, #asNanoSeconds converts the time into the umber of nanosecond that the time represents.
#nanoSeconds (and the others) create a duration that is to be added to the time or DateAndTime.  The two do not end with the same things 0 and shouldin't.

The first tells you how many they represent; the second builds duration.

Probably not ideal names - but the intents are definitely different.

-cbc

On Tue, Aug 18, 2015 at 1:21 AM, Yuriy Tymchuk <[hidden email]> wrote:
Hi,

there are some weird things around the data & time API. So time-related classes are using methods like #asNanoSeconds. And numbers do not implements it. But they do implement methods as #nanoSeconds, #milliSeconds, #seconds and #asSeconds. Of course "5 nanoSeconds” are nicer than “5 asNanoSeconds”. Maybe we can do something to maintain polymorphism?

Uko