一直对FILETIME中的参数不太了解是什么意思, 也不知道怎么比较先后,之前都是转成systemtime再比较,感觉有点麻烦。终于发现有个API可以直接比较,CompareFileTime,具体的可以查MSDN。
CompareFileTime
The CompareFileTime function compares two file times.
LONG CompareFileTime( const FILETIME* lpFileTime1, const FILETIME* lpFileTime2 );
Parameters
-
lpFileTime1
- [in] Pointer to a FILETIME structure that specifies the first file time. lpFileTime2
- [in] Pointer to a FILETIME structure that specifies the second file time.
Return Values
The return value is one of the following values.
| Return value | Description |
|---|---|
-1 | First file time is earlier than second file time. |
0 | First file time is equal to second file time. |
1 | First file time is later than second file time. |
本文介绍了一种直接比较FILETIME结构中文件时间的方法,避免了转换为SYSTEMTIME的繁琐过程。通过使用CompareFileTime API,可以轻松判断两个文件时间的先后顺序。
5万+

被折叠的 条评论
为什么被折叠?



