]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/clock.c
xnu-2782.1.97.tar.gz
[apple/xnu.git] / osfmk / kern / clock.c
index 740f16340aeb9d43a531fc7694b9958f0ed7e779..1bd578496eebf317883bf4ded4492c61e978fc90 100644 (file)
@@ -33,7 +33,6 @@
 
 #include <mach/mach_types.h>
 
-#include <kern/lock.h>
 #include <kern/spl.h>
 #include <kern/sched_prim.h>
 #include <kern/thread.h>
@@ -409,9 +408,11 @@ clock_set_calendar_microtime(
        clock_sec_t                     sys;
        clock_usec_t            microsys;
        clock_sec_t                     newsecs;
+    clock_usec_t        newmicrosecs;
        spl_t                           s;
 
-       newsecs = (microsecs < 500*USEC_PER_SEC)? secs: secs + 1;
+    newsecs = secs;
+    newmicrosecs = microsecs;
 
        s = splclock();
        clock_lock();
@@ -447,7 +448,7 @@ clock_set_calendar_microtime(
        /*
         *      Set the new value for the platform clock.
         */
-       PESetGMTTimeOfDay(newsecs);
+       PESetUTCTimeOfDay(newsecs, newmicrosecs);
 
        splx(s);
 
@@ -473,10 +474,12 @@ clock_set_calendar_microtime(
 void
 clock_initialize_calendar(void)
 {
-       clock_sec_t                     sys, secs = PEGetGMTTimeOfDay();
-       clock_usec_t            microsys, microsecs = 0;
+       clock_sec_t                     sys, secs;
+       clock_usec_t            microsys, microsecs;
        spl_t                           s;
 
+    PEGetUTCTimeOfDay(&secs, &microsecs);
+
        s = splclock();
        clock_lock();
 
@@ -1023,3 +1026,4 @@ clock_track_calend_nowait(void)
 }
 
 #endif /* CONFIG_DTRACE */
+