[Python-Dev] PEP 564: Add new time functions with nanosecond resolution

Guido van Rossum guido at python.org
Mon Oct 16 11:58:03 EDT 2017


On Mon, Oct 16, 2017 at 8:37 AM, Ben Hoyt <benhoyt at gmail.com> wrote:

> I've read the examples you wrote here, but I'm struggling to see what the
> real-life use cases are for this. When would you care about *both* very
> long-running servers (104 days+) and nanosecond precision? I'm not saying
> it could never happen, but would want to see real "experience reports" of
> when this is needed.
>

A long-running server might still want to log precise *durations* of
various events. (Durations of events are the bread and butter of server
performance tuning.) And for this it might want to use the most precise
clock available, which is perf_counter(). But if perf_counter()'s epoch is
the start of the process, after 104 days it can no longer report ns
precision due to float rounding (even though the internal counter does not
lose ns).

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171016/b60b104b/attachment.html>


More information about the Python-Dev mailing list