Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing two system times

Status
Not open for further replies.

MadWombat

Programmer
Feb 3, 2001
4
CA
Hi everyone,

I'm having some troubles comparing times with Visual C++. What I want to do is compare the starting time of an action to its end time in order to figure out how long it took.

Now, I can get the time as two DWORDs by using GetSystemTimeAsFileTime(), but I can't subtract them to get the difference. I saw something about converting them to U_LARGE or some such, and was wondering how to go about that, and what to do once I managed.

Any help on this would be most appreciated.

Thanks,

Paul
 
This is the code that causes an error (I can't figure out why).

ULARGE_INTEGER time1, time2;

time1.LowPart = m_end_time->dwLowDateTime;
time1.HighPart = m_end_time->dwHighDateTime;
time2.LowPart = m_start_time->dwLowDateTime;
time2.HighPart = m_start_time->dwHighDateTime;
time1.QuadPart = time1.QuadPart - time2.QuadPart;

Thanks,

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top