![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Implement daylight saving. | masquerer | AIX | 1 | 05-15-2008 04:27 AM |
| Technical Note: Oracle Database Daylight Saving Time Update Guide | iBot | Oracle Updates (RSS) | 0 | 04-06-2008 02:10 AM |
| Daylight Saving Time patch test | dangral | AIX | 1 | 02-06-2007 09:17 AM |
| disable daylight saving | ppass | SUN Solaris | 1 | 03-20-2006 07:57 AM |
| Timestamp - confusion with daylight saving time | softmachine | UNIX for Dummies Questions & Answers | 1 | 05-14-2005 06:31 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
How can I find my current Daylight Saving offset?
Hello all,
I'm having a problem where a script needs to calculate GMT time given local time. For 6 months, that's easy. The other 6 months, it's not, as I have to add an extra hour to allow for Daylight Saving. At the moment, I manually add and remove an offset but, for obvious reasons, I'd prefer to automate this. I was surprised that I couldn't find much discussion on this. What I'm looking for is some way to determine what the current local offset from GMT is. There is talk of an environment variable, $TZ, that includes information on the application of the summer time shift, but I cannot see this variable anywhere on my RHEL or Ubuntu machines. So, is there a nice easy way to work out my current offset and therefore modify the size of the GMT shift I need. I'm thinking of using a cron, triggered at 0400 six months a year, to create $TZ or similar, but that would be ugly and just plain wrong for up to a day if I need to reboot during the summer! Thanks! |
| Forum Sponsor | ||
|
|
|
|||
|
No tzset is natively available, I'm afraid - that was somthing I came across earlier. Also, the /etc/timezones is good but doesn't include Daylight Saving information, only the time zone.
However, the date +%Z looks like a winner! It currently returns BST, which is correct (British Summer Time), and so presumably will switch to GMT in the winter. I just need to make my script run this and then compare the output to one of these two strings, adjusting the offset accordingly. Pretty mush exactly what I was looking for! Cheers era! |
|||
| Google The UNIX and Linux Forums |
| Tags |
| linux, ubuntu |
| Thread Tools | |
| Display Modes | |
|
|