delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/05/13/18:20:07

From: noer AT cygnus DOT com (Geoffrey Noer)
Subject: Re: Times.cc bug
13 May 1998 18:20:07 -0700 :
Message-ID: <199805140050.RAA00596.cygnus.cygwin32.developers@skaro.cygnus.com>
References: <01BD6940 DOT 22218F10 AT drs>
To: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Cc: cygwin32-developers AT cygnus DOT com

Sergey Okhapkin wrote:
> 
> Sometimes stat() call returns incorrect file modification time (one
> second less) on fat partitions due to roundup error.
> 
> D:\usr\src\cygnus\cdk\winsup>diff -upr times.cc.orig times.cc
> --- times.cc.orig       Wed Apr 15 10:37:09 1998
> +++ times.cc    Thu Apr 16 13:50:35 1998
> @@ -200,6 +200,7 @@ to_time_t (FILETIME *ptr)
> 
>    long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned)ptr->dwLowDateTime);
>    x -= FACTOR;                 /* number of 100ns between 1601 and 1970 */
> +  x += NSPERSEC/2;             /* avoid round up error */
>    x /= NSPERSEC;               /* number of 100ns in a second */
>    return x;
>  }

I committed this patch.

-- 
Geoffrey Noer
noer AT cygnus DOT com

- Raw text -


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