diff options
author | Jing Chen <chjing@google.com> | 2021-04-29 15:19:22 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-04-29 15:22:09 -0700 |
commit | eefa00f4aecc7c72a1866357fbd1bbb58aa6fc5e (patch) | |
tree | 53bbc21d6863aa69230cd545e7ffe396687207a2 /test/util | |
parent | 669523f7d225006d1fbc7c6a2b347736019908e2 (diff) |
Implement epoll_pwait2.
PiperOrigin-RevId: 371216407
Diffstat (limited to 'test/util')
-rw-r--r-- | test/util/test_util.h | 9 |
1 files changed, 7 insertions, 2 deletions
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<std::vector<OpenFd>> GetOpenFDs(); // Returns the number of hard links to a path. PosixErrorOr<uint64_t> 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 { |