The Joda-Time default is inherited from the JDK TimeZone default. This
is in turn inherited from the syste properties (from JDK1.5):
private static void setDefaultZone() {
TimeZone tz = null;
// get the time zone ID from the system properties
String zoneID = (String) AccessController.doPrivileged(
new GetPropertyAction("user.timezone"));
// if the time zone ID is not set (yet), perform the
// platform to Java time zone ID mapping.
if (zoneID == null || zoneID.equals("")) {
String country = (String) AccessController.doPrivileged(
new GetPropertyAction("user.country"));
String javaHome = (String) AccessController.doPrivileged(
new GetPropertyAction("java.home"));
try {
zoneID = getSystemTimeZoneID(javaHome, country);
if (zoneID == null) {
zoneID = GMT_ID;
}
} catch (NullPointerException e) {
zoneID = GMT_ID;
}
}
// Get the time zone for zoneID. But not fall back to
// "GMT" here.
tz = getTimeZone(zoneID, false);
if (tz == null) {
// If the given zone ID is unknown in Java, try to
// get the GMT-offset-based time zone ID,
// a.k.a. custom time zone ID (e.g., "GMT-08:00").
String gmtOffsetID = getSystemGMTOffsetID();
if (gmtOffsetID != null) {
zoneID = gmtOffsetID;
}
tz = getTimeZone(zoneID, true);
}
assert tz != null;
final String id = zoneID;
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
System.setProperty("user.timezone", id);
return null;
}
});
defaultZoneTL.set(tz);
}
Stephen
Kevin Bourrillion wrote:
> We were able to fix things for him by running the tests with a TZ
> environment variable set, to America/Los_Angeles. I still don't
> understand why we had to do this. For me, with no TZ set, it just
> works. Where does the default come from, anyone know?
>
> thanks,
> K
>
>
> On 8/14/06, Kevin Bourrillion <[EMAIL PROTECTED]> wrote:
>
>>Hey,
>>
>>One of our team members is getting a spate of test failures that look like:
>>
>>junit.framework.AssertionFailedError: expected:<Thu Jul 31 18:15:30
>>GMT-08:00 2008> but was:<Thu Jul 31 17:15:30 GMT-08:00 2008>
>>
>>or sometimes even the expected and actual appear identical.
>>
>>When I had this problem it turned out to be because I had a TZ
>>variable set, and I unset it and that fixed it. But in this guy's
>>case, we can't see anything strange in his environment. He's
>>definitely using JDK 1.5.0_06 as are we...
>>
>>And if he just does a "new DateTime().toString()" it reports a time an
>>hour earlier than now and it reports -08:00 even though we're in
>>daylight time now so I think it should be -07:00.
>>
>>What the?
>>
>>Not sure if it could be related to his bleeding-edge version of ubuntu
>>that he's using (dapper drake; I'm on breezy badger).
>>
>>Any ideas? thanks,
>>
>>K
>>
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest