]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/time/timekeeping.c
xen: include xen/xen.h for definition of xen_initial_domain()
[karo-tx-linux.git] / kernel / time / timekeeping.c
index e960d824263f1d04aa17c5e256ec56a4cdfa5fd1..49010d822f725b47726742fa7e1b45aad076ef90 100644 (file)
@@ -710,9 +710,10 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
        /* Accumulate raw time */
        raw_nsecs = timekeeper.raw_interval << shift;
        raw_nsecs += raw_time.tv_nsec;
-       while (raw_nsecs >= NSEC_PER_SEC) {
-               raw_nsecs -= NSEC_PER_SEC;
-               raw_time.tv_sec++;
+       if (raw_nsecs >= NSEC_PER_SEC) {
+               u64 raw_secs = raw_nsecs;
+               raw_nsecs = do_div(raw_secs, NSEC_PER_SEC);
+               raw_time.tv_sec += raw_secs;
        }
        raw_time.tv_nsec = raw_nsecs;