|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
Re: discussion about UTC/GMT, isDuring() and getFeasiblePosition(moving this discussion from an email thread to the forum)
Hi Ulrich, There is no such thing as UTC time zone in Java. Let's have a quick look at the TimeZone class. If a given zone id is not found in the lib/zi folder the code falls back and returns GMT. If you think that GMT sounds confusing lets use Etc/UTC instead. I attached a patch for either ways. Even better solution is a class org.activequant.core.Constants with project wide defaults (like TIMEZONE_UTC). I volunteer to crate a patch. What do you think? Regards, Kirill aq-base-upgrade-to-GMT.patch aq-base-upgrade-to-Etc-UTC.patch Links related to this discussion: FileNotFoundException-in-TimeStampFormat www.quickfixj.org/jira/browse/QFJ-264 /** * Gets the <code>TimeZone</code> for the given ID. * * @param ID the ID for a <code>TimeZone</code>, either an abbreviation * such as "PST", a full name such as "America/Los_Angeles", or a custom * ID such as "GMT-8:00". Note that the support of abbreviations is * for JDK 1.1.x compatibility only and full names should be used. * * @return the specified <code>TimeZone</code>, or the GMT zone if the given ID * cannot be understood. */ public static synchronized TimeZone getTimeZone(String ID) { return getTimeZone(ID, true); } private static TimeZone getTimeZone(String ID, boolean fallback) { TimeZone tz = ZoneInfo.getTimeZone(ID); if (tz == null) { tz = parseCustomTimeZone(ID); if (tz == null && fallback) { tz = new ZoneInfo(GMT_ID, 0); } } return tz; }
|
| Free embeddable forum powered by Nabble | Forum Help |