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?"
gus
P.S. Get to it, linux guys ... maybe I will have a look.
.. if only.
Are even technical users ignorant on how UNIX handles time, time zones, and time conversion?
Nope, technical users know that UNIX systems should be run using GMT, which doesn't observe daylight savings time.
Is your browser retarded?
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.
for using daylight saving time. Come to Indiana, where people are more normal, and don't try to change time itself.
In FreeBSD, the default times for daily/weekly/monthly cron jobs are chosen so that they don't fall within the daylight savings time mess.
Tarsnap: Online backups for the truly paranoid
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
Just have your company relocate to Indiana. We don't need no steenking daylight savings.
The world already has a standard -- UTC.
System time should be set to UTC, and the time display should be seperate configuration step.
Using NTP should take care of the leap second problem, as long as your Stratum-1 server is accurate.
Conformity is the jailer of freedom and enemy of growth. -JFK
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.
Linux gives you a choice about how to keep the hardware clock (Local or UTC), and the system clock is UTC with an offset setting for local time. If you're single boot with Linux, a UTC hardware clock is probably best, but if you ever want to boot into Windows, your going to have to adjust somehow.
Having the hardware clock in local time creates a problem when the time change happens, but you don't see it until you reboot. Someone incorrectly said you need to update from the hardware clock, but it is just the opposite, you have to update the hardware clock from the system clock after the time change. Since the system knows both when the change happens and whether the hardware clock is in local or UTC, it could take care of this little detail. It would be a nice touch for the distribution makers to handle this is some way. This is one of those things that doesn't really live in a single program/module but relates to interactions, so the distribution maker probably should own it. Of course, it would be nice if the hardware clock knew what the current offset is, then the issue would be easily and correctly solved.
BTW, I've always wondered about how the transition day is calculated. I've never been able to find a simple description of it. Most (all?) systems seem to know when it is, and it allways seems to be correct (for US timezones excluding Indiana), but I can't see how it could be 'calculated' from a simple rule that doesn't need to be updated from time to time. The TZ variable indicates whether the zone has DST and what the offset change is, but it doesn't have any information about when the change is. Is it just a 'last Sunday in October/April' or something like that hard coded in the library?
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.
You reboot?
*rimshot*
--
I post links to stuff here
Servers ought to use /usr/share/zoneinfo/right/UTC
anyways because of the logs and stuff, and me, being
consistent, despite living in right/Europe/Berlin zone,
switched all my clocks (server, desktop, notebook,
watch, wrist clock, microwave oven clock, car clock
etc.) to UTC. I just add the one or two hours in mind.
My Karma isn't excellent, damn it! (And
He answered "yes" but became rather less impressed an hour later when, once again, it asked him if the clock should be reset. For fun he kept answering yes each hour till he was done with his article.
Database, cron and other timezone problems aside, at least a properly set up *nix always knows what time it is both locally and in UTC so the other programs at least have a shot at running properly.
~~~~~~~
"You are not remembered for doing what is expected of you." - Atul Chitnis
First, NTP does not affect spring/fall time "changes" at all. Regardless of whether you have NTP or not, this "change" happens correctly. Indeed, daylight saving time only affects how time is displayed (or broken up in day, hour, minute, second), and does not affect the physical clock at all (which is kept in UTC at all times). NTP however, ensures accuracy by synching the physical clock (kept in UTC) to a master.
Moreover, the subject of this discussion is not the accuracy of the displayed time, but rather how cron (which works in local time) copes with with "duplicate" and "missing" hours. Installing NTP does nothing to help this, only picking the right cron works. Or just use the commonsense solution of not scheduling any important jobs between 2am and 3am.
Say no to software patents.