Blog

More about JNBridgePro and the new daylight savings time rules

There’s a very interesting problem with Microsoft’s DST patch for Windows that you should be aware of, since it can impact date conversion results when mapped date proxies are used.  The patch applies the new rules for whether date and time are daylight savings time without regard to year.  This means that if you ask .NET whether a given DateTime in the past is DST, it will apply the new rules even if the date would have been standard time under the old rules.

Consider November 1, 2006.  It was not DST.  However, had the new rules been in effect at the time, it would have been DST.  Now consider the following code:

DateTime date = new DateTime(2006, 11, 1);
bool isDST = date.IsDaylightSavingTime();

If the DST patch has been applied to your system, then isDST will be true, which is incorrect.

What does this mean for JNBridgePro?  It means that, for those dates in the past for which the old and new DST rules conflict, then use of mapped date proxies will cause conversion of dates to be off by one hour in certain cases.  It will only happen with dates in 2006 and earlier, and will only happen during a two-week period in March/April and during a one-week period in October/November.  If you are using mapped date proxies to convert future dates, or are using by-reference proxies for dates, you will see no problem, as long as you have updated your Windows and Java according to the instructions mentioned in the previous post.

We are looking into things that can be done, but there may not be much we can do, since JNBridgePro relies on the underlying .NET and Java  for its DST information and is relying on that information to be correct.  If you have an application that relies on conversion of times from past years, you may want to add your own logic to correct the conversions during those periods in past years where Windows’ DST information is incorrect.

Update: While historical DST information does not exist in Windows XP, it does exist in Windows Vista.  We will look into incorporating this historical DST information in an upcoming version of JNBridgePro.  In the meantime, if you’d like to add logic to your applications to handle historical DST information, please see the following references:

JNBridgePro and Daylight Savings Time

In the US and Canada, Daylight Savings Time (DST) will begin three weeks earlier than previously, and will end one week later.  We’ve been asked whether JNBridgePro will properly handle these changes.  The answer is yes, it will.  However, you will need to make sure that your underlying Windows and Java systems have been updated to handle the DST changes.  In addition, you should make sure that the applications that you’re bridging can handle the DST changes or if they need to be patched.

Full information on how Windows and other Microsoft applications are affected by the DST changes and how they can be updated can be found at http://www.microsoft.com/dst2007.

Sun has information on how DST changes can affect Java here: http://java.sun.com/developer/technicalArticles/Intl/USDST/