Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Linux+Daylight Savings+Java

 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank - for a reasonably good explanation of all the fields do:
man tzset
Regards, Guy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic