Sophie

Sophie

distrib > Mandriva > 2007.1 > x86_64 > media > main-updates-src > by-pkgid > b6defacb3e45f6c031a053c9af126cf0 > files > 4

vixie-cron-4.1-9.1mdv2007.1.src.rpm

--- vixie-cron-3.0.1/cron.c.time	Fri Jan 19 11:49:24 2001
+++ vixie-cron-3.0.1/cron.c	Fri Jan 19 11:49:26 2001
@@ -113,8 +113,8 @@
 	database.mtime = (time_t) 0;
 	load_database(&database);
 	run_reboot_jobs(&database);
-	cron_sync();
 	while (TRUE) {
+		cron_sync();
 # if DEBUGGING
 		if (!(DebugFlags & DTEST))
 # endif /*DEBUGGING*/
@@ -125,10 +125,6 @@
 		/* do this iteration
 		 */
 		cron_tick(&database);
-
-		/* sleep 1 minute
-		 */
-		TargetTime += 60;
 	}
 }
 
@@ -205,6 +201,10 @@
  * could then get it to execute a given minute's jobs more than once.
  * instead we have the chance of missing a minute's jobs completely, but
  * that's something sysadmin's know to expect what with crashing computers..
+ * 
+ * Patch from <pererik@onedial.se>:
+ *   Do cron_sync() before each cron_sleep(), to handle changes to the system
+ *   time.
  */
 static void
 cron_sync() {