This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients belopolsky, ethan.furman, lemburg, mdcb808@gmail.com, vstinner
Date 2014-12-18.21:17:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1418937444.52.0.371939435165.issue23084@psf.upfronthosting.co.za>
In-reply-to
Content
> C implementation of datetime.now() does not rely on float time, so this is only an issue for the Python implementation.

Ah yes, but there is another technical issue that I'm trying to address in the issue #22117: datetime.datetime.now() is implemented with _PyTime_gettimeofday() which has a resolution of 1 microsecond, even it is now implemented with clock_gettime(CLOCK_REALTIME) which has a resolution of 1 nanoecond.

On Linux, the effictive resolution of clock_gettime(CLOCK_REALTIME) is better than 1 microsecond, around 1/4 microsecond (250 nanosecond).

> Overall, the proposed type is much less convenient than integer nanoseconds because it does not support arithmetics. 

I'm working on using a number of nanoseconds using an integer type. It's just a signed 64-bit bit integer. If we decide to support nanosecond resolution in Python, a integer number of nanosecond may be enough.

But this issue looks like the PEP 410 which was rejected. If you are motivated enough, you may update the PEP and write a new one. But first, read again the PEP and the discussion explaining why it was rejected.

Basically, the loss of precision is very rare (or may not occur) in practice and the PEP 410 required to modify a lot of functions.

Remember that the effictive resolution of time.time() on Windows is just 1 millisecond (0.001 second)... See the PEP 418 for many numbers, list of hardware clocks, operating system, etc.
https://www.python.org/dev/peps/pep-0418/#system-time
History
Date User Action Args
2014-12-18 21:17:24vstinnersetrecipients: + vstinner, lemburg, belopolsky, ethan.furman, mdcb808@gmail.com
2014-12-18 21:17:24vstinnersetmessageid: <1418937444.52.0.371939435165.issue23084@psf.upfronthosting.co.za>
2014-12-18 21:17:24vstinnerlinkissue23084 messages
2014-12-18 21:17:24vstinnercreate