Commit f5a89295 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Thomas Gleixner

time: Use ktime_get_real_seconds() in time syscall

Both get_seconds() and do_gettimeofday() are deprecated. Change the time()
implementation to use the replacement function instead.

Obviously the system call will still overflow in 2038, but this gets us
closer to removing the old helper functions.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: y2038@lists.linaro.org
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Link: https://lkml.kernel.org/r/20180618140811.2998503-2-arnd@arndb.de
parent 9ffc59d5
...@@ -63,7 +63,7 @@ EXPORT_SYMBOL(sys_tz); ...@@ -63,7 +63,7 @@ EXPORT_SYMBOL(sys_tz);
*/ */
SYSCALL_DEFINE1(time, time_t __user *, tloc) SYSCALL_DEFINE1(time, time_t __user *, tloc)
{ {
time_t i = get_seconds(); time_t i = (time_t)ktime_get_real_seconds();
if (tloc) { if (tloc) {
if (put_user(i,tloc)) if (put_user(i,tloc))
...@@ -106,11 +106,9 @@ SYSCALL_DEFINE1(stime, time_t __user *, tptr) ...@@ -106,11 +106,9 @@ SYSCALL_DEFINE1(stime, time_t __user *, tptr)
/* compat_time_t is a 32 bit "long" and needs to get converted. */ /* compat_time_t is a 32 bit "long" and needs to get converted. */
COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc) COMPAT_SYSCALL_DEFINE1(time, compat_time_t __user *, tloc)
{ {
struct timeval tv;
compat_time_t i; compat_time_t i;
do_gettimeofday(&tv); i = (compat_time_t)ktime_get_real_seconds();
i = tv.tv_sec;
if (tloc) { if (tloc) {
if (put_user(i,tloc)) if (put_user(i,tloc))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment