Windows 将_uint64转换为FileTime
我有一个代码,它使用 uint64当前UTCFileTime; GetSystemTimeAsFileTime((FILETIME*)和currentUtcFileTime)Windows 将_uint64转换为FileTime,windows,uint64,filetime,Windows,Uint64,Filetime,我有一个代码,它使用 uint64当前UTCFileTime; GetSystemTimeAsFileTime((FILETIME*)和currentUtcFileTime) 现在我想将这个uint64转换回FILETIME。我搜索了很长时间,最终得到了这个解决方案- 文件时间ftime; __int64-i64 *(_int64*)&ftime=i64 它对我来说效果很好:)FILETIME是4字节(DWORD)对齐结构。通常,it地址不是多个8x字节。当然,在x86/x64上这不是问题,但在
现在我想将这个uint64转换回FILETIME。我搜索了很长时间,最终得到了这个解决方案- 文件时间ftime; __int64-i64 *(_int64*)&ftime=i64
它对我来说效果很好:)
FILETIME
是4字节(DWORD
)对齐结构。通常,it地址不是多个8x字节。当然,在x86/x64上这不是问题,但在其他平台上可能是错误的。您需要使用LODWORD
和HIDWORD
宏或强制将每个DWORD
分别赋值,或将其与8个字节对齐,如union{uu int64 align;FILETIME ft;}代码>