Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Unix st_mtime has only second-level resolution #6285
Original bug ID: 6285
stat.c (in the
It should use the newer, subsecond-precision attributes where available. Jane Street Core does this:
Steps to reproduce
The following script always prints a whole number for
Comment author: @xavierleroy
I'm putting this as a feature wish, because it is.
Yes, it would be a nice touch to support subsecond resolution here. I am concerned about the three different ways to access the nanosecond parts: a solid configure-time test is needed here, because Jane Street's code seems to assume either Linux, MacOS X, or BSD, but nothing else.
I am also surprised at the "1000000000.0f" constant in their code. By forcing computation to single precision, rounding errors become much larger (up to 1.1 ns instead of 6e-8 ns for double precision). Not that it matters much, but as a floating-point nit-picker I had to point it out.