-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #1460 - conversion of win32 variant dates within DST offset windows #1461
Conversation
Change looks good to me. I would have preferred a pure-java way, but using the native function looks reasonable. Appveyor is also happy. Please:
For the latter you can check the info using the call https://www.git-tower.com/learn/git/faq/change-author-name-email |
- java.util.Calendar for converting between UTC and local time, and - win32 APIs for converting between local time and variant date. - some correction logic around the latter for maintaining millisecond values Benefits: 1. fixes conversion of dates within DST offset windows 2. fixes conversion of dates with millisecond values 3. relatively simple logic, avoiding the reconstruction of complex calculations implemented in the above APIs
Thanks for your feedback.
Done
I updated my real name. For email, I've followed these guidelines for private addresses. |
Please use a real e-mail adress for author information. |
@eranl any update on this? |
I would like to avoid exposing my email address publicly. GitHub supports a way to identify authors and communicate with them while keeping their email addresses private, so I'd like to continue using that. |
Regrettably then someone else needs to redo the work. I will not merge without full author information. |
Ok, I give up. Just updated my email address. |
The main goal here is to fix #1460, which I found can be done in a straightforward way by using:
While testing the fix, I realized that dates with non-zero millisecond values were not converted correctly by the win32 APIs, so I added some correction logic for preserving millisecond values. BTW, I found that the existing implementation didn't handle some millisecond values correctly either.
Overall, this is relatively simple logic, avoiding the reconstruction of complex calculations provided by the above APIs.
Added OleAuto.VariantTimeToSystemTime and a test for it.
Added tests for DST offset window that fails with existing logic, and tests for millisecond dates, some of which fail with existing logic.
Note: OaIdl.DATE_OFFSET is not used anymore, but I left it in since it's declared public.