Use timespec throughout.

This commit is contained in:
Todd C. Miller
2004-09-08 15:48:23 +00:00
parent 5748664575
commit 0f056c0d5f
6 changed files with 85 additions and 38 deletions

View File

@@ -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 */