Prev: Please help, how do I fix error C4346 with the code here...
Next: Memory acces completely optimized away
From: neilsolent on 31 Oct 2009 03:24 > >One further question - is there an inverse function to this: > > >void TimetToFileTime(time_t t, LPFILETIME pft) > > >.. I need to convert FILETIME back to time_t in another part of the > >code. > > I can't immediately find one to copy, but that example on MSDN is only > simple maths, so just to the inverse operations. Here's my working implementation - just to wrap this thread up: [code] void FileTimeToTimet(LPFILETIME pft, time_t* t) { *t = (((pft->dwHighDateTime - 27111902) << 32) - 3577643008 + pft- >dwLowDateTime) / 10000000; } [/code]
From: neilsolent on 31 Oct 2009 19:32 > >.. I need to convert FILETIME back to time_t in another part of the > >code. > > I can't immediately find one to copy, but that example on MSDN is only > simple maths, so just to the inverse operations. > > Dave Here's my implementation (removed previous post - had overflow error with larger dates): [code] time_t FileTimeToTimet(LPFILETIME pft) { ULONGLONG ull = UInt32x32To64((pft->dwHighDateTime - 27111902) * 2, 2147483648) + pft->dwLowDateTime - 3577643008; return (time_t) (ull / 10000000); } [/code]
First
|
Prev
|
Pages: 1 2 3 Prev: Please help, how do I fix error C4346 with the code here... Next: Memory acces completely optimized away |