J
Joe
I am working on a cross platform (Windows/Solaris/HP) Java 1.4.2_03
application which needs to display the current system time zone to the
user.
I was planning to use the output of
java.util.TimeZone.getDefault().toString() to display to the user. I
don't see another method which will tell me what the current system
time zone is.
The problem is that while my program is running and I go to the
Windows "Date and Time Properties" screen and change the system time
zone, the output of the above call does not seem to update. It always
contains the original time zone name. If I kill and restart my app I
can then see the new TimeZone. I also tried checking the System
property user.timezone but it doesn't seem to update either.
I looked at the source for TimeZone.getDefault() and it seems to set a
static within the TimeZone class the 1st time it is called. It also
uses a private native call to getSystemTimeZoneID() but I can't call
that. The static TimeZone value set the 1st time called seems to be
the problem but is there some way around this? I didn't find anything
useful anywhere else in the TimeZone, SimpleTimeZone, Calendar, etc.
classes.
I am currently using Windows XP SP1 if it matters.
Any ideas?
Thanks,
-Joe
application which needs to display the current system time zone to the
user.
I was planning to use the output of
java.util.TimeZone.getDefault().toString() to display to the user. I
don't see another method which will tell me what the current system
time zone is.
The problem is that while my program is running and I go to the
Windows "Date and Time Properties" screen and change the system time
zone, the output of the above call does not seem to update. It always
contains the original time zone name. If I kill and restart my app I
can then see the new TimeZone. I also tried checking the System
property user.timezone but it doesn't seem to update either.
I looked at the source for TimeZone.getDefault() and it seems to set a
static within the TimeZone class the 1st time it is called. It also
uses a private native call to getSystemTimeZoneID() but I can't call
that. The static TimeZone value set the 1st time called seems to be
the problem but is there some way around this? I didn't find anything
useful anywhere else in the TimeZone, SimpleTimeZone, Calendar, etc.
classes.
I am currently using Windows XP SP1 if it matters.
Any ideas?
Thanks,
-Joe