From d0f0dd222e39f79d94c4dcf37362ca9ed861a93d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 13 Feb 2017 10:39:49 -0600 Subject: [PATCH] NFS: Use clock_gettime() instead of deprecated gettimeofday() --- fs/nfs/nfs_vfsops.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/nfs/nfs_vfsops.c b/fs/nfs/nfs_vfsops.c index 9cf74807e08..a11495084f6 100644 --- a/fs/nfs/nfs_vfsops.c +++ b/fs/nfs/nfs_vfsops.c @@ -51,7 +51,6 @@ #include #include #include -#include #include #include @@ -1211,7 +1210,7 @@ static int nfs_fstat(FAR const struct file *filep, FAR struct stat *buf) FAR struct nfsmount *nmp; FAR struct nfsnode *np; struct nfs_statinfo_s info; - struct timeval tv; + struct timespec ts; int error; int ret; @@ -1251,15 +1250,15 @@ static int nfs_fstat(FAR const struct file *filep, FAR struct stat *buf) /* Use the current time for the time of last access. */ - ret = gettimeofday(&tv, NULL); + ret = clock_gettime(CLOCK_REALTIME, &ts); if (ret < 0) { error = -get_errno(); - ferr("ERROR: gettimeofday failed: %d\n", error); + ferr("ERROR: clock_gettime failed: %d\n", error); goto errout_with_semaphore; } - info.ns_atime = tv.tv_sec; + info.ns_atime = ts.tv_sec; /* Then update the stat buffer with this information */