From 35d942444418606e75f2e65aa7708616c5233035 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Sat, 15 Oct 2016 00:29:06 +0000 Subject: runtime: copy runtime package time code from Go 1.7 Fix handling of function values for -fgo-c-header to generate FuncVal*, not simply FuncVal. While we're here change runtime.nanotime to use clock_gettime with CLOCK_MONOTONIC, rather than gettimeofday. This is what the gc library does. It provides nanosecond precision and a monotonic clock. Reviewed-on: https://go-review.googlesource.com/31232 From-SVN: r241197 --- libgo/runtime/go-nanotime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libgo/runtime/go-nanotime.c') diff --git a/libgo/runtime/go-nanotime.c b/libgo/runtime/go-nanotime.c index 7e5e3e0..d221847 100644 --- a/libgo/runtime/go-nanotime.c +++ b/libgo/runtime/go-nanotime.c @@ -14,8 +14,8 @@ int64 runtime_nanotime (void) int64 runtime_nanotime (void) { - struct timeval tv; + struct timespec ts; - gettimeofday (&tv, NULL); - return (int64) tv.tv_sec * 1000000000 + (int64) tv.tv_usec * 1000; + clock_gettime (CLOCK_MONOTONIC, &ts); + return (int64) ts.tv_sec * 1000000000 + (int64) ts.tv_nsec; } -- cgit v1.1