in reply to Win32 FILETIME and 64-bit numbers

My module Win32::Filetime takes a file path as an argument, and creates a windows file handle. With that file handle it's simple to perform the necessary calculations. I let the windows API do all the work. from the windows API Documentation file time is defined like so:
typedef struct _FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; } FILETIME, *PFILETIME;
A little confusing as the bits need to be packed in the reverse order of the filetime integer. I plan to add a class method to directly decode the 64 bit-integer to that module, only problem is that i only encounter VT_FILETIME as a pointer to a struct through the API. Where else does this (bizzarre) time format crop up in the wild? I'd like to test it the raw integer but I've not yet seen a function that returns it in this form.

Replies are listed 'Best First'.
Re: Re: Win32 FILETIME and 64-bit numbers
by John M. Dlugosz (Monsignor) on Aug 06, 2002 at 19:58 UTC
    Yes, I took out the part I really needed. I have the 64-bit ints stored in a file, not the actual timestamp of the file.

    I think VT_FILETIME is a COM/OLE name. I'm used to FILETIME in the Win32 API. It's used for timestamps and also for file sizes and offsets. In some functions the WINDOWS.H file passes the low and high halves as two 32-bit values, presumably so it would be compatible with compilers that didn't support __int64. For return values, I know one where the function return value is the low 32 bits, and the high 32 bits is in an out parameter!

    Naturally, I get rid of all that nonesence. I import the Win32 DLL's functions with int64 arguments (and structure members) when they are indeed that. In one case they have the halves backwards (sigh) so I have a wrapper to put it back together again.

    —John