com4j icon indicating copy to clipboard operation
com4j copied to clipboard

IADsUser.accountExpirationDate() uses wrong epoch time for date calculations

Open jvz opened this issue 4 years ago • 1 comments

https://docs.microsoft.com/en-us/windows/win32/adschema/a-accountexpires

The date when the account expires. This value represents the number of 100-nanosecond intervals since January 1, 1601 (UTC). A value of 0 or 0x7FFFFFFFFFFFFFFF (9223372036854775807) indicates that the account never expires.

The com4j version is using 1900 instead of 1601 which throws off date calculations considerably.

jvz avatar Nov 16 '20 22:11 jvz

Interestingly enough, upon further investigation, the date is somehow being parsed properly, but a timestamp of Mon Jan 01 00:00:00 GMT 1601 is equivalent to the value being 0 from the documentation.

jvz avatar Nov 17 '20 21:11 jvz