]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/x86/kernel/rtc.c
x86: Increase precision of x86_platform.get/set_wallclock()
[mirror_ubuntu-artful-kernel.git] / arch / x86 / kernel / rtc.c
index 198eb201ed3b937862a5acc1bbaccfd414287f33..0aa29394ed6fe8dadda70aeefcf7bb2d3462e6ec 100644 (file)
@@ -38,8 +38,9 @@ EXPORT_SYMBOL(rtc_lock);
  * jump to the next second precisely 500 ms later. Check the Motorola
  * MC146818A or Dallas DS12887 data sheet for details.
  */
-int mach_set_rtc_mmss(unsigned long nowtime)
+int mach_set_rtc_mmss(const struct timespec *now)
 {
+       unsigned long nowtime = now->tv_sec;
        struct rtc_time tm;
        int retval = 0;
 
@@ -58,7 +59,7 @@ int mach_set_rtc_mmss(unsigned long nowtime)
        return retval;
 }
 
-unsigned long mach_get_cmos_time(void)
+void mach_get_cmos_time(struct timespec *now)
 {
        unsigned int status, year, mon, day, hour, min, sec, century = 0;
        unsigned long flags;
@@ -107,7 +108,8 @@ unsigned long mach_get_cmos_time(void)
        } else
                year += CMOS_YEARS_OFFS;
 
-       return mktime(year, mon, day, hour, min, sec);
+       now->tv_sec = mktime(year, mon, day, hour, min, sec);
+       now->tv_nsec = 0;
 }
 
 /* Routines for accessing the CMOS RAM/RTC. */
@@ -135,18 +137,13 @@ EXPORT_SYMBOL(rtc_cmos_write);
 
 int update_persistent_clock(struct timespec now)
 {
-       return x86_platform.set_wallclock(now.tv_sec);
+       return x86_platform.set_wallclock(&now);
 }
 
 /* not static: needed by APM */
 void read_persistent_clock(struct timespec *ts)
 {
-       unsigned long retval;
-
-       retval = x86_platform.get_wallclock();
-
-       ts->tv_sec = retval;
-       ts->tv_nsec = 0;
+       x86_platform.get_wallclock(ts);
 }