2 * Copyright (c) 2005 Sendmail, Inc. and its suppliers.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
9 * $Id: time.h,v 1.1 2005/06/14 23:07:19 ca Exp $
15 # include <sm/config.h>
17 # include <sys/time.h>
19 /* should be defined in sys/time.h */
21 # define timersub(tvp, uvp, vvp) \
24 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
25 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
26 if ((vvp)->tv_usec < 0) \
29 (vvp)->tv_usec += 1000000; \
32 #endif /* !timersub */
35 # define timeradd(tvp, uvp, vvp) \
38 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
39 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
40 if ((vvp)->tv_usec >= 1000000) \
43 (vvp)->tv_usec -= 1000000; \
46 #endif /* !timeradd */
49 # define timercmp(tvp, uvp, cmp) \
50 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
51 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
52 ((tvp)->tv_sec cmp (uvp)->tv_sec))
53 #endif /* !timercmp */
56 #endif /* ! SM_TIME_H */