diff options
| author | George Anzinger <george@mvista.com> | 2005-03-28 03:59:49 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-28 03:59:49 -0800 |
| commit | 4733474d20cbe84f8bd83fd38aef645b6eb11f57 (patch) | |
| tree | 89d7843f973854c09715ed90caf693185d290eaf /kernel | |
| parent | 6fb021f5831dbbbc4e2443efc3511cc23692e6fc (diff) | |
[PATCH] Fix POSIX timers expiring before their scheduled time
This patch fixes the problem of POSIX timers returning too early due to not
accounting for the time starting mid jiffie.
Signed-off-by: George Anzinger <george@mvista.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/posix-timers.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 4e2904586925..fd316c272260 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c @@ -938,6 +938,10 @@ static int adjust_abs_time(struct k_clock *clock, struct timespec *tp, */ if (oc.tv_sec < 0) oc.tv_sec = oc.tv_nsec = 0; + + if (oc.tv_sec | oc.tv_nsec) + set_normalized_timespec(&oc, oc.tv_sec, + oc.tv_nsec + clock->res); tstojiffie(&oc, clock->res, exp); /* @@ -1507,7 +1511,6 @@ static int common_nsleep(clockid_t which_clock, if (abs || !rq_time) { adjust_abs_time(&posix_clocks[which_clock], &t, abs, &rq_time, &dum); - rq_time += (t.tv_sec || t.tv_nsec); } left = rq_time - get_jiffies_64(); |
