例如我的代码如下。
void main()
{
SYSTEMTIME LocalTime_Start = { 0 };
GetLocalTime( &LocalTime_Start );
SYSTEMTIME LocalTime_End = { 0 };
// Some program Statements
GetLocalTime( &LocalTime_End );
// Now i want difference of two i.e.
// can i do as following
SYSTEMTIME localTime_diff = LocalTime_End - LocalTime_Start;
// guys please let me know how to achieve that asap...thanks a lot in advance
}
答案 0 :(得分:1)
使用
将SYSTEMTIME结构转换为FILETIMEFILTETIME ft;
::SystemTimeToFileTime(&sysTime, &ft);
使用以下方法将FILETIME转换为ULONGLONG:
ULARGE_INTEGER uli;
uli.LowPart = ft.dwLowDateTime ;
uli.HighPart= ft.dwHighDateTime;
ULONGLONG uft= uli.QuadPart;
减去ULONGLONG以获得HectoNanoSec的时差