Thanks Steve.  This turned out to be a combination of user error and a
lack of understanding of how Joda works.

First, the jars deployed to each of the hosts in my original post were
slightly different.  This accounted for the different behavior on WinXP
vs. Linux.

Second, it took a while for me to understand what the "Illegal instant
due to time zone offset transition" exception was trying to tell me.
Namely that the DateTime(year, month, day, hour, minute, second, millis)
constructor doesn't support DST transitions.  Having an explanation of
this error in the javadoc would be helpful.  Joda newbies (like me) need
to understand that DateTime isn't appropriate in some use cases.  In my
case the code needs to find start of day for an arbitrary date & time.
I ended up changing the code that used the above DateTime constructor to
use the following instead:

       LocalDate ld = new LocalDate(yr, mo, dy);
       aDT = ld.toDateTimeAtStartOfDay(mJodaDTZ);

Cheers,
Rich

> -----Original Message-----
> From: Stephen Colebourne [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 05, 2008 6:19 AM
> To: Discussion of the Joda project
> Subject: Re: [Joda-interest] Brazil DST problem
> 
> The operating system should have no effect when creating a DateTime in
> this manner. The only factor that matters is the time zone information
> stored in the joda-time jar file.
> 
> As such, there should be no difference between running the same jar
file
> on two different systems in this way. (The operating system affects
what
> the current time is, but not when creating using field values like
this.)
> 
> Stephen
> 
> 
> Youngkin, Richard Shaffer (Rich) wrote:
> > I'm trying to resolve a perplexing problem related to the recent
changes
> > made to Brazil's DST rules.  I've recompiled the latest Joda source
> > (1.5.2) with the latest tz database from twinsum.com
> > <http://www.twinsun.com/tz/tz-link.htm>.  Here's the code snippet
that
> > is causing me problems.
> >
> >
> >
> >    DateTimeZone dtz =
> > org.joda.time.DateTimeZone./forID/(*"America/Sao_Paulo"*);
> >
> >    DateTime dateTime = *new* DateTime(2008, 10, 19, 0, 0, 0, 0,
dtz);
> >
> >
> >
> > When running this code snippet on a WinXP host with an older version
of
> > the database and Joda (1.3) I get the following Exception on the
2^nd
> line:
> >
> >    java.lang.IllegalArgumentException: Illegal instant due to time
zone
> > offset transition: 2008-10-19T02:00:00.000
> >
> >         at
> >
>
org.joda.time.chrono.ZonedChronology.localToUTC(ZonedChronology.java:143
)
> >
> >         at
> >
>
org.joda.time.chrono.ZonedChronology.getDateTimeMillis(ZonedChronology.j
av
> a:119)
> >
> >
> >
> > When running this code snippet on WinXP with the *new* joda jar
created
> > from the latest joda source and tz database everything works
swimmingly.
> >
> >
> >
> > So far so good.  But now the problem.  I need to run this same code
on
> > Redhat Linux Enterprise 4 update 5.  When running this code with the
> > most recent joda/tz jar I created I get almost the same problem I
get
> > when running with the older jar.  I say "almost" because the time
> > reported in the "Illegal instant" exception changes from
> > 2008-10-19T02:00:00.000 to 2008-10-19T03:00:00.000, i.e., the
reported
> > problem time moves from 2am to 3am.  I updated /usr/share/zoneinfo
(and
> > /etc/localtime) with the new tz database, but that didn't change the
> > results.
> >
> >
> >
> > Any ideas on what might explain this, and any suggested
resolution(s),
> > would be greatly appreciated.
> >
> >
> > Thanks,
> > Rich
> >
> >
> >
> >
------------------------------------------------------------------------
> >
> > Rich Youngkin / [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> /
> > (303)538-5085
> >
> > Confidentiality Notice: This email contains information from Avaya
Inc
> > and is intended for the addressee only. This communication, and any
> > accompanying file attachments, may contain confidential or
privileged
> > material and are subject to the confidentiality provisions of your
> > signed agreement with Avaya. If you are not the intended recipient,
any
> > use, distribution, or disclosure of this communication is strictly
> > prohibited. Please contact the sender if you were sent this message
in
> > error and destroy all copies of the original message.
> >
> >
> >
> >
> >
> >
> >
> >
------------------------------------------------------------------------
> >
> > Rich Youngkin / [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> /
> > (303)538-5085
> >
> > Confidentiality Notice: This email contains information from Avaya
Inc
> > and is intended for the addressee only. This communication, and any
> > accompanying file attachments, may contain confidential or
privileged
> > material and are subject to the confidentiality provisions of your
> > signed agreement with Avaya. If you are not the intended recipient,
any
> > use, distribution, or disclosure of this communication is strictly
> > prohibited. Please contact the sender if you were sent this message
in
> > error and destroy all copies of the original message.
> >
> >
> >
> >
> >
------------------------------------------------------------------------
> >
> >
------------------------------------------------------------------------
> -
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> > Build the coolest Linux based applications with Moblin SDK & win
great
> prizes
> > Grand prize is a trip for two to an Open Source event anywhere in
the
> world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >
> >
> >
------------------------------------------------------------------------
> >
> > _______________________________________________
> > Joda-interest mailing list
> > Joda-interest@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/joda-interest
> 
>
------------------------------------------------------------------------
-
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to