[Python-ideas] Add time.time_ns(): system clock with nanosecond resolution

Antoine Pitrou solipsis at pitrou.net
Fri Oct 13 11:03:40 EDT 2017


On Fri, 13 Oct 2017 16:57:28 +0200
Stefan Behnel <stefan_ml at behnel.de> wrote:
> Victor Stinner schrieb am 13.10.2017 um 16:12:
> > I would like to add new functions to return time as a number of
> > nanosecond (Python int), especially time.time_ns().  
> 
> I might have missed it while skipping through your post, but could you
> quickly explain why improving the precision of time.time() itself wouldn't
> help already? Would double FP precision not be accurate enough here?

To quote Victor's message:

« The problem is that Python returns time as a floatting point number
which is usually a 64-bit binary floatting number (in the IEEE 754
format). This type starts to loose nanoseconds after 104 days. »

Regards

Antoine.




More information about the Python-ideas mailing list