Improve clock_gettime and utimensat resolution.

* hires.h (hires_ms): Change initime_us to initime_ns, with 10x
more resolution.
(hires_ms::nsecs): New prototype.
(hires_ms::usecs, hires_ms::msecs, hires_ms::uptime): Adjust.
* times.cc (systime_ns): New helper function.
(hires_ms::prime): Use it for more resolution.
(hires_ms::usecs): Change to...
(hires_ms::nsecs): ...with more resolution.
(clock_gettime): Use more resolution.
(systime): Rewrite in terms of systime_ns.
(timespec_to_filetime): Rewrite math to reflect true operation.
* fhandler_disk_file.cc (utimens_fs): Use higher resolution.
This commit is contained in:
Eric Blake
2009-10-13 02:26:33 +00:00
parent 2fc007681e
commit b8a35083c6
4 changed files with 39 additions and 19 deletions

View File

@@ -1306,8 +1306,7 @@ fhandler_base::utimens_fs (const struct timespec *tvp)
closeit = true;
}
gettimeofday (reinterpret_cast<struct timeval *> (&timeofday), 0);
timeofday.tv_nsec *= 1000;
clock_gettime (CLOCK_REALTIME, &timeofday);
if (!tvp)
tmp[1] = tmp[0] = timeofday;
else