开发者

getting difference between two SYSTEMTIME variable

For Example my code is as follows.

void main()

{

       SYSTEMTIME LocalTime_Start = { 0 };

        GetLocalTime( &LocalTime_Start );

        SYSTEMTIME LocalTime_End = { 0 };
        // Some 开发者_JAVA百科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
}


Convert both SYSTEMTIME structures to FILETIME using

FILTETIME ft;
::SystemTimeToFileTime(&sysTime, &ft);

Convert FILETIME to ULONGLONG using:

ULARGE_INTEGER uli;
uli.LowPart = ft.dwLowDateTime ;
uli.HighPart= ft.dwHighDateTime;
ULONGLONG uft= uli.QuadPart;

Subtract ULONGLONGs to get time difference in HectoNanoSec

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜