Article View: comp.bugs.sys5
Article #629S5R[23] "cron" runs jobs twice when DST ends
From: guy
Date: Wed, 28 Oct 1987 09:25
Date: Wed, 28 Oct 1987 09:25
20 lines
1749 bytes
1749 bytes
The subject basically says it all. The problem is that it computes the UNIX
time (GMT) when the next job is to be run by getting the UNIX time for "now",
converting it to local time using "localtime", figures out the local time for
"then", figures out how many days, hours and minutes separate the two local
time values, converts that to seconds, and adds it to the UNIX time for "now".
Needless to say, This Doesn't Work Right if DST is in effect "now" but not in
effect "then". (Yes, I tried this on a 3B2 running 3.1; it really happens.)
The fix is to put some sort of local time to UNIX time conversion routine into
your C library - the best way to do this is to dump "ctime.c" in favor of
Arthur Olson's code, and compile it so that "timelocal" and "timegm" are
defined - and change "cron.c" so that the UNIX time for the next job is
computed by figuring out the local time for the next job and using something
such as "timelocal" to convert that to UNIX time. (Of course, this doesn't
solve the problem of running a job at 2:10AM on the day when DST goes into or
out of effect - but *nothing* can solve *that* problem; the local time to UNIX
time mapping is neither one-to-one nor onto.)
Guy Harris
{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
guy@sun.com
Technical Details
Message-ID:
<32173@sun.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!husc6!hao!ames!amdahl!oliveb!sun!gorodish!guyShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!rutgers!husc6!hao!ames!amdahl!oliveb!sun!gorodish!guy From: guy@gorodish.UUCP Newsgroups: comp.bugs.sys5 Subject: S5R[23] "cron" runs jobs twice when DST ends Message-ID: <32173@sun.uucp> Date: Wed, 28-Oct-87 04:25:18 EST Article-I.D.: sun.32173 Posted: Wed Oct 28 04:25:18 1987 Date-Received: Sat, 31-Oct-87 02:33:57 EST Sender: news@sun.uucp Lines: 20