summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kern/mach_clock.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index dba2320..c6e2d9d 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -232,8 +232,16 @@ void clock_interrupt(
int delta;
if (timedelta < 0) {
- delta = usec - tickdelta;
- timedelta += tickdelta;
+ if (usec > tickdelta) {
+ delta = usec - tickdelta;
+ timedelta += tickdelta;
+ } else {
+ /* Not enough time has passed, defer overflowing
+ * correction for later, keep only one microsecond
+ * delta */
+ delta = 1;
+ timedelta += usec - 1;
+ }
}
else {
delta = usec + tickdelta;