emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file-attributes returns wrong info on Windows


From: Eli Zaretskii
Subject: Re: file-attributes returns wrong info on Windows
Date: Fri, 21 Jul 2006 20:38:45 +0300

> Date: Fri, 21 Jul 2006 19:59:58 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden, address@hidden
> 
> So the question is not why 21.3 succeeded whereas 22.0 fails, but
> rather how come the results returned by Emacs are one second off.  I
> will try to look into this, but anyone is invited to beat me to it.

Bug squashed, I think.  The patch is below (I already committed it to
CVS); please see if this solves the problem.


2006-07-21  Eli Zaretskii  <address@hidden>

        * w32.c (convert_time): Use explicit long double constants to
        ensure long double arithmetics is used throughout.

Index: src/w32.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -p -r1.104 -r1.105
--- src/w32.c   14 Jul 2006 14:18:40 -0000      1.104
+++ src/w32.c   21 Jul 2006 17:27:34 -0000      1.105
@@ -2256,16 +2256,17 @@ convert_time (FILETIME ft)
 
       SystemTimeToFileTime (&st, &utc_base_ft);
       utc_base = (long double) utc_base_ft.dwHighDateTime
-       * 4096 * 1024 * 1024 + utc_base_ft.dwLowDateTime;
+       * 4096.0L * 1024.0L * 1024.0L + utc_base_ft.dwLowDateTime;
       init = 1;
     }
 
   if (CompareFileTime (&ft, &utc_base_ft) < 0)
     return 0;
 
-  ret = (long double) ft.dwHighDateTime * 4096 * 1024 * 1024 + 
ft.dwLowDateTime;
+  ret = (long double) ft.dwHighDateTime
+    * 4096.0L * 1024.0L * 1024.0L + ft.dwLowDateTime;
   ret -= utc_base;
-  return (time_t) (ret * 1e-7);
+  return (time_t) (ret * 1e-7L);
 }
 
 void




reply via email to

[Prev in Thread] Current Thread [Next in Thread]