commit - b3c3ccdca6c2c876f67c4b596c020fbef36f30b1
commit + 31e12e6728b328d0d6ae7401d7ca4200cbfd3700
blob - 82070bb5da8160a3b66e397221721e0fbbb00bdb
blob + 5f9fa7a27ccf457e6b6ff37f54fc4f4eaa16ebd7
--- compats.c
+++ compats.c
return (ll);
}
#endif /* !HAVE_STRTONUM */
+#if !HAVE_TIMESPECSUB
+#include <sys/time.h>
+void
+timespecsub(struct timespec *a, struct timespec *b, struct timespec *ret)
+{
+ ret->tv_sec = a->tv_sec - b->tv_sec;
+ ret->tv_nsec = a->tv_nsec - b->tv_nsec;
+ if (ret->tv_nsec < 0) {
+ ret->tv_sec--;
+ ret->tv_nsec += 1000000000L;
+ }
+}
+#endif /* !HAVE_TIMESPECSUB */
blob - bcd5e1d7fb5901ecc7eed946c87f0fdcc550dd9c
blob + c9ff87fb3bdcf35acdb6b527cd7cf3940b0542fd
--- configure
+++ configure
HAVE_SYS_FILE=
HAVE_SYS_QUEUE=
HAVE_SYSTRACE=0
+HAVE_TIMESPECSUB=
HAVE_UNVEIL=
HAVE___PROGNAME=
runtest strtonum STRTONUM || true
runtest sys_queue SYS_QUEUE || true
runtest sys_file SYS_FILE || true
+runtest timespecsub TIMESPECSUB || true
runtest unveil UNVEIL || true
runtest __progname __PROGNAME || true
#define HAVE_SYS_FILE ${HAVE_SYS_FILE}
#define HAVE_SYS_QUEUE ${HAVE_SYS_QUEUE}
#define HAVE_SYSTRACE ${HAVE_SYSTRACE}
+#define HAVE_TIMESPECSUB ${HAVE_TIMESPECSUB}
#define HAVE_UNVEIL ${HAVE_UNVEIL}
#define HAVE___PROGNAME ${HAVE___PROGNAME}
extern int BSDopterr, BSDoptind, BSDoptopt, BSDoptreset;
extern char *BSDoptarg;
+#endif
+
+#if !HAVE_TIMESPECSUB
+struct timespec;
+void timespecsub(struct timespec *, struct timespec *, struct timespec *);
#endif
#endif /*!OCONFIGURE_CONFIG_H*/
blob - 916489e295a1ca4238dc0c80a776a3d0e7e2ab7a
blob + fb082239dfb4bc5d58976a3c4c925d3ef9048873
--- ev.c
+++ ev.c
#include "ev.h"
-#ifndef timespecsub
-static void
-timespecsub(struct timespec *a, struct timespec *b, struct timespec *ret)
-{
- ret->tv_sec = a->tv_sec - b->tv_sec;
- ret->tv_nsec = a->tv_nsec - b->tv_nsec;
- if (ret->tv_nsec < 0) {
- ret->tv_sec--;
- ret->tv_nsec += 1000000000L;
- }
-}
-#endif
-
struct evcb {
void (*cb)(int, int, void *);
void *udata;
blob - e70236d7969b35c1c6d99c3eb54b379c8120c239
blob + 54ade2b800a80f14edff8c860db21d17cbe84228
--- tests.c
+++ tests.c
}
#endif /* TEST_SYS_TREE */
+#if TEST_TIMESPECSUB
+#include <sys/time.h>
+
+int
+main(void)
+{
+ struct timespec a = {0, 0}, b = {0, 0}, c;
+
+ timespecsub(&a, &b, &c);
+ return c.tv_sec;
+}
+#endif /* TEST_TIMESPECSUB */
#if TEST_UNVEIL
#include <unistd.h>