Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Diagnose why Pacific TZ has wrong start/stop dates for DST, with JDK 1.6 on Ubuntu

8 views
Skip to first unread message

david.karr

unread,
Apr 14, 2009, 5:30:11 PM4/14/09
to
Here in Seattle, on April 14, we're in daylight savings time. I've
noticed since DST started that log files created by Java applications
on my Ubuntu box are an hour behind. I figured it had something to do
with daylight savings time. Non-Java applications do not display this
symptom.

If it matters, here's the output of "java -version":

java version "1.6.0_10"
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

I wrote a small test application that prints out relevant information
about daylight savings time. I'll attach the test code, but the
output it produces follows this. You'll see that as of today, it
thinks DST is not in effect. It also shows that it thinks DST starts
on April 26, and ends on October 25, which is not correct.

I filed a Ubuntu bug report for this, but I'd like to get some
feedback from "this side of the house" to see why this might be
happening.

date[Mon Apr 13 13:04:01 PST 2009] zonename[Pacific Standard Time]
dstSavings[3600000] usesDST[true] inDST[false] rawOffset[-28800000]
offset[-28800000]
date[Mon Apr 13 13:04:01 PST 2009] inDST[false]
date[Wed May 13 13:04:01 PDT 2009] inDST[true]
date[Sat Jun 13 13:04:01 PDT 2009] inDST[true]
date[Mon Jul 13 13:04:01 PDT 2009] inDST[true]
date[Thu Aug 13 13:04:01 PDT 2009] inDST[true]
date[Sun Sep 13 13:04:01 PDT 2009] inDST[true]
date[Tue Oct 13 13:04:01 PDT 2009] inDST[true]
date[Fri Nov 13 13:04:01 PST 2009] inDST[false]
date[Sun Dec 13 13:04:01 PST 2009] inDST[false]
date[Wed Jan 13 13:04:01 PST 2010] inDST[false]
date[Sat Feb 13 13:04:01 PST 2010] inDST[false]
date[Sat Mar 13 13:04:01 PST 2010] inDST[false]
date[Sun Apr 26 00:00:00 PST 2009] inDST[false]
date[Mon Apr 27 00:00:00 PDT 2009] inDST[true]
date[Sun Oct 25 00:00:00 PDT 2009] inDST[true]
date[Mon Oct 26 00:00:00 PST 2009] inDST[false]

John B. Matthews

unread,
Apr 14, 2009, 6:18:59 PM4/14/09
to
In article
<3acf3c31-e7c6-40ff...@y10g2000prc.googlegroups.com>,
"david.karr" <davidmic...@gmail.com> wrote:

> Here in Seattle, on April 14, we're in daylight savings time. I've
> noticed since DST started that log files created by Java applications
> on my Ubuntu box are an hour behind. I figured it had something to do
> with daylight savings time. Non-Java applications do not display this
> symptom.
>
> If it matters, here's the output of "java -version":
>
> java version "1.6.0_10"
> Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
> Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
>
> I wrote a small test application that prints out relevant information
> about daylight savings time. I'll attach the test code, but the
> output it produces follows this. You'll see that as of today, it
> thinks DST is not in effect. It also shows that it thinks DST starts
> on April 26, and ends on October 25, which is not correct.

[...]

You don't mention which version of Ubuntu, but apt-get may have updated
your tzdata, already. You'll need to update your Sun tables, too.

<http://java.sun.com/javase/tzupdater_README.html>

--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>

David Karr

unread,
Apr 14, 2009, 6:58:25 PM4/14/09
to
On Apr 14, 3:18 pm, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <3acf3c31-e7c6-40ff-8127-a40b8debe...@y10g2000prc.googlegroups.com>,

>
>
>
>  "david.karr" <davidmichaelk...@gmail.com> wrote:
> > Here in Seattle, on April 14, we're in daylight savings time.  I've
> > noticed since DST started that log files created by Java applications
> > on my Ubuntu box are an hour behind.  I figured it had something to do
> > with daylight savings time.  Non-Java applications do not display this
> > symptom.
>
> > If it matters, here's the output of "java -version":
>
> > java version "1.6.0_10"
> > Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
> > Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
>
> > I wrote a small test application that prints out relevant information
> > about daylight savings time.  I'll attach the test code, but the
> > output it produces follows this. You'll see that as of today, it
> > thinks DST is not in effect.  It also shows that it thinks DST starts
> > on April 26, and ends on October 25, which is not correct.
>
> [...]
>
> You don't mention which version of Ubuntu, but apt-get may have updated
> your tzdata, already. You'll need to update your Sun tables, too.
>
> <http://java.sun.com/javase/tzupdater_README.html>

I'm using Ubuntu 8.10.

Your information was promising, but it didn't appear to fix the
problem.

I installed the tzupdater tool, and then from the command line, I
first reran my test app to make sure it's reporting the same results
as it did before. Then, I ran the tzupdater with "-t". This showed
lots of output indicating various test failures and "time zone not
found" lines. Then, I ran it with "-u" and it chugged for a second
and went back to the prompt. I then reran my test app, and the
results didn't change. I then reran the tzupdater with "-t", and it
produced no output. This tells me that the update did something, but
not quite what I need.

I assume the timezone data is only relevant at runtime, so I shouldn't
have to recompile the class in my test app?

Knute Johnson

unread,
Apr 14, 2009, 8:11:42 PM4/14/09
to

Linux has all sorts of issues with timezones and so does Java. So if
your system is not completely updated, both the Linux and Java, there
could be timezone problems. And that means the _?? updates of Java too.
That said, you can do an immediate fix by putting adding a link,

/etc/localtime that points to /usr/share/zoneinfo/US/Pacific

This will get changed to the correct file and not a link when you do all
the updates but it works fine until then.

To confirm correct Java time, run my clock applet

http://rabbitbrush.frazmtn.com/clock.html

and check your time.

knute...

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access

John B. Matthews

unread,
Apr 14, 2009, 10:55:17 PM4/14/09
to
In article
<57d025bf-2036-4835...@d25g2000prn.googlegroups.com>,
David Karr <davidmic...@gmail.com> wrote:

Good, you can get updates. Be sure your tzdata is current. It looks like
tzdata 2009d-0ubuntu0.8.10 was accepted 30-Mar-2009.

> Your information was promising, but it didn't appear to fix the
> problem.
>
> I installed the tzupdater tool, and then from the command line, I
> first reran my test app to make sure it's reporting the same results
> as it did before. Then, I ran the tzupdater with "-t". This showed
> lots of output indicating various test failures and "time zone not
> found" lines. Then, I ran it with "-u" and it chugged for a second
> and went back to the prompt. I then reran my test app, and the
> results didn't change. I then reran the tzupdater with "-t", and it
> produced no output. This tells me that the update did something, but
> not quite what I need.
>
> I assume the timezone data is only relevant at runtime, so I
> shouldn't have to recompile the class in my test app?

I wouldn't think so, but your attached code wasn't propagated.

David Karr

unread,
Apr 15, 2009, 1:22:42 AM4/15/09
to
On Apr 14, 5:11 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:

I didn't make this change, but I did run "cmp" with those two file
paths as arguments, so I assume that means they are identical, which
makes the change unnecessary.

> This will get changed to the correct file and not a link when you do all
> the updates but it works fine until then.
>
> To confirm correct Java time, run my clock applet
>
> http://rabbitbrush.frazmtn.com/clock.html
>
> and check your time.

Still an hour behind.

David Karr

unread,
Apr 15, 2009, 1:25:48 AM4/15/09
to
On Apr 14, 7:55 pm, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <57d025bf-2036-4835-b80e-5b948dff9...@d25g2000prn.googlegroups.com>,

That's because I didn't attach it.

I'll add two blocks here, one with the code for the class, and one
showing the current output I get.
------------------------------
package timedate;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

import
com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException;

public class TimeDate
{
public static void main(String[] args)
{
TimeZone timezone = TimeZone.getDefault();
Date date = new Date();
System.out.println("date[" + date +
"] zonename[" + timezone.getDisplayName() +
"] dstSavings[" + timezone.getDSTSavings()
+
"] usesDST[" + timezone.useDaylightTime() +
"] inDST[" + timezone.inDaylightTime(date)
+
"] rawOffset[" + timezone.getRawOffset() +
"] offset[" + timezone.getOffset
(date.getTime()) + "]");
Calendar calendar = Calendar.getInstance();
for (int ctr = 0; ctr < 12; ++ ctr)
{
testDateForDST(calendar.getTime());
calendar.add(Calendar.MONTH, 1);
}

testDateStrForDST("April 26, 2009");
testDateStrForDST("April 27, 2009");
testDateStrForDST("October 25, 2009");
testDateStrForDST("October 26, 2009");
}

public static void testDateForDST(Date date)
{
System.out.println("date[" + date +
"] inDST[" + inDST(Calendar.getInstance().getTimeZone
(), date) + "]");

}

public static void testDateStrForDST(String str)
{
DateFormat dateFormat = DateFormat.getDateInstance();

try
{
Date date = dateFormat.parse(str);
testDateForDST(date);
}
catch (Exception ex)
{
ex.printStackTrace();
}
}

public static boolean inDST(TimeZone timeZone, Date date)
{
return Calendar.getInstance().getTimeZone().inDaylightTime
(date);
}
}
------------------------------
------------------------------


date[Mon Apr 13 13:04:01 PST 2009] zonename[Pacific Standard Time]
dstSavings[3600000] usesDST[true] inDST[false] rawOffset[-28800000]
offset[-28800000]
date[Mon Apr 13 13:04:01 PST 2009] inDST[false]
date[Wed May 13 13:04:01 PDT 2009] inDST[true]
date[Sat Jun 13 13:04:01 PDT 2009] inDST[true]
date[Mon Jul 13 13:04:01 PDT 2009] inDST[true]
date[Thu Aug 13 13:04:01 PDT 2009] inDST[true]
date[Sun Sep 13 13:04:01 PDT 2009] inDST[true]
date[Tue Oct 13 13:04:01 PDT 2009] inDST[true]
date[Fri Nov 13 13:04:01 PST 2009] inDST[false]
date[Sun Dec 13 13:04:01 PST 2009] inDST[false]
date[Wed Jan 13 13:04:01 PST 2010] inDST[false]
date[Sat Feb 13 13:04:01 PST 2010] inDST[false]
date[Sat Mar 13 13:04:01 PST 2010] inDST[false]
date[Sun Apr 26 00:00:00 PST 2009] inDST[false]
date[Mon Apr 27 00:00:00 PDT 2009] inDST[true]
date[Sun Oct 25 00:00:00 PDT 2009] inDST[true]
date[Mon Oct 26 00:00:00 PST 2009] inDST[false]

---------------------------------

Knute Johnson

unread,
Apr 15, 2009, 1:29:47 AM4/15/09
to

Take out the file and put in the link. I think you will be surprised!

John B. Matthews

unread,
Apr 15, 2009, 10:23:23 AM4/15/09
to
In article
<04f84877-d1e6-4fdc...@b7g2000pre.googlegroups.com>,
David Karr <davidmic...@gmail.com> wrote:
[...]

> > > > <http://java.sun.com/javase/tzupdater_README.html>
> >
> > > I'm using Ubuntu 8.10.
> >
> > Good, you can get updates. Be sure your tzdata is current. It looks
> > like tzdata 2009d-0ubuntu0.8.10 was accepted 30-Mar-2009.
[...]

> I'll add two blocks here, one with the code for the class, and one
> showing the current output I get.
[...]

> date[Sun Apr 26 00:00:00 PST 2009] inDST[false]
> date[Mon Apr 27 00:00:00 PDT 2009] inDST[true]
> date[Sun Oct 25 00:00:00 PDT 2009] inDST[true]
> date[Mon Oct 26 00:00:00 PST 2009] inDST[false]

I get expected results from your code in my time zone. Your results are
incorrect for <http://en.wikipedia.org/wiki/Pacific_Time_Zone>. I see
the Pacific Time Zone changed in both 2006 and 2007, but 8.10 was
released in 2008. It's hard to imagine your tzdata being outdated, but
it's easy to check. You mention that Knute Johnson's Java Applet clock
displays an hour behind. Is your desktop clock also an hour behind? Are
you running under a VM or with altered BIOS settings?

David Karr

unread,
Apr 15, 2009, 11:41:05 AM4/15/09
to
On Apr 15, 7:23 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <04f84877-d1e6-4fdc-ab04-edb2f3b51...@b7g2000pre.googlegroups.com>,

>  David Karr <davidmichaelk...@gmail.com> wrote:
> [...]
>
> > > > > <http://java.sun.com/javase/tzupdater_README.html>
>
> > > > I'm using Ubuntu 8.10.
>
> > > Good, you can get updates. Be sure your tzdata is current. It looks
> > > like tzdata 2009d-0ubuntu0.8.10 was accepted 30-Mar-2009.
> [...]
> > I'll add two blocks here, one with the code for the class, and one
> > showing the current output I get.
> [...]
> > date[Sun Apr 26 00:00:00 PST 2009] inDST[false]
> > date[Mon Apr 27 00:00:00 PDT 2009] inDST[true]
> > date[Sun Oct 25 00:00:00 PDT 2009] inDST[true]
> > date[Mon Oct 26 00:00:00 PST 2009] inDST[false]
>
> I get expected results from your code in my time zone. Your results are
> incorrect for <http://en.wikipedia.org/wiki/Pacific_Time_Zone>. I see
> the Pacific Time Zone changed in both 2006 and 2007, but 8.10 was
> released in 2008. It's hard to imagine your tzdata being outdated, but
> it's easy to check. You mention that Knute Johnson's Java Applet clock
> displays an hour behind. Is your desktop clock also an hour behind? Are
> you running under a VM or with altered BIOS settings?

No, as I said in the original post, all non-Java applications do not
display this symptom. I'm not running in a VM. If it matters, I just
ran tzupdater, as you can see earlier in this thread.

David Karr

unread,
Apr 15, 2009, 11:54:24 AM4/15/09
to
On Apr 14, 5:11 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:

Ok, that worked. Can you please explain how that works (especially
the part about the two original files being identical)? I'd like to
add some info to the Ubuntu bug report.

> This will get changed to the correct file and not a link when you do all
> the updates but it works fine until then.

What updates are you talking about? I have no pending package
updates, and I've already run tzupdater.

> To confirm correct Java time, run my clock applet
>
> http://rabbitbrush.frazmtn.com/clock.html
>
> and check your time.

This appears to be down right now.

John B. Matthews

unread,
Apr 15, 2009, 12:46:35 PM4/15/09
to
In article
<bda90153-440f-483d...@z8g2000prd.googlegroups.com>,
David Karr <davidmic...@gmail.com> wrote:

Ah, only Java applications display the symptom. I'm sure you've also
verified that you have only one JDK/JRE installed.

I am intrigued that linking /etc/localtime to the correct zoneinfo
helped: /usr/share/zoneinfo/US/Pacific. I seem to recall the tzdata
update generating changed files as part of the update process.

David Karr

unread,
Apr 15, 2009, 12:58:56 PM4/15/09
to
On Apr 15, 9:46 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <bda90153-440f-483d-934e-14db7f1ab...@z8g2000prd.googlegroups.com>,

Are you kidding? There are several. I've only been testing with the
"main" one to see if anything I did would impact at least that JVM. I
would assume that the localtime link change would have affected all of
them.

John B. Matthews

unread,
Apr 15, 2009, 1:10:15 PM4/15/09
to
In article
<eb5c3285-a3e8-4039...@f41g2000pra.googlegroups.com>,
David Karr <davidmic...@gmail.com> wrote:

No, but I understand that the distinction can be difficult in text and
among people with different language & cultural backgrounds.

Were I kidding, I'd actually be calving, albeit at a glacial pace. :-)

> There are several. I've only been testing with the "main" one to see
> if anything I did would impact at least that JVM. I would assume
> that the localtime link change would have affected all of them.

See also <http://java.sun.com/javase/tzupdater_README.html#system>

David Karr

unread,
Apr 15, 2009, 1:36:32 PM4/15/09
to
On Apr 15, 10:10 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <eb5c3285-a3e8-4039-8ce5-ea2e8b20a...@f41g2000pra.googlegroups.com>,
> > There are several.  I've only been testing with the "main" one to see
> > if anything I did would impact at least that JVM.  I would assume
> > that the localtime link change would have affected all of them.
>
> See also <http://java.sun.com/javase/tzupdater_README.html#system>

Yes, that page was already referenced earlier in this thread. I
didn't see any point in running tzupdater on the other JVMs, as it had
no effect on the JVM that I've been testing with.

John B. Matthews

unread,
Apr 15, 2009, 3:47:37 PM4/15/09
to
In article
<3c348e21-53a9-46f3...@y6g2000prf.googlegroups.com>,
David Karr <davidmic...@gmail.com> wrote:

> On Apr 15, 10:10 am, "John B. Matthews" <nos...@nospam.invalid> wrote:

[...]


> > > > Ah, only Java applications display the symptom. I'm sure you've
> > > > also verified that you have only one JDK/JRE installed.
> >
> > > There are several.  I've only been testing with the "main" one to see
> > > if anything I did would impact at least that JVM.  I would assume
> > > that the localtime link change would have affected all of them.
> >
> > See also <http://java.sun.com/javase/tzupdater_README.html#system>
>
> Yes, that page was already referenced earlier in this thread. I
> didn't see any point in running tzupdater on the other JVMs, as it had
> no effect on the JVM that I've been testing with.

I'm not sure you can say there was "no effect." IIRC, you updated the
JVM first and then fixed the link in /etc/localtime. In particular, you
got different results running "tzupdater -u" between successive
executions of "tzupdater -t" [*]. You will surely need to update all
installed JDK/JREs. I have a clear memory of anomalous results when I
overlooked this in the past.

[*] <http://groups.google.com/group/comp.lang.java.programmer/msg/79d7a8dd5076fd21>

David Karr

unread,
Apr 15, 2009, 6:23:04 PM4/15/09
to
On Apr 15, 12:47 pm, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <3c348e21-53a9-46f3-892b-ba71c4b0d...@y6g2000prf.googlegroups.com>,

>  David Karr <davidmichaelk...@gmail.com> wrote:
>
>
>
> > On Apr 15, 10:10 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> [...]
> > > > > Ah, only Java applications display the symptom. I'm sure you've
> > > > > also verified that you have only one JDK/JRE installed.
>
> > > > There are several.  I've only been testing with the "main" one to see
> > > > if anything I did would impact at least that JVM.  I would assume
> > > > that the localtime link change would have affected all of them.
>
> > > See also <http://java.sun.com/javase/tzupdater_README.html#system>
>
> > Yes, that page was already referenced earlier in this thread.  I
> > didn't see any point in running tzupdater on the other JVMs, as it had
> > no effect on the JVM that I've been testing with.
>
> I'm not sure you can say there was "no effect." IIRC, you updated the
> JVM first and then fixed the link in /etc/localtime. In particular, you
> got different results running "tzupdater -u" between successive
> executions of "tzupdater -t" [*]. You will surely need to update all
> installed JDK/JREs. I have a clear memory of anomalous results when I
> overlooked this in the past.

I ran my test showing the incorrect DST date range. I then ran
tzupdater with that JVM. I then ran my test again. The output was
identical to the first run, and still wrong. That's what I mean by
"no effect".

I then later made the "/etc/localtime" change and then ran my test,
and it was now correct, showing the correct DST date range.

I now just ran my test app using a completely different JVM that is
installed elsewhere on the system, without running tzupdater on it,
and it shows the correct DST date range.

And concerning the runs of "tzupdater", yes, I clearly got different
results from "tzupdater -t" after I ran "tzupdater -u". It still had
no apparent effect on my problem.

David Karr

unread,
Apr 15, 2009, 6:45:39 PM4/15/09
to
On Apr 15, 12:47 pm, "John B. Matthews" <nos...@nospam.invalid> wrote:
> In article
> <3c348e21-53a9-46f3-892b-ba71c4b0d...@y6g2000prf.googlegroups.com>,
>  David Karr <davidmichaelk...@gmail.com> wrote:
>
>
>
> > On Apr 15, 10:10 am, "John B. Matthews" <nos...@nospam.invalid> wrote:
> [...]
> > > > > Ah, only Java applications display the symptom. I'm sure you've
> > > > > also verified that you have only one JDK/JRE installed.
>
> > > > There are several.  I've only been testing with the "main" one to see
> > > > if anything I did would impact at least that JVM.  I would assume
> > > > that the localtime link change would have affected all of them.
>
> > > See also <http://java.sun.com/javase/tzupdater_README.html#system>
>
> > Yes, that page was already referenced earlier in this thread.  I
> > didn't see any point in running tzupdater on the other JVMs, as it had
> > no effect on the JVM that I've been testing with.
>
> I'm not sure you can say there was "no effect." IIRC, you updated the
> JVM first and then fixed the link in /etc/localtime. In particular, you
> got different results running "tzupdater -u" between successive
> executions of "tzupdater -t" [*]. You will surely need to update all
> installed JDK/JREs. I have a clear memory of anomalous results when I

I also just restarted the browser and tested the aforementioned clock
applet, and that also shows the correct time, using DST (I tried it
first before restarting the browser, and it was still wrong). I'm not
certain what JVM this uses (the Java console appears to be an add-on
that I don't have).

David Karr

unread,
Apr 15, 2009, 7:04:03 PM4/15/09
to

Never mind on the console point. I figured that out. It shows it's
using the JVM I was using before.

David Karr

unread,
Apr 15, 2009, 8:30:20 PM4/15/09
to

Never mind on the console point. I figured that out. It shows it's

Knute Johnson

unread,
Apr 15, 2009, 7:33:34 PM4/15/09
to
David Karr wrote:
>> Linux has all sorts of issues with timezones and so does Java. So if
>> your system is not completely updated, both the Linux and Java, there
>> could be timezone problems. And that means the _?? updates of Java too.
>> That said, you can do an immediate fix by putting adding a link,
>>
>> /etc/localtime that points to /usr/share/zoneinfo/US/Pacific
>
> Ok, that worked. Can you please explain how that works (especially
> the part about the two original files being identical)? I'd like to
> add some info to the Ubuntu bug report.

Sun's Java under Linux requires that /etc/localtime be a link. I have
no idea why. I can't tell you how long it took me to figure this out.

>> This will get changed to the correct file and not a link when you do all
>> the updates but it works fine until then.
>
> What updates are you talking about? I have no pending package
> updates, and I've already run tzupdater.

You are good then. The timezone updates come with the JDK and since
Ubuntu doesn't do any updates mid-cycle you can end up with out of date
timezone data in Java. This is solved with the tzupdater. Keep in mind
though that Ubuntu updates can (and will) overwrite your /etc/localtime.

>> To confirm correct Java time, run my clock applet
>>
>> http://rabbitbrush.frazmtn.com/clock.html
>>
>> and check your time.
>
> This appears to be down right now.

Sorry, ISP had some serious problems from early this morning until just
a little bit ago. Should work fine now.

--

Knute Johnson
email s/nospam/knute2009/

Mayeul

unread,
Apr 16, 2009, 3:48:03 AM4/16/09
to
Knute Johnson wrote:
> David Karr wrote:
>>> Linux has all sorts of issues with timezones and so does Java. So if
>>> your system is not completely updated, both the Linux and Java, there
>>> could be timezone problems. And that means the _?? updates of Java too.
>>> That said, you can do an immediate fix by putting adding a link,
>>>
>>> /etc/localtime that points to /usr/share/zoneinfo/US/Pacific
>>
>> Ok, that worked. Can you please explain how that works (especially
>> the part about the two original files being identical)? I'd like to
>> add some info to the Ubuntu bug report.
>
> Sun's Java under Linux requires that /etc/localtime be a link. I have
> no idea why. I can't tell you how long it took me to figure this out.

Last time I checked, that was related to Java's need to detect what
timezone, and not what timezone rules, the system is configured to use.

The content of the files in /usr/share/zoneinfo, indicate a few rules
about the timezone, but it does not identify the timezone (and it lacks
DST information.) So Sun Java decided to identify it by the file's name.
Since, by definition, the file name is /etc/localtime, the idea was to
check what file it is a link to.

Now for the tricky part: in case /etc/localtime is not a link, the
fallback was to check all entries in /usr/share/zoneinfo, to find an
identical file, and decide this file's name indicates the timezone. A
problem I often encountered, was that several files were identical to
/etc/localtime, and Java would pick the wrong one.

But, I use the past because that would lead to incorrect timezone
detection, and here it seems that PST was detected just fine, the
problem being with DST rules. No idea what leaded to this precise problem.

If anyone has more up-to-date knowledge with the issue, I'd be delighted
to hear about it.

--
Mayeul

Knute Johnson

unread,
Apr 16, 2009, 1:03:48 PM4/16/09
to

Thanks very much for the info Mayeul. I knew there had to be a reason,
just didn't know what it was.

David Karr

unread,
Apr 17, 2009, 8:18:00 PM4/17/09
to

Someone pointed me to the following Sun bug, which is very relevant:
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6456628>.

Roedy Green

unread,
Apr 18, 2009, 10:29:54 AM4/18/09
to
On Wed, 15 Apr 2009 10:23:23 -0400, "John B. Matthews"
<nos...@nospam.invalid> wrote, quoted or indirectly quoted someone who
said :

>
>I get expected results from your code in my time zone. Your results are
>incorrect for <http://en.wikipedia.org/wiki/Pacific_Time_Zone>. I see
>the Pacific Time Zone changed in both 2006 and 2007, but 8.10 was
>released in 2008. It's hard to imagine your tzdata being outdated, but
>it's easy to check. You mention that Knute Johnson's Java Applet clock
>displays an hour behind. Is your desktop clock also an hour behind? Are
>you running under a VM or with altered BIOS settings?

Another tool that might be helpful in diagnosis is
http://mindprod.com/webstart/setclock.html

Other than screwed up timezone tables, the following can also muck up
the time:

1. the computer internal clock does not have accurate GMT -- corrected
by talking to an atomic clock.

2. the OS timezone for this computer is wrong, corrected in the
control panel.


--
Roedy Green Canadian Mind Products
http://mindprod.com

Now for something completely different:
http://www.youtube.com/watch?v=9lp0IWv8QZY

Roedy Green

unread,
Apr 18, 2009, 10:31:20 AM4/18/09
to
On Wed, 15 Apr 2009 08:41:05 -0700 (PDT), David Karr
<davidmic...@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>No, as I said in the original post, all non-Java applications do not
>display this symptom. I

on the other paw, people running other Java apps on other platforms
don't see your problem. So the problem could be with:

1. your app

2. some sort of tables unique to the Ubuntu-Java combo you are using.

Roedy Green

unread,
Apr 18, 2009, 11:01:55 AM4/18/09
to
On Wed, 15 Apr 2009 12:46:35 -0400, "John B. Matthews"
<nos...@nospam.invalid> wrote, quoted or indirectly quoted someone who
said :

>Ah, only Java applications display the symptom. I'm sure you've also

>verified that you have only one JDK/JRE installed.

Right. An old Java would not know about recent fiddle in start time.

Roedy Green

unread,
Apr 18, 2009, 11:51:54 AM4/18/09
to
On Tue, 14 Apr 2009 22:25:48 -0700 (PDT), David Karr
<davidmic...@gmail.com> wrote, quoted or indirectly quoted
someone who said :

> public static void main(String[] args)

add this piece of code:

Roedy Green

unread,
Apr 18, 2009, 11:53:34 AM4/18/09
to
On Sat, 18 Apr 2009 08:51:54 -0700, Roedy Green
<see_w...@mindprod.com.invalid> wrote, quoted or indirectly quoted
someone who said :

>> public static void main(String[] args)
>
>add this piece of code:

out.println( System.getProperty( "java.version" ) );

Lew

unread,
Apr 18, 2009, 1:36:25 PM4/18/09
to
David Karr

>> No, as I said in the original post, all non-Java applications do not
>> display this symptom. I

Roedy Green wrote:
> on the other paw, people running other Java apps on other platforms
> don't see your problem. So the problem could be with:
>
> 1. your app
>
> 2. some sort of tables unique to the Ubuntu-Java combo you are using.

I'm running Java 1.6.0-13 on Ubuntu 8.10 and the OP's test program (modified
to coerce the same date/time as his example) shows:

date[Mon Apr 13 16:04:01 EDT 2009] zonename[Pacific Standard Time]
dstSavings[3600000] usesDST[true] inDST[true] rawOffset[-28800000]
offset[-25200000]
date[Mon Apr 13 13:04:01 PDT 2009] inDST[true]


date[Wed May 13 13:04:01 PDT 2009] inDST[true]
date[Sat Jun 13 13:04:01 PDT 2009] inDST[true]
date[Mon Jul 13 13:04:01 PDT 2009] inDST[true]
date[Thu Aug 13 13:04:01 PDT 2009] inDST[true]
date[Sun Sep 13 13:04:01 PDT 2009] inDST[true]
date[Tue Oct 13 13:04:01 PDT 2009] inDST[true]
date[Fri Nov 13 13:04:01 PST 2009] inDST[false]
date[Sun Dec 13 13:04:01 PST 2009] inDST[false]
date[Wed Jan 13 13:04:01 PST 2010] inDST[false]
date[Sat Feb 13 13:04:01 PST 2010] inDST[false]
date[Sat Mar 13 13:04:01 PST 2010] inDST[false]

date[Sun Apr 26 24:00:00 PDT 2009] inDST[true]
date[Mon Apr 27 24:00:00 PDT 2009] inDST[true]
date[Sun Oct 25 24:00:00 PDT 2009] inDST[true]
date[Mon Oct 26 24:00:00 PDT 2009] inDST[true]

--
Lew

David Karr

unread,
Apr 19, 2009, 10:59:40 AM4/19/09
to
On Apr 16, 10:03 am, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:

Unsurprisingly, I just got the update yesterday morning for tzdata and
tzdata-java 2009f, and after running it, my /etc/localtime was now a
hard file, and my test failed again. I restored it as a symlink, and
then the test succeeded again. The file list for either of those
packages does not include /etc/localtime, but "tzdata" does include
the file that I have /etc/localtime symlinked to. That's my best
guess of the package that could be doing this, but I'm not certain how
the installation process works.

Knute Johnson

unread,
Apr 19, 2009, 11:22:21 AM4/19/09
to

David:

I did not get the tzdata-java update and my link was overwritten so it
must be the tzdata package that's causing the problem. I'm not a Linux
expert by any stretch but do you think a hard link would survive the
overwrite or will it not work correctly once the linked file has been
overwritten?

Mayeul

unread,
Apr 20, 2009, 5:48:26 AM4/20/09
to

I'm not sure about the hard linking question, and would need to test for it.

But anyway, since the linux distribution decided to have /etc/localtime
as a copy of some file in /usr/share/zoneinfo, it would only be logical
that an update of tzdata would automatically update /etc/localtime too,
making it a copy of the same possibly-updated file in /usr/share/zoneinfo.

That's what Ubuntu looks like doing for me when I update
/usr/share/zoneinfo : remove the link and put a plain file that is a
copy of /usr/share/zoneinfo/Europe/Paris. Annoying but consistent with
the breaking behavior in the first place.

I suppose it does it with some post-update script.

--
Mayeul

John B. Matthews

unread,
Apr 20, 2009, 9:48:39 AM4/20/09
to
In article <49ec44d2$0$29470$426a...@news.free.fr>,
Mayeul <mayeul....@free.fr> wrote:

[...]


> But anyway, since the linux distribution decided to have
> /etc/localtime as a copy of some file in /usr/share/zoneinfo, it
> would only be logical that an update of tzdata would automatically
> update /etc/localtime too, making it a copy of the same
> possibly-updated file in /usr/share/zoneinfo.
>
> That's what Ubuntu looks like doing for me when I update
> /usr/share/zoneinfo : remove the link and put a plain file that is a
> copy of /usr/share/zoneinfo/Europe/Paris. Annoying but consistent
> with the breaking behavior in the first place.
>
> I suppose it does it with some post-update script.

I went back through some logs on older Ubuntu distributions (6 & 7).
Using apt-get, an update to the package "locales" always left an
existing soft link in /etc/localtime alone.

David Karr

unread,
Apr 20, 2009, 7:35:31 PM4/20/09
to

Yes, it was pointed out to me that "/var/lib/dpkg/info/
tzdata.postinst" has the following block of code:

# Update the timezone
echo $AREA/$ZONE > /etc/timezone
rm -f /etc/localtime && \
cp -f /usr/share/zoneinfo/$AREA/$ZONE /etc/localtime

0 new messages