From: James H Date: Sat, 13 Jul 2013 20:25:04 +0000 (+0100) Subject: Modify gethrestime to use current_kernel_time() X-Git-Tag: spl-0.6.2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c47efbc7fda5eaed9b60b3767347d9f88553309b;p=spl 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 --- diff --git a/module/spl/spl-time.c b/module/spl/spl-time.c index 8f43b54..20fd0e3 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);