aspose file tools*
The moose likes Linux / UNIX and the fly likes Linux+Daylight Savings+Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Linux+Daylight Savings+Java" Watch "Linux+Daylight Savings+Java" New topic
Author

Linux+Daylight Savings+Java

Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Hi guys - I have been butting my head against this for most of the day today (Saturday), and I give up for now, am going to go have a beer.
Situation is:
Linux box (RH 7.2 plus maint, a solid environment).
Hardware clock is set to UTC/GMT.
/etc/sysconfig/clock has UTC=true
/etc/localtime is a copy of /usr/share/zoneinfo/America/New_York
/etc/profile sets and exports TZ=EST+5EDT,M4.1.0/2,M10.5.0/2
Linux 'date' command reports local (daylight savings) time correctly.
GUI clocks in KDE and Gnome report correctly.
Simple C/C++ programs report correctly.
Perl give times correctly.
Regina (a REXX interpreter) gives times correctly.
Java applications do not report time correctly. They did not 'spring forward', the time is an hour off. Failures in both SDK 1.3.1 and 1.4.
I cannot seem to find any JRE documentation regarding this.
I also cannot seem to find relevant info. via STW.
And, it does not happen on my Win box!
An ideas please???
Thanks, Guy
[ April 14, 2002: Message edited by: Guy Allard ]
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
FYI here are the 'getarounds' for this:
1) java -Duser.timezone=EST5EDT ......
2) java -Duser.timezone=America/New_York ......
3) export TZ=EST5EDT
java .... (as usual) .....
4) export TZ=America/New_York
java .... (as usual) .....
Other programs/languages continue to report the correct hour with any of these settings.
I will go with 3) (export actually done in /etc/profile), but it is annoying that the JRE does not recognize a fully explicit TZ environment variable.
Regards, Guy
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Wow. I've had to battle with TZ from time to time in the past, and I never knew you could add anything beyond the basic stuff. I presume the additional parts are to inform applications when to change over.
In some ways its easier over here on the meridian, because for half the year you don't need a TZ setting at all. In other ways it's harder, because some pretty wierd bugs can wait for six months before showing up


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Frank - for a reasonably good explanation of all the fields do:
man tzset
Regards, Guy
 
wood burning stoves
 
subject: Linux+Daylight Savings+Java