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 $
12 #pragma ident "%Z%%M% %I% %E% SMI"
17 # include <sm/config.h>
19 # include <sys/time.h>
21 /* should be defined in sys/time.h */
23 # define timersub(tvp, uvp, vvp) \
26 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
27 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
28 if ((vvp)->tv_usec < 0) \
31 (vvp)->tv_usec += 1000000; \
34 #endif /* !timersub */
37 # define timeradd(tvp, uvp, vvp) \
40 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
41 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
42 if ((vvp)->tv_usec >= 1000000) \
45 (vvp)->tv_usec -= 1000000; \
48 #endif /* !timeradd */
51 # define timercmp(tvp, uvp, cmp) \
52 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
53 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
54 ((tvp)->tv_sec cmp (uvp)->tv_sec))
55 #endif /* !timercmp */
58 #endif /* ! SM_TIME_H */