diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-07-06 08:23:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-06 08:23:39 -0400 |
commit | 68083e05d72d94f347293d8cc0067050ba904bfa (patch) | |
tree | 842e71365bd90866be7add181661a4039d891564 /arch/um/os-Linux/time.c | |
parent | 7baac8b91f9871ba8cb09af84de4ae1d86d07812 (diff) | |
parent | b7279469d66b55119784b8b9529c99c1955fe747 (diff) |
Merge commit 'v2.6.26-rc9' into cpus4096
Diffstat (limited to 'arch/um/os-Linux/time.c')
-rw-r--r-- | arch/um/os-Linux/time.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c index bee98f466d66..dec5678fc17f 100644 --- a/arch/um/os-Linux/time.c +++ b/arch/um/os-Linux/time.c | |||
@@ -106,6 +106,10 @@ static void deliver_alarm(void) | |||
106 | unsigned long long this_tick = os_nsecs(); | 106 | unsigned long long this_tick = os_nsecs(); |
107 | int one_tick = UM_NSEC_PER_SEC / UM_HZ; | 107 | int one_tick = UM_NSEC_PER_SEC / UM_HZ; |
108 | 108 | ||
109 | /* Protection against the host's time going backwards */ | ||
110 | if ((last_tick != 0) && (this_tick < last_tick)) | ||
111 | this_tick = last_tick; | ||
112 | |||
109 | if (last_tick == 0) | 113 | if (last_tick == 0) |
110 | last_tick = this_tick - one_tick; | 114 | last_tick = this_tick - one_tick; |
111 | 115 | ||
@@ -148,6 +152,9 @@ static int after_sleep_interval(struct timespec *ts) | |||
148 | start_usecs = usec; | 152 | start_usecs = usec; |
149 | 153 | ||
150 | start_usecs -= skew / UM_NSEC_PER_USEC; | 154 | start_usecs -= skew / UM_NSEC_PER_USEC; |
155 | if (start_usecs < 0) | ||
156 | start_usecs = 0; | ||
157 | |||
151 | tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, | 158 | tv = ((struct timeval) { .tv_sec = start_usecs / UM_USEC_PER_SEC, |
152 | .tv_usec = start_usecs % UM_USEC_PER_SEC }); | 159 | .tv_usec = start_usecs % UM_USEC_PER_SEC }); |
153 | interval = ((struct itimerval) { { 0, usec }, tv }); | 160 | interval = ((struct itimerval) { { 0, usec }, tv }); |