delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/04/16/03:23:04

From: sos AT prospect DOT com DOT ru (Sergey Okhapkin)
Subject: Times.cc bug
16 Apr 1998 03:23:04 -0700 :
Message-ID: <01BD6940.22218F10.cygnus.cygwin32.developers@drs>
To: "'cygwin32-developers AT cygnus DOT com'" <cygwin32-developers AT cygnus DOT com>

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;
 }

-- 
Sergey Okhapkin, http://www.lexa.ru/sos
Moscow, Russia.

- Raw text -


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