Commit 5089ea15 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Alexandre Belloni

rtc: use ktime_get_real_ts64() instead of getnstimeofday64()

getnstimeofday64() is just a wrapper around the ktime accessor, so
we should use that directly.

I considered using ktime_get_boottime_ts64() (to avoid leap second
problems) or ktime_get_real_seconds() (to simplify the calculation,
but in the end concluded that the existing interface is probably
the most appropriate in this case.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent fed0b1bd
...@@ -68,7 +68,7 @@ static int rtc_suspend(struct device *dev) ...@@ -68,7 +68,7 @@ static int rtc_suspend(struct device *dev)
return 0; return 0;
} }
getnstimeofday64(&old_system); ktime_get_real_ts64(&old_system);
old_rtc.tv_sec = rtc_tm_to_time64(&tm); old_rtc.tv_sec = rtc_tm_to_time64(&tm);
...@@ -110,7 +110,7 @@ static int rtc_resume(struct device *dev) ...@@ -110,7 +110,7 @@ static int rtc_resume(struct device *dev)
return 0; return 0;
/* snapshot the current rtc and system time at resume */ /* snapshot the current rtc and system time at resume */
getnstimeofday64(&new_system); ktime_get_real_ts64(&new_system);
err = rtc_read_time(rtc, &tm); err = rtc_read_time(rtc, &tm);
if (err < 0) { if (err < 0) {
pr_debug("%s: fail to read rtc time\n", dev_name(&rtc->dev)); pr_debug("%s: fail to read rtc time\n", dev_name(&rtc->dev));
......
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