Daylight Savings and UNIX?
Anonymous asks: "My company recently asked me to write them a report on how UNIX properly handles the switch to Daylight Savings Time, and back again. When our systems administrators received the report, I was somewhat surprised. Many of them weren't aware that 'cron' would run the affected jobs twice in the fall, and not at all in the spring. Apparently, the man pages on some operating systems, like Solaris, aren't forthcoming with details. Others groups, like database administrators, are completely unaware of the differences between epoch time and wall clock time. Are even technical users ignorant on how UNIX handles time, time zones, and time conversion?"
Hmmm... this is what man cron gives on my Debian Linux box...
#exclude <ms/windows.h>
Many Linux distributions ship with a heavily (and I mean heavily) patched up version of Vixie-cron as the default cron package. This is what many people refer to in this thread when they say "Linux cron".
There are other cron packages out there for Linux; for example, fcron. Section 2.2 of the fcron FAQ says:
And to further complicate matters, most commercial Unix-type OS's are either completely independent of Vixie-cron or they genetically "diverged" from Vixie-cron so long ago that they bear only faint resemblance to the original.
Maybe those technical people who you are questioning worked on a non-Linux system that doesn't suffer from the idiosyncrancies of Vixie-cron, or maybe they use fcron.
confuse the cows
Smirk. My uncle works in state government in Indiana and I tease him about this from time to time. He's been around long enough to remember the debate on this one and he says that *one* of the reasons that they don't switch is because the drive-in-movie theaters had a strong lobby the last time this was seriously discussed.
That always cracks me up. The entire state is out of step with their neighbors because of theater owners.
They are considering changing to a more conventional (notice I didn't say 'normal', just conventional) system and he says "I don't think that lobby is as strong as it used to be".
Why not just run an NTP client on the box? Then you get accurate time and spring/fall time changes automatically.
Are even technical users ignorant on how UNIX handles time, time zones, and time conversion?
/etc/default/init and reboot!
Maybe this has been fixed by now (AFAIK as of SunOS 5.8 it hasn't) but Unix' handling of timezones has always been pretty lame. For example, if you want to change timezone in your shell (and for processes subsequently spawned) you just set the TZ environment variable. If you want to change the system time globally, su to root and use the date command, and running processes will see it next time they ask the OS for the time. OK so far. But if you want to change the timezone globally, for running processes, you can't because time zone comes from init - at the very least you have to stop and restart processes after setting TZ, and if you're going to do that, you might as well edit
Um. BZZZT! Different parts of Indiana are in different time zones and some of those parts do observe DST. (reference). In fact, of all the states, Indiana is probably the worst in this respect. If you have trouble dealing with clocks, the place to be is Arizona.
I do not have a signature
Okay, this has to be the absolutey most assinine thing I've done on Slashdot, but I've gotta do it.
It's daylight saving time, not daylight savings time. NIST says so.
Anyway, if it were up to me, we wouldn't have daylight saving at all.
Now I am very careful about what cron jobs I run between 01:00 and 03:00 on any unix box (they might check for the existance of something at most), and accordingly leave ntpd running.
This sig no verb.
2038 is more like it. 03:14:07 UTC on 19 January 2038, to be exact.
And no, just hoping everyone's going to be running 64-bit systems by then is not going to help if you have, for example, file formats which only allocate 4 bytes to storing a time_t value.
I'll not have reached retirement age in 2038... I wonder how many C programmers will be called out of their holes to patch programs similar to the hunt for COBOL experts at the end of last century.
Esli epei etot cumprenan, shris soa Sfaha.
...sounds like someone doesn't have their daylight savings time rules or timezone set correctly. Does "TZ" ring any bells?
*snip*
Is it just a 'last Sunday in October/April' or something like that hard coded in the library?
Depends on the Country and the Hemisphere. The US (and most of North America) is first sunday in April and last sunday in Octoboer. I didn't realize that the Southern Hemisphere observers DST the other six months (ie, their summer). Seems obvious in hindsight.
Web Exhibits has history and start/stop days by country.
I shamelessly stole a bit of DST calculation code from their web site.
If time has moved forward, those jobs that would have run in the interval
:)
that has been skipped will be run immediately. Conversely, if time has
moved backward, care is taken to avoid running jobs twice.
*BSD's rock!!!
Lastly, my feel good comment was in relation to the extra hours spent on the golf course. It was a bit of a flame and I probaby should have deleted that comment before posting.
Other benefits of UTC? A central logserver taking logs from hosts across the continent. "Was that at 2 Central or Eastern? Wait, what time is it in Indiana right now?" Additionally, when you have users across the world it provides a common time. I've meet many people who thought that the common Eastern timezone was still EST in the summer and never used EDT. Once again, Indiana: in the summer, it's the same as CDT, but it's still EST (unless you're near a major city on a border, in which case the appropriate [CD]DT is used). Don't add this confusion to your system accounting.
Using UTC as a common reference time for computing devices simplifies the maintenance of them and eliminates any potential problems originating from the use of local daylight time.
heheh because I'm on Pacific time, all the cron mail sent out at midnight shows up early in the evening. A side benefit.
(And NTP! Please! Accurate time is key to accurate forensics in the event of an intrusion crossing multiple boxes. Even the MacOS and XP have built-in support.)