utimensat UTIME_NOW granularity bug

Eric Blake ebb9@byu.net
Fri Oct 9 03:24:00 GMT 2009

Hash: SHA1

According to Christopher Faylor on 10/8/2009 3:24 PM:
>> I think we need to implement a companion to systime(), which returns the system 
>> time without any truncation, so that the function clock_gettime(CLOCK_REALTIME) 
>> can report time with resolution to the 10th of a microsecond rather than to 
>> plain microseconds.  Then utimensat needs to use clock_gettime rather than 
>> gettimeofday, so that it is not needlessly truncating the 10th of microsecond 
>> resolution available from Windows.
> Why not send these type of musings to the cygwin-developers list?  It really
> is more appropriate for this type of discussion.

Sorry about the wrong list.  At any rate, what about this patch?

2009-10-08  Eric Blake  <ebb9@byu.net>

	* 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 (NSPERMS, MILLION, BILLION): New helper macros; use
	throughout to avoid long runs of 0.
	(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.
	* fhandler_disk_file.cc (utimens_fs): Get current time before
	opening handle, using higher resolution.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygwin.patch30
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20091009/a3433121/attachment.ksh>

More information about the Cygwin-patches mailing list