[issue31784] Add time.time_ns(): get time with nanosecond resolution

STINNER Victor report at bugs.python.org
Fri Oct 13 17:34:15 EDT 2017


New submission from STINNER Victor <victor.stinner at gmail.com>:

time.time() returns time as a float, but the conversion to float lose precision at the nanosecond resolution.

I propose to add a new time.time_ns() function which returns time as an integer number of nanoseconds since epoch. It's similar to the st_mtime_ns field of os.stat_result which extended the old st_mtime field.

For the full rationale, see my thread on python-ideas:
[Python-ideas] Add time.time_ns(): system clock with nanosecond resolution
https://mail.python.org/pipermail/python-ideas/2017-October/047318.html

----------
components: Library (Lib)
messages: 304365
nosy: haypo
priority: normal
severity: normal
status: open
title: Add time.time_ns(): get time with nanosecond resolution
type: enhancement
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31784>
_______________________________________


More information about the Python-bugs-list mailing list