Hi Christian,

some time ago I have downloaded Björn Danielsson patch and I use it
systematically in Debian - very useful.

In the attachments please find the original patch from the page mentioned
by Axel and a new version, recently updated by me to work with wheezy.

Please consider including this patch in the Debian cron.

Best wishes,
Piotr
-- 
/**************************************************************************
 Dr Piotr A. Dybczynski, Astronomical Observatory, A.Mickiewicz University 
 homepage: http://apollo.astro.amu.edu.pl/PAD     e-mail: dy...@amu.edu.pl
********************************************************************PAD***/
*** entry.c~    Wed Nov 26 18:37:08 2003
--- entry.c     Wed Nov 26 18:46:17 2003
***************
*** 310,313 ****
--- 310,317 ----
        }
  #endif
+       {
+         char *utc = env_get("CRONTAB_UTC", e->envp);
+         if (utc && atoi(utc)) { e->flags |= CRONTAB_UTC; }
+       }
  
        Debug(DPARS, ("load_entry()...about to parse command\n"))
*** cron.h~     Wed Nov 26 18:37:08 2003
--- cron.h      Wed Nov 26 18:47:09 2003
***************
*** 167,170 ****
--- 167,171 ----
  #define MIN_STAR      0x08
  #define HR_STAR               0x10
+ #define CRONTAB_UTC   0x4000
  } entry;
  
*** cron.c~     Wed Nov 26 18:37:08 2003
--- cron.c      Wed Nov 26 19:00:52 2003
***************
*** 308,312 ****
--- 308,314 ----
        register user           *u;
        register entry          *e;
+       register int            utcflag = 0;
  
+  again:
        /* make 0-based values out of these so we can use them as indicies
         */
***************
*** 329,332 ****
--- 331,335 ----
        for (u = db->head;  u != NULL;  u = u->next) {
                for (e = u->crontab;  e != NULL;  e = e->next) {
+                 if ((e->flags & CRONTAB_UTC) == utcflag) {
                        Debug(DSCH|DEXT, ("user [%s:%d:%d:...] cmd=\"%s\"\n",
                            env_get("LOGNAME", e->envp),
***************
*** 342,346 ****
--- 345,358 ----
                                        job_add(e, u);
                        }
+                 }
                }
+       }
+       /* run the above code once again, but now with utcflag non-zero and
+        * tm set to GMT instead of local time.
+        */
+       if (!utcflag) {
+         utcflag = CRONTAB_UTC;
+         tm = gmtime(&virtualSecond);
+         goto again;
        }
  }
*** entry.c~    Wed Nov 26 18:37:08 2003
--- entry.c     Wed Nov 26 18:46:17 2003
***************
*** 310,313 ****
--- 310,317 ----
        }
  #endif
+       {
+         char *utc = env_get("CRONTAB_UTC", e->envp);
+         if (utc && atoi(utc)) { e->flags |= CRONTAB_UTC; }
+       }
  
        Debug(DPARS, ("load_entry()...about to parse command\n"))
*** cron.h~     Wed Nov 26 18:37:08 2003
--- cron.h      Wed Nov 26 18:47:09 2003
***************
*** 187,190 ****
--- 187,191 ----
  #define MIN_STAR      0x08
  #define HR_STAR               0x10
+ #define CRONTAB_UTC   0x4000
  } entry;
  
*** cron.c~     Wed Nov 26 18:37:08 2003
--- cron.c      Wed Nov 26 19:00:52 2003
***************
*** 331,335 ****
--- 331,337 ----
        register user           *u;
        register entry          *e;
+       register int            utcflag = 0;
  
+  again:
        /* make 0-based values out of these so we can use them as indicies
         */
***************
*** 352,355 ****
--- 354,358 ----
        for (u = db->head;  u != NULL;  u = u->next) {
                for (e = u->crontab;  e != NULL;  e = e->next) {
+                 if ((e->flags & CRONTAB_UTC) == utcflag) {
                        Debug(DSCH|DEXT, ("user [%s:%d:%d:...] cmd=\"%s\"\n",
                            env_get("LOGNAME", e->envp),
***************
*** 365,369 ****
--- 368,381 ----
                                        job_add(e, u);
                        }
+                 }
                }
+       }
+       /* run the above code once again, but now with utcflag non-zero and
+        * tm set to GMT instead of local time.
+        */
+       if (!utcflag) {
+         utcflag = CRONTAB_UTC;
+         tm = gmtime(&virtualSecond);
+         goto again;
        }
  }

Reply via email to