]> git.eshelyaron.com Git - emacs.git/commitdiff
* systime.h (EMACS_TIME_CMP): Don't cast time_t values to long.
authorUlrich Mueller <ulm@gentoo.org>
Tue, 14 Aug 2012 06:58:01 +0000 (14:58 +0800)
committerChong Yidong <cyd@gnu.org>
Tue, 14 Aug 2012 06:58:01 +0000 (14:58 +0800)
Fixes: debbugs:11712
src/ChangeLog
src/systime.h

index fbe4f06da58b71ef221179133b41aadbfdfe6e3d..28e053be63f0226b35a2607e0af33fc9c170ec25 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-14  Ulrich Mueller  <ulm@gentoo.org>
+
+       * systime.h (EMACS_TIME_CMP): Don't cast time_t values to long
+       (Bug#11712).
+
 2012-08-13  Eli Zaretskii  <eliz@gnu.org>
 
        * w32menu.c: Include w32heap.h.
index 9e7a1173a20dd06cf2eb23398171465c80e19a6b..e6ebe4689dffccfede0438c2c53b6ad2bdb236ee 100644 (file)
@@ -147,15 +147,12 @@ extern int lisp_time_argument (Lisp_Object, time_t *, int *);
 #endif
 
 /* Compare times T1 and T2.  Value is 0 if T1 and T2 are the same.
-   Value is < 0 if T1 is less than T2.  Value is > 0 otherwise.  (Cast
-   to long is for those platforms where time_t is an unsigned
-   type, and where otherwise T1 will always be grater than T2.)  */
+   Value is < 0 if T1 is less than T2.  Value is > 0 otherwise.  */
 
 #define EMACS_TIME_CMP(T1, T2)                         \
-  ((long)EMACS_SECS (T1) - (long)EMACS_SECS (T2)       \
-   + (EMACS_SECS (T1) == EMACS_SECS (T2)               \
-      ? EMACS_USECS (T1) - EMACS_USECS (T2)            \
-      : 0))
+  (EMACS_SECS (T1) == EMACS_SECS (T2)                  \
+   ? EMACS_USECS (T1) - EMACS_USECS (T2)               \
+   : (EMACS_SECS (T1) < EMACS_SECS (T2) ? -1 : 1))
 
 /* Compare times T1 and T2 for equality, inequality etc.  */