From eefa00f4aecc7c72a1866357fbd1bbb58aa6fc5e Mon Sep 17 00:00:00 2001 From: Jing Chen Date: Thu, 29 Apr 2021 15:19:22 -0700 Subject: Implement epoll_pwait2. PiperOrigin-RevId: 371216407 --- test/util/test_util.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/util') diff --git a/test/util/test_util.h b/test/util/test_util.h index 876ff58db..bcbb388ed 100644 --- a/test/util/test_util.h +++ b/test/util/test_util.h @@ -272,10 +272,15 @@ PosixErrorOr> GetOpenFDs(); // Returns the number of hard links to a path. PosixErrorOr Links(const std::string& path); +inline uint64_t ns_elapsed(const struct timespec& begin, + const struct timespec& end) { + return (end.tv_sec - begin.tv_sec) * 1000000000 + + (end.tv_nsec - begin.tv_nsec); +} + inline uint64_t ms_elapsed(const struct timespec& begin, const struct timespec& end) { - return (end.tv_sec - begin.tv_sec) * 1000 + - (end.tv_nsec - begin.tv_nsec) / 1000000; + return ns_elapsed(begin, end) / 1000000; } namespace internal { -- cgit v1.2.3