>> I'm having a problem with the time in Java. I running Fedora 7 and
>> Sun's JDK 1.6.0_01. The time is one hour early and the timezone
[quoted text clipped - 8 lines]
>
> /gordon
> Thanks for the reply. $TZ is not set currently but I did try setting it
> to US/Pacific. This fixes the problem only for programs run in the
> terminal. Applets still show the wrong time. I don't know where the
> time zone would be set for an applet but I would have thought that it
> came from the system time zone. How is the time zone propagated in Linux?
If TZ is set, then that timezone is used. If you set (and export) TZ
high up in the process hierarchy (e.g. /etc/profile), then all of your
processes will see it. For processes without TZ, the timezone defined
by /etc/localtime is used.
I would expect the timezone seen by the browser, and hence the applet,
to follow the same rules.
> Below are the answers to your questions. The correct time was 16:??
> hours. I tried setting /etc/localtime to /usr/share/zoneinfo/PST8PDT
> and /usr/share/zoneinfo/America/Los_Angeles. Neither make a difference.
I'd also recommend setting UTC=true in /etc/sysconfig/clock unless
this is a dual boot Linux-Windows machine. (UTC=false is a concession
to Windows, which insists on storing localtime in the HW clock).
This might offer more insight:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6456628
/gordon
--
Roedy Green - 15 Jun 2007 11:11 GMT
>I would expect the timezone seen by the browser, and hence the applet,
>to follow the same rules.
Perhaps the browser has its own TZ setting. Use Wassup to see what
system properties the browser is using.
see http://mindprod.com/applets/wassup.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Knute Johnson - 17 Jun 2007 23:40 GMT
>> I would expect the timezone seen by the browser, and hence the applet,
>> to follow the same rules.
[quoted text clipped - 4 lines]
> see http://mindprod.com/applets/wassup.html
> --
The problem is the bug that Gordon identified. I don't think it is
going to get fixed because there are only two votes for the bug.
knute...
On Jun 7, 4:13 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> [knute@localhost ~]$ cat /etc/sysconfig/clock
> # The ZONE parameter is only evaluated by system-config-date.
> # The timezone of the system is defined by the contents of /etc/localtime.
> ZONE="America/Los Angeles"
> UTC=false
> ARC=false
On my machine, I found that putting an underscore in the ZONE entry
fixed the problem:
ZONE="America/Los_Angeles"
Is this a bug with the program that writes out /etc/sysconfig/clock or
with the way java parses it?
Roedy Green - 07 Jul 2007 07:20 GMT
>On my machine, I found that putting an underscore in the ZONE entry
>fixed the problem:
>ZONE="America/Los_Angeles"
see http://mindprod.com/jgloss/timezone.html for the official list of
Timezone names. They never contain spaces. They always have
underscores. I don't know though about names for DateFormat.parse.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Knute Johnson - 12 Jul 2007 18:33 GMT
> On Jun 7, 4:13 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> wrote:
[quoted text clipped - 8 lines]
> fixed the problem:
> ZONE="America/Los_Angeles"
That solved my problem too. In fact I don't need the "s any more.
> Is this a bug with the program that writes out /etc/sysconfig/clock or
> with the way java parses it?
Different Linux use different methods for keeping track of the timezone.
I don't know for sure how Java determines the current timezone but in
Fedora 7 it seems to read the /etc/sysconfig/clock file. That file
doesn't exist in other Linux versions.
There is a Java bug on this subject, 6456628.

Signature
Knute Johnson
email s/nospam/knute/