diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-11-21 01:27:44 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-11-21 01:27:44 +0000 |
commit | bbbe8b338b4e31ce315f97562906a013240bd621 (patch) | |
tree | ce90880ae1cd1318680980381769544c90f941c8 /libgo/runtime/go-now.c | |
parent | 23df90322f24ea24b9f0d077be543dc0a71e7f02 (diff) | |
download | gcc-bbbe8b338b4e31ce315f97562906a013240bd621.zip gcc-bbbe8b338b4e31ce315f97562906a013240bd621.tar.gz gcc-bbbe8b338b4e31ce315f97562906a013240bd621.tar.bz2 |
re PR go/66574 (Time is provided in millisecond precision instead of nanoseconds as described in go documentation)
PR go/66574
runtime: Use clock_gettime to get current time.
Fetch the current time in nanoseconds, not microseconds, by using
clock_gettime rather than gettimeofday.
Update golang/go#11222.
Fixes https://gcc.gnu.org/PR66574.
Reviewed-on: https://go-review.googlesource.com/17156
From-SVN: r230694
Diffstat (limited to 'libgo/runtime/go-now.c')
-rw-r--r-- | libgo/runtime/go-now.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libgo/runtime/go-now.c b/libgo/runtime/go-now.c index ea8d070..d24e6ee 100644 --- a/libgo/runtime/go-now.c +++ b/libgo/runtime/go-now.c @@ -13,11 +13,11 @@ struct time_now_ret now() { - struct timeval tv; + struct timespec ts; struct time_now_ret ret; - gettimeofday (&tv, NULL); - ret.sec = tv.tv_sec; - ret.nsec = tv.tv_usec * 1000; + clock_gettime (CLOCK_REALTIME, &ts); + ret.sec = ts.tv_sec; + ret.nsec = ts.tv_nsec; return ret; } |