From 4776195cdf6e787c42c3e1c7bafaab1e9bc1f419 Mon Sep 17 00:00:00 2001 From: John Barboza Date: Tue, 27 Jun 2017 02:16:42 -0400 Subject: [PATCH] zos: use stckf builtin for high-res timer Instead of gettimeofday which is too heavy for a fast monotonic clock implementation. PR-URL: https://github.com/libuv/libuv/pull/1394 Reviewed-By: Ben Noordhuis --- src/unix/os390.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/unix/os390.c b/src/unix/os390.c index 2ba5abf3..de7df911 100644 --- a/src/unix/os390.c +++ b/src/unix/os390.c @@ -25,6 +25,7 @@ #include #include #include +#include #if defined(__clang__) #include "csrsic.h" #else @@ -118,9 +119,10 @@ void uv__platform_loop_delete(uv_loop_t* loop) { uint64_t uv__hrtime(uv_clocktype_t type) { - struct timeval time; - gettimeofday(&time, NULL); - return (uint64_t) time.tv_sec * 1e9 + time.tv_usec * 1e3; + unsigned long long timestamp; + __stckf(×tamp); + /* Convert to nanoseconds */ + return timestamp / 10; }