From 895c517fb00c5665273bfc2ef5f821d30f718963 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Mon, 18 Oct 2004 09:03:02 -0700 Subject: [PATCH] [PATCH] swsusp: fix process start times after resume Currently, process start times change after swsusp (because they are derived from jiffies and current time, oops). This should fix it. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/i386/kernel/time.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c index a9711fc3500ee..f0da6130044e8 100644 --- a/arch/i386/kernel/time.c +++ b/arch/i386/kernel/time.c @@ -319,7 +319,7 @@ unsigned long get_cmos_time(void) return retval; } -static long clock_cmos_diff; +static long clock_cmos_diff, sleep_start; static int time_suspend(struct sys_device *dev, u32 state) { @@ -328,6 +328,7 @@ static int time_suspend(struct sys_device *dev, u32 state) */ clock_cmos_diff = -get_cmos_time(); clock_cmos_diff += get_seconds(); + sleep_start = get_cmos_time(); return 0; } @@ -335,10 +336,13 @@ static int time_resume(struct sys_device *dev) { unsigned long flags; unsigned long sec = get_cmos_time() + clock_cmos_diff; + unsigned long sleep_length = get_cmos_time() - sleep_start; + write_seqlock_irqsave(&xtime_lock, flags); xtime.tv_sec = sec; xtime.tv_nsec = 0; write_sequnlock_irqrestore(&xtime_lock, flags); + jiffies += sleep_length * HZ; return 0; } -- 2.53.0