|
@@ -144,9 +144,11 @@ SYSCALL_DEFINE2(gettimeofday, struct timeval __user *, tv,
|
|
|
struct timezone __user *, tz)
|
|
|
{
|
|
|
if (likely(tv != NULL)) {
|
|
|
- struct timeval ktv;
|
|
|
- do_gettimeofday(&ktv);
|
|
|
- if (copy_to_user(tv, &ktv, sizeof(ktv)))
|
|
|
+ struct timespec64 ts;
|
|
|
+
|
|
|
+ ktime_get_real_ts64(&ts);
|
|
|
+ if (put_user(ts.tv_sec, &tv->tv_sec) ||
|
|
|
+ put_user(ts.tv_nsec / 1000, &tv->tv_usec))
|
|
|
return -EFAULT;
|
|
|
}
|
|
|
if (unlikely(tz != NULL)) {
|
|
@@ -227,10 +229,11 @@ COMPAT_SYSCALL_DEFINE2(gettimeofday, struct compat_timeval __user *, tv,
|
|
|
struct timezone __user *, tz)
|
|
|
{
|
|
|
if (tv) {
|
|
|
- struct timeval ktv;
|
|
|
+ struct timespec64 ts;
|
|
|
|
|
|
- do_gettimeofday(&ktv);
|
|
|
- if (compat_put_timeval(&ktv, tv))
|
|
|
+ ktime_get_real_ts64(&ts);
|
|
|
+ if (put_user(ts.tv_sec, &tv->tv_sec) ||
|
|
|
+ put_user(ts.tv_nsec / 1000, &tv->tv_usec))
|
|
|
return -EFAULT;
|
|
|
}
|
|
|
if (tz) {
|