From c47efbc7fda5eaed9b60b3767347d9f88553309b Mon Sep 17 00:00:00 2001 From: James H Date: Sat, 13 Jul 2013 21:25:04 +0100 Subject: [PATCH] Modify gethrestime to use current_kernel_time() This allows us to get nanosecond resolution. It also means we use the same time source as utimensat(now) etc. Signed-off-by: Richard Yao Signed-off-by: Brian Behlendorf Closes #255 --- module/spl/spl-time.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/module/spl/spl-time.c b/module/spl/spl-time.c index 8f43b54cd4..20fd0e3e7e 100644 --- a/module/spl/spl-time.c +++ b/module/spl/spl-time.c @@ -40,11 +40,10 @@ extern unsigned long long monotonic_clock(void); void __gethrestime(timestruc_t *ts) { - struct timeval tv; + struct timespec tspec = current_kernel_time(); - do_gettimeofday(&tv); - ts->tv_sec = tv.tv_sec; - ts->tv_nsec = tv.tv_usec * NSEC_PER_USEC; + ts->tv_sec = tspec.tv_sec; + ts->tv_nsec = tspec.tv_nsec; } EXPORT_SYMBOL(__gethrestime);