made wxFileName::Set/GetTimes() work under Win32

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-10-31 02:42:50 +00:00
parent 7de3c4699f
commit d56e2b972f
2 changed files with 73 additions and 7 deletions

View File

@@ -120,14 +120,32 @@ private:
// convert between wxDateTime and FILETIME which is a 64-bit value representing
// the number of 100-nanosecond intervals since January 1, 1601.
static void ConvertWxToFileTime(FILETIME *ft, const wxDateTime& dt)
{
// TODO
}
// the number of milliseconds between the Unix Epoch (January 1, 1970) and the
// FILETIME reference point (January 1, 1601)
static const wxLongLong FILETIME_EPOCH_OFFSET = wxLongLong(0xa97, 0x30b66800);
static void ConvertFileTimeToWx(wxDateTime *dt, const FILETIME &ft)
{
// TODO
wxLongLong ll(ft.dwHighDateTime, ft.dwLowDateTime);
// convert 100ns to ms
ll /= 10000;
// move it to our Epoch
ll -= FILETIME_EPOCH_OFFSET;
*dt = wxDateTime(ll);
}
static void ConvertWxToFileTime(FILETIME *ft, const wxDateTime& dt)
{
// do the reverse of ConvertFileTimeToWx()
wxLongLong ll = dt.GetValue();
ll *= 10000;
ll += FILETIME_EPOCH_OFFSET;
ft->dwHighDateTime = ll.GetHi();
ft->dwLowDateTime = ll.GetLo();
}
#endif // __WIN32__