commit 969a02493ba6c440ba7700a2090b24cbc2bf5a38 from: Omar Polo date: Wed Aug 16 10:30:51 2023 UTC add portability shim for timespecsub commit - 27bf07a4f9592ac26e235e10f3a6eb24101aaa80 commit + 969a02493ba6c440ba7700a2090b24cbc2bf5a38 blob - fb082239dfb4bc5d58976a3c4c925d3ef9048873 blob + 916489e295a1ca4238dc0c80a776a3d0e7e2ab7a --- ev.c +++ ev.c @@ -36,6 +36,19 @@ #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;