[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] PEP 410 (Decimal timestamp): the implementation is ready for a review

On Wed, 15 Feb 2012 18:23:55 +0100
Victor Stinner <victor.stinner at gmail.com> wrote:
> Linux supports nanosecond timestamps since Linux 2.6, Windows supports
> 100 ns resolution since Windows 2000 or maybe before. It doesn't mean
> that Windows system clock is accurate: in practical, it's hard to get
> something better than 1 ms :-)

Well, do you think the Linux system clock is nanosecond-accurate?

A nanosecond is what it takes to execute a couple of CPU instructions.
Even on a real-time operating system, your nanosecond-precise
measurement is already obsolete when it starts being processed by the
higher-level application. A single cache miss in the CPU will make the
precision worthless.

And in a higher-level language like Python, the execution times of
individual instructions are not specified or stable, so the resolution
brings you nothing.

> "Improved timestamps
>     As computers become faster in general and as Linux becomes used
> more for mission-critical applications, the granularity of
> second-based timestamps becomes insufficient. To solve this, ext4
> provides timestamps measured in nanoseconds. (...)"

This is a fallacy. Just because ext4 is able to *store* nanoseconds
timestamps doesn't mean the timestamps are accurate up to that point.

> Such test is common in build programs like make or scons.

scons is written in Python and its authors have not complained, AFAIK,
about timestamp precision.