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:
- http://support.microsoft.com/kb/928388 (describes the registry layout for historical DST information in Vista)
- http://msdn2.microsoft.com/en-us/library/ms724253.aspx (describes the new unmanaged API for accessing the historical DST info)
- http://msdn2.microsoft.com:80/en-us/vstudio/bb264729.aspx (describes future plans to implement a managed API for historical DST information in Orcas)
- http://msdn2.microsoft.com/en-us/library/ms724253.aspx (describes the new unmanaged API for accessing the historical DST info)