On Wed, 20 Oct 2004 11:03:04 +0200 (Romance Daylight Time) Xavier Nodet <[EMAIL 
PROTECTED]> 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.
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));
        }
+
+       }
+
 }
 

--
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/

Reply via email to