How to subtract one date time variable from another to find the difference in minutes

  • Thread starter Thread starter Vassann
  • Start date Start date
V

Vassann

Guest
I am trying to subtract one date time variable from another to find the difference in minutes. I have learned that you first have to fill up a systemtime structure, then transfer this to a filetime structure and then transfer this to an ULARGER integer. So I do the following:

SYSTEMTIME RegTime;
FILETIME RgTime;
ULARGE_INTEGER RTime
ULONGLONG R1
ULONGLONG R2

RegTime.wMinute = 10;
RegTime.wYear = 18;
RegTime.wDay = 5;
RegTime.wHour = 19;
RegTime.wMonth = 8;

SystemTimeToFileTime( &RegTime, &RgTime);
memcpy(&Rtime, &RgTime, sizeof(Rtime));
R1 = Rtime.QuadPart / 600000000;

RegTime.wMinute = 43;
RegTime.wYear = 18;
RegTime.wDay = 5;
RegTime.wHour = 18;
RegTime.wMonth = 8;

SystemTimeToFileTime( &RegTime, &RgTime);
memcpy(&Rtime, &RgTime, sizeof(Rtime));
R2 = Rtime.QuadPart / 600000000;


The issue is that R1 and R2 gets the same value, and I have no idea why. Could anyone help me?

Thanks in advance.

Continue reading...
 
Back
Top