Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com User-Agent: Mahogany 0.66.0 'Clio', running under Windows NT 5.1 (build 2600, Service Pack 2) Date: Wed, 20 Oct 2004 11:56:35 +0200 (Romance Daylight Time) From: Xavier Nodet Subject: Re: Problems with cron and hibernation: a solution? To: cygwin AT cygwin DOT com Message-ID: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="71846036-25727-1098266195=:5224" References: In-Reply-To: X-GPGrelay-Relayed: GPGrelay Version 0.93 (Win32) X-IsSubscribed: yes --71846036-25727-1098266195=:5224 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Content-Disposition: INLINE On Wed, 20 Oct 2004 11:03:04 +0200 (Romance Daylight Time) Xavier Nodet wrote: > The attached patch corrects this problem Here is the patch again, un-encoded and un-signed, hoping to better conform to the posting guidelines... -- Xavier Nodet "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin, 1759. --71846036-25727-1098266195=:5224 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; NAME="resume-from-hibernate.patch" Content-Disposition: INLINE; FILENAME="resume-from-hibernate.patch" diff -bu2 ../cron-3.0.1-12-sav/cron.c ./cron.c --- ../cron-3.0.1-12-sav/cron.c 2003-06-10 11:23:10.000000000 +0200 +++ ./cron.c 2004-10-20 10:23:36.528399100 +0200 @@ -119,5 +119,9 @@ #ifdef __CYGWIN__ - { +# if DEBUGGING + if (!DebugFlags) { +# else + if (!dont_fork) { +# endif int fd; if ((fd = open("/dev/null", O_RDWR, 0)) != -1) @@ -264,5 +268,22 @@ getpid(), seconds_to_wait)) seconds_to_wait = (int) sleep((unsigned int) seconds_to_wait); + Debug(DSCH, ("[%d] returning from sleep. Returned value: %d\n", + getpid(), seconds_to_wait)); + + /* if we have to wait for a inordinate amount of time, this means + * that we somehow screwed up the timings. Most probable cause is + * that the clock was reset, or that the computer was put on sleep + * for some time. Let's recompute everything. + */ + if ((seconds_to_wait < 0) || (seconds_to_wait >= 90)) { + Debug(DSCH, ("[%d] Resyncing\n")); + cron_sync(); + seconds_to_wait = (int) (TargetTime - time((time_t*)0)); + Debug(DSCH, ("[%d] TargetTime=%ld, sec-to-wait=%d\n", + getpid(), TargetTime, seconds_to_wait)); } + + } + } --71846036-25727-1098266195=:5224 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --71846036-25727-1098266195=:5224--