diff options
Diffstat (limited to 'test/util')
-rw-r--r-- | test/util/test_util.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/util/test_util.h b/test/util/test_util.h index 373c54f32..876ff58db 100644 --- a/test/util/test_util.h +++ b/test/util/test_util.h @@ -171,6 +171,7 @@ #include <stddef.h> #include <stdlib.h> #include <sys/uio.h> +#include <time.h> #include <unistd.h> #include <algorithm> @@ -271,6 +272,12 @@ 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 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; +} + namespace internal { template <typename Container> |