Help
-
can anyone tell me to create a program that can tell the difference between to dates. Even leap years? I really need help. I have been trying to do it for the past two weeks and I still get errors.
Helps to post exactly what you're having problems with.
-
can anyone tell me to create a program that can tell the difference between to dates. Even leap years? I really need help. I have been trying to do it for the past two weeks and I still get errors.
Would this be your homework ? If you've been trying for two weeks, you must have some code you can post ? Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
can anyone tell me to create a program that can tell the difference between to dates. Even leap years? I really need help. I have been trying to do it for the past two weeks and I still get errors.
The normal approach is to convert the dates into some numeric format, from which you can then perform the subtraction and convert back to days, weeks etc. In Windows you would normally set up a
SYSTEMTIME
structure, convert it to aFILETIME
withSystemTimeToFileTime
, copy the two parts ofFILETIME
into aLARGE_INTEGER
, then do 64-bit arithmetic on theQuadPart
member. AFILETIME
is in 100ns (0.1us, or 1 x 10 ^ -7 s) intervals. If the code needs to be portable (e.g. to work on Unixes) you might prefer looking at the C standard library routines, thetm
structure and thetime_t
numeric type.