[Python-ideas] Add time.time_ns(): system clock with nanosecond resolution
Antoine Pitrou
solipsis at pitrou.net
Sat Oct 14 11:56:36 EDT 2017
On Sun, 15 Oct 2017 01:46:50 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
>
> Might it make more sense to have a parallel *module* that works with a
> different base data type rather than parallel functions within the existing
> API?
>
> That is, if folks wanted to switch to 64-bit nanosecond time, they would
> use:
>
> * time_ns.time()
> * time_ns.monotonic()
> * time_ns.perf_counter()
> * time_ns.clock_gettime()
> * time_ns.clock_settime()
>
> The idea here would be akin to the fact we have both math and cmath as
> modules, where the common APIs conceptually implement the same algorithms,
> they just work with a different numeric type (floats vs complex numbers).
-1 from me. The math/cmath separation isn't even very well grounded, it
just mirrors the C API that those two modules reflect. But regardless,
the *operations* in math and cmath are different and operate in
different domains (try e.g. ``sqrt(-1)``), which is not the case here.
Regards
Antoine.
More information about the Python-ideas
mailing list