diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-10-05 11:12:28 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2015-10-05 11:14:42 +0200 |
commit | 59fe8cea208cfa9c253ad7bc00817e2bda14a64a (patch) | |
tree | 71be714a1e58b3e6a00f282cd616ee173b01e825 /kern | |
parent | a7a3a9342bec0dd2d4569b54488c7b01be9aaa40 (diff) |
Fix time going back in Xen case
when backward time correction happens to get bigger than the tick duration.
* kern/mach_clock.c (clock_interrupt): When `tickdelta' is bigger than `usec',
truncate it to `usec-1'.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/mach_clock.c | 12 |
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; |