Hi Omair,
/etc/sysconfig/clock used to be supported, but it was removed in JDK 7.
The problem is discussed in bug #6456628.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6456628
Have you tested your fix on all Red Hat-like distros, including some
older releases, with all the time zone IDs?
Thanks,
Masayoshi
On 8/26/2013 5:40 PM, Alan Bateman wrote:
Including i18n-dev on this discussion because that is where this code
is maintained.
On 23/08/2013 22:09, Omair Majid wrote:
Hi,
The algorithm that OpenJDK uses to guess the local timezone ID on Linux
goes like this:
1. If TZ environment variable is set, use that
2. If /etc/timezone is readable, read the time zone from there
3. If /etc/localtime is a symlink, resolve that, and use the name to
guess the time zone.
4. Scan /usr/share/zoneinfo for a file whose contents match the contents
of /etc/localtime.
Step 4 (if it is ever reached) is probably going to lead to incorrect
results since there are a number of timezones that have the same
zoneinfo data (such as Europe/London and Europe/Belfast). So it seems
sensible to me to try and use additional sources to guess the timezone
ID before resorting to file content comparisons.
The webrev adds a step between 2 and 3 that reads and parses
/etc/sysconfig/clock to extract the timezone:
http://cr.openjdk.java.net/~omajid/webrevs/timezone-read-sysconfig-clock/00/
This file exists on some Red Hat Enterprise Linux (and derivative)
distributions and contains contents that look this:
# The time zone of the system is defined by the contents of
/etc/localtime.
# This file is only for evaluation by system-config-date, do not
rely on its
# contents elsewhere.
ZONE="Europe/Zurich"
With this, we should be able to identify the exact timezone ID.
Thanks,
Omair