Daylight Savings time
How can I tell if the daylight savings flag is set? My state is observing daylight savings for the first time and I need to identify which Linux systems are and are not ready for it.
Thanks, |
The internal time on linux never changes, regardless your time zone settings.
The internal date/time can be presented to the user in a wide range of timezones. For instance, Code:
miguel@gold:~> export TZ=Australia/Adelaide If none is fine for you, build your own. Read the zic(1) man page. It is the time zone compiler that will create a binary file zone info, from a text file you provide. My text file for build a zone file for Brazil rules (which change every year btw) looks like this: Code:
miguel@gold:~> cat /usr/local/etc/BrazilEast.zic When we are in Daylight saving time, the date command change the output to BRDT (where D stands for Daylight) and normal time is displayed as BRST (standard). Just adapt my zic file for your needs, create the binary with the zic command. The resulting file will be placed by zic somewhere bellow /usr/share/zoneinfo/. The specific place is determined by the NAME field in the zic file, in my case, /usr/share/zoneinfo/Brazil/East. After that, copy the binary file from /usr/share/zoneinfo to /etc/localtime and set somewhere in your system the default time zone (In SuSE is in /etc/sysconfig/clock). regards, |
Az
Ah, so now we all know you're in Arizona. ;)
|
Guess again... (Here's a hint: a famous 500 mile race happens on Memorial day weekend in my state)
|
Did Arizona change to observing DST this year too?
I'm in the same state as depdiver, so I've had to do the same thing. The suggestion by marozsas should work fine, but under the circumstances is actually a lot more work than required. The easy way, which also allows a rather easy check to make sure it's correct is: Code:
ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime ls -l /etc/localtime will show by the link what zone you're observing. The "-sf" in the ln command will force the link, overwriting the original file. I have to admit that I was not immediately positive that this would work with no other steps, so I lied to a test box and set the times to immediately before the spring and fall time changes and confirmed that the local time shown by, e.g., date changed as it was suppposed to. One additional caveat is to watch out for cron jobs taking place between 1am and 3am. In the Spring, there will be no 2:00-3:00 am on the change day and in the fall, there will be TWO 1:00-2:00 hours so cron jobs in that range would run twice. BTW, things will get more complicated in 2007 when the new start and end dates mandated by Congress take effect. (ob quote -- Will Rogers: "If 'pro' is the opposite of 'con', what's the opposite of 'progress'?") Good Luck, Paul |
All times are GMT -5. The time now is 03:10 PM. |