Archived Forum Post

Index of archived forum posts


There appears to be a bug in CkDateTime for ActiveX

Nov 26 '14 at 13:19

Using the GetAsDosDate in the CkDateTime class in the ActiveX version of the Chilkat library (not sure about other versions) does not work correctly. When I use SetFromCurrentSystemTime to set the time and them use GetAsDosDate(1) and GetAsDosDate(0), the first one is supposed to be based on local time, and the second one should return a value based on GMT. However they return identical values. In my test, here's the date and time in normal VB6 format returned from the VB6 Now function: 11/23/2014 5:57:41 PM

Here's the value returned from GetAsDosDate(1): 1165463349

Here's the value returned from GetAsDosDate(0): 1165463349

And further more, my test also had a to extract the hour that's encoded in the DosDate value. The General function is (GetAsDosDate(1) 2048) AND 31, where " 2048" is an integer division and is equivalent to a bitshift to the right by 11 bits. And "AND 31" is a 5 bit mask. My test program used it twice, once in conjunction with GetAsDosDate(1), and once in conjunction with GetAsDosDate(0). The results are as seen below.

Here's the value returned from (GetAsDosDate(1) 2048) AND 31: 17

Here's the value returned from (GetAsDosDate(0) 2048) AND 31: 17

It shows the same hour, even though GMT is supposed to be 8 hours more than the local time version, which would be (17 + 8) Mod 24 = 1. But intead of the GMT hour showing as 1, it showed as 17, the same as local time.

Please fix this in the next version of your Chilkat ActiveX DLL

Accepted Answer

This new build should fix it:

32-bit Download:

64-bit Download:


Thanks! I'll have a look and will post a pre-release download with the fix as soon as possible.