Here is some code of mine for seeing if a printer job, jobs[0], is more than 5 minutes old
FILETIME syst, jobt
LARGE_INTEGER syst2, jobt2, dt
GetSystemTimeAsFileTime(&syst)
SystemTimeToFileTime(&jobs[0].Submitted, &jobt)
syst2.HighPart = syst.dwHighDateTime
syst2.LowPart = syst.dwLowDateTime
jobt2.HighPart = jobt.dwHighDateTime
jobt2.LowPart = jobt.dwLowDateTime
dt.QuadPart = syst2.QuadPart - jobt2.QuadPart
if (dt.QuadPart > (5 * 600000000)) // 5 minutes in hundreds of nanosecond
return = true
else return = false
Is this the correct way of the doing the LARGE_INTEGER arithmetic? Or am I overlooking something? Thanks in advance!
Need Helps - 28 May 2004 21:36 GMT
I should have mentioned that the code works for 1 and 2 minutes in place of the 5 in the 'if' statement, but for some reason does not work for the 5. Regardless of how hold the job is, it returns true if I put a 5 in there, but not for a 2 or a 1.
Carl Daniel [VC++ MVP] - 29 May 2004 00:24 GMT
> Here is some code of mine for seeing if a printer job, jobs[0], is
> more than 5 minutes old:
[quoted text clipped - 12 lines]
>
> if (dt.QuadPart > (5 * 600000000)) // 5 minutes in hundreds of
write this as 5*600000000I64 so that it's done as a 64-bit multiply.
The problem you're having is that you're overrunning a 32-bit signed integer
.
-cd
Need Helps - 29 May 2004 19:41 GMT
THANK YOU very much. That should complete my first Win32 project. =)