Getting the difference between two SYSTEMTIME variables

For example, my code is as follows.

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 ie // 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 } 
+4
source share
1 answer

Convert both SYSTEMTIME structures to FILETIME with

 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 ULONGLONG to get the time difference in HectoNanoSec

+1
source

All Articles