Mercurial > emacs
changeset 26641:7947290d87b6
(EMACS_TIME_CMP, EMACS_TIME_EQ, EMACS_TIME_NE)
(EMACS_TIME_GT, EMACS_TIME_GE, EMACS_TIME_LT,EMACS_TIME_LE): New
macros.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Sun, 28 Nov 1999 20:11:56 +0000 |
parents | f95236e53857 |
children | 466622719e96 |
files | src/systime.h |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/systime.h Sun Nov 28 18:51:06 1999 +0000 +++ b/src/systime.h Sun Nov 28 20:11:56 1999 +0000 @@ -147,3 +147,22 @@ (EMACS_SET_SECS (time, secs), EMACS_SET_USECS (time, usecs)) extern int set_file_times (); + +/* 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. */ + +#define EMACS_TIME_CMP(T1, T2) \ + (EMACS_SECS (T1) - 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. */ + +#define EMACS_TIME_EQ(T1,T2) (EMACS_TIME_CMP (T1, T2) == 0) +#define EMACS_TIME_NE(T1,T2) (EMACS_TIME_CMP (T1, T2) != 0) +#define EMACS_TIME_GT(T1,T2) (EMACS_TIME_CMP (T1, T2) > 0) +#define EMACS_TIME_GE(T1,T2) (EMACS_TIME_CMP (T1, T2) >= 0) +#define EMACS_TIME_LT(T1,T2) (EMACS_TIME_CMP (T1, T2) < 0) +#define EMACS_TIME_LE(T1,T2) (EMACS_TIME_CMP (T1, T2) <= 0) +