I want to get difference between two SYSTEMTIME variable. I saw someone asked this question here before, but he was told to convert both SYSTEMTIME structures to FILETIME.. Is there another way to get the difference?
SYSTEMTIME st;
GetSystemTime(&st);
---some code here---
SYSTEMTIME st2;
GetSystemTime(&st2);
st-st2?
SYSTEMTIME operator-(const SYSTEMTIME& pSr,const SYSTEMTIME& pSl)
{
SYSTEMTIME t_res;
FILETIME v_ftime;
ULARGE_INTEGER v_ui;
__int64 v_right,v_left,v_res;
SystemTimeToFileTime(&pSr,&v_ftime);
v_ui.LowPart=v_ftime.dwLowDateTime;
v_ui.HighPart=v_ftime.dwHighDateTime;
v_right=v_ui.QuadPart;
SystemTimeToFileTime(&pSl,&v_ftime);
v_ui.LowPart=v_ftime.dwLowDateTime;
v_ui.HighPart=v_ftime.dwHighDateTime;
v_left=v_ui.QuadPart;
v_res=v_right-v_left;
v_ui.QuadPart=v_res;
v_ftime.dwLowDateTime=v_ui.LowPart;
v_ftime.dwHighDateTime=v_ui.HighPart;
FileTimeToSystemTime(&v_ftime,&t_res);
return t_res;
}