8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / sendmail / include / sm / time.h
blobe141a124e0344858bc0ae1f61f692cff8129ca80
1 /*
2 * Copyright (c) 2005 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
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"
14 #ifndef SM_TIME_H
15 # define SM_TIME_H 1
17 # include <sm/config.h>
19 # include <sys/time.h>
21 /* should be defined in sys/time.h */
22 #ifndef timersub
23 # define timersub(tvp, uvp, vvp) \
24 do \
25 { \
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) \
29 { \
30 (vvp)->tv_sec--; \
31 (vvp)->tv_usec += 1000000; \
32 } \
33 } while (0)
34 #endif /* !timersub */
36 #ifndef timeradd
37 # define timeradd(tvp, uvp, vvp) \
38 do \
39 { \
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) \
43 { \
44 (vvp)->tv_sec++; \
45 (vvp)->tv_usec -= 1000000; \
46 } \
47 } while (0)
48 #endif /* !timeradd */
50 #ifndef timercmp
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 */