Click to See Complete Forum and Search --> : time difference


C.Schlue
March 26th, 2003, 05:04 AM
Does anybody of you know (where to find) a good logarythm to calculate the difference between to SYSTEMTIMEs in Hours

NigelQ
March 26th, 2003, 10:28 AM
This is my second posting of this as the server didn't accept the first (destroying it in the process :rolleyes: ) - apologies if this is duplicated...

Use SystemTimeToFileTime to convert the structure to a FILETIME variable.

Then, copy the contents of the new FILETIME variable to a ULARGE_INTEGER variable.

Use the ULARGE_INTEGER's .QuadPart member to perform calculations on the time (such as subtracting one time from another)

The values being handled by the ULARGE_INTEGER will be the same units as used by the FILETIME data structure, which is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601.

Once you have finished your addition or subtraction, you can divide out the result to give you hours or any other value you need as long as it is a multiple of 100 nanoseconds.

(Dividing by 36000000000 sounds like a good place to start ;) )

Hope this helps,

- Nigel