delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/10/08/17:24:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 8 Oct 2009 17:24:25 -0400
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: utimensat UTIME_NOW granularity bug
Message-ID: <20091008212425.GB2068@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20091008T221131-292 AT post DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <loom.20091008T221131-292@post.gmane.org>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Thu, Oct 08, 2009 at 08:27:42PM +0000, Eric Blake wrote:
>The gnulib test for utimensat found a bug in utimensat: it truncates time too 
>much, and has the result of making time appear to flow backwards.
>
>This sample code sequence shows the problem (when run at speed; of course 
>single stepping this introduces delays and masks the problem):
>
>close (creat ("file", 0600));
>stat ("file", &st1);
>utimensat (AT_FDCWD, "file", NULL, 0);
>stat ("file", &st1);
>
>(gdb) p st1.st_mtim 
>$3 = {tv_sec = 1255024956, tv_nsec = 526817600}
>(gdb) p st2.st_mtim
>$4 = {tv_sec = 1255024956, tv_nsec = 526817000}
>
>Windows expresses time as a fraction, rounded to a quanta with significant 
>digits out to a 10th of a microsecond (even though the quanta at which time 
>observably advances is much larger than that), but utimensat is currently 
>rounding to the nearest microsecond.  The result is that the timestamp set 
>during Windows events (such as close) is recorded with more resolution than 
>what happens for utimensat, such that consecutive instructions appear to run 
>out of order.
>
>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.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019