changeset 98503:eaf4c07b3539

(EMACS_TIME_CMP): Cast EMACS_SECS values to `long'.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 04 Oct 2008 13:13:47 +0000
parents 46fbf568b2bd
children 35f3b2c8a07d
files src/systime.h
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/systime.h	Sat Oct 04 10:22:19 2008 +0000
+++ b/src/systime.h	Sat Oct 04 13:13:47 2008 +0000
@@ -150,12 +150,14 @@
 #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.  */
+   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.)  */
 
-#define EMACS_TIME_CMP(T1, T2)			\
-  (EMACS_SECS (T1) - EMACS_SECS (T2)		\
-   + (EMACS_SECS (T1) == EMACS_SECS (T2)	\
-      ? EMACS_USECS (T1) - EMACS_USECS (T2)	\
+#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))
 
 /* Compare times T1 and T2 for equality, inequality etc.  */