]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/scheduler.c
Add new files
[bacula/bacula] / bacula / src / dird / scheduler.c
index 3502d79acd6e0328df4cc2eb72293c7efafb549a..8ec070d77a0e9c34fcaed22b0be979c19df6604a 100644 (file)
@@ -95,7 +95,7 @@ JCR *wait_for_next_job(char *job_to_run)
       if (rem_runjobs > 0) {
         break;
       }
-      sleep(60);
+      bmicrosleep(60, 0);            /* recheck once per minute */
    }
 
    /* 
@@ -118,7 +118,7 @@ JCR *wait_for_next_job(char *job_to_run)
 #ifdef xxxx_debug
       if (runtime > 0) {
         bstrftime(dt, sizeof(dt), runjobs[i].runtime);  
-         Dmsg2(000, "    %s run %s\n", dt, runjobs[i].job->hdr.name);
+         Dmsg2(100, "    %s run %s\n", dt, runjobs[i].job->hdr.name);
       }
 #endif
    }
@@ -128,14 +128,13 @@ JCR *wait_for_next_job(char *job_to_run)
 
    /* Now wait for the time to run the job */
    for (;;) {
-      int twait;
-      time(&now);
+      time_t twait;
+      now = time(NULL);
       twait = nexttime - now;
-      if (twait <= 0)                /* time to run it */
+      if (twait <= 0) {              /* time to run it */
         break;
-      if (twait > 1)                 /* sleep max 20 seconds */
-        twait--;
-      sleep(twait);
+      }
+      bmicrosleep(twait, 0);
    }
    run = runjobs[jobindex].run;
    job = runjobs[jobindex].job;