diff options
author | babkin <babkin@FreeBSD.org> | 2001-01-22 01:54:51 +0000 |
---|---|---|
committer | babkin <babkin@FreeBSD.org> | 2001-01-22 01:54:51 +0000 |
commit | 2a8a2cb55a926c0a387a26af2e4561aeeb6910a5 (patch) | |
tree | 1739d67220d5cc8021e8e8a73b21d1eccf18827a | |
parent | 0b427e62c3df33d059a3f6d0208a9fc6b7251f3c (diff) | |
download | FreeBSD-src-2a8a2cb55a926c0a387a26af2e4561aeeb6910a5.zip FreeBSD-src-2a8a2cb55a926c0a387a26af2e4561aeeb6910a5.tar.gz |
Made the special handling of the daylight time switches optional,
enabled by the option "-s" (for dSt). This returned the default behavior
to its original form.
The new option name is not "-d" because that would cause associations with
"debug" and cron already has "-x" for debugging, so this would cause
confusion.
-rw-r--r-- | usr.sbin/cron/cron/cron.8 | 12 | ||||
-rw-r--r-- | usr.sbin/cron/cron/cron.c | 13 |
2 files changed, 19 insertions, 6 deletions
diff --git a/usr.sbin/cron/cron/cron.8 b/usr.sbin/cron/cron/cron.8 index 45f2aa0..1357533 100644 --- a/usr.sbin/cron/cron/cron.8 +++ b/usr.sbin/cron/cron/cron.8 @@ -25,6 +25,7 @@ .Nd daemon to execute scheduled commands (Vixie Cron) .Sh SYNOPSIS .Nm +.Op Fl s .Op Fl x Ar debugflag Ns Op ,... .Sh DESCRIPTION .Nm Cron @@ -69,10 +70,16 @@ need not be restarted whenever a crontab file is modified. Note that the command updates the modtime of the spool directory whenever it changes a crontab. .Pp +Available options: +.Bl -tag -width Ds +.It Fl s +Enable special handling of the switching between the standard time and +daylight saving time. +.Pp If the time zone has daylight saving time which differs by one hour from the standard time and the switch to and from daylight saving time occurs -at :00 minutes (as in most of Asia, Europe and North America) then these -time switches are handled specially by +at :00 minutes (as in most of the world with very few exceptions) then these +time switches would be handled specially by .Nm cron . The time zones with other variations of daylight saving time (such as with 30 minutes difference or switched at :30 minutes etc.) do not have such @@ -95,6 +102,7 @@ during the switch to daylight saving time, such jobs are executed during the next hour at the first minute that is specified for them in .Xr crontab 5 . +.El .Sh SEE ALSO .Xr crontab 1 , .Xr crontab 5 diff --git a/usr.sbin/cron/cron/cron.c b/usr.sbin/cron/cron/cron.c index 8c4d737..f4b990f 100644 --- a/usr.sbin/cron/cron/cron.c +++ b/usr.sbin/cron/cron/cron.c @@ -45,12 +45,13 @@ static void usage __P((void)), parse_args __P((int c, char *v[])); static time_t last_time = 0; +static int dst_enabled = 0; static void usage() { char **dflags; - fprintf(stderr, "usage: cron [-x debugflag[,...]]\n"); + fprintf(stderr, "usage: cron [-s] [-x debugflag[,...]]\n"); fprintf(stderr, "\ndebugflags: "); for(dflags = DebugFlagNames; *dflags; dflags++) { @@ -186,8 +187,9 @@ cron_tick(db) * we support only change by +-1 hour happening at :00 minutes, * those living in more strange timezones are out of luck */ - if (last_time != 0 && tm->tm_isdst != lasttm.tm_isdst - && TargetTime > last_time /* exclude stepping back */) { + if (dst_enabled && last_time != 0 + && TargetTime > last_time /* exclude stepping back */ + && tm->tm_isdst != lasttm.tm_isdst ) { int prevhr, nexthr, runtime; int lastmin, lasthour; int trandom, tranmonth, trandow; @@ -432,8 +434,11 @@ parse_args(argc, argv) { int argch; - while ((argch = getopt(argc, argv, "x:")) != -1) { + while ((argch = getopt(argc, argv, "sx:")) != -1) { switch (argch) { + case 's': + dst_enabled = 1; + break; case 'x': if (!set_debug_flags(optarg)) usage(); |