Use timespec throughout.
This commit is contained in:
18
compat.h
18
compat.h
@@ -239,4 +239,22 @@ struct timespec {
|
||||
};
|
||||
#endif /* !HAVE_TIMESPEC */
|
||||
|
||||
#ifndef timespecclear
|
||||
# define timespecclear(ts) (ts)->tv_sec = (ts)->tv_nsec = 0
|
||||
#endif
|
||||
#ifndef timespecisset
|
||||
# define timespecisset(ts) ((ts)->tv_sec || (ts)->tv_nsec)
|
||||
#endif
|
||||
#ifndef timespecsub
|
||||
# define timespecsub(minuend, subrahend, difference) \
|
||||
do { \
|
||||
(difference)->tv_sec = (minuend)->tv_sec - (subrahend)->tv_sec; \
|
||||
(difference)->tv_nsec = (minuend)->tv_nsec - (subrahend)->tv_nsec; \
|
||||
if ((difference)->tv_nsec < 0) { \
|
||||
(difference)->tv_nsec += 1000000000L; \
|
||||
(difference)->tv_sec--; \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif /* _SUDO_COMPAT_H */
|
||||
|
Reference in New Issue
Block a user