一直對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. |