Hi. I have some C/C++ (COM) code I need to use to determine the difference between today's date and a date pulled from a SQL database, and return an error if the difference is greater than 60 days (5184000 seconds). I am using time_t structures to store the DateTime data type that I get from the database. My code is not working, and I'm wondering if there's a better way to store and manipulate the DateTime from the datbase in the COM. Any tips? Here is the code:
time_t currenttime;
currenttime = time(NULL);
time_t oldtime;
//Get previous date/time
m_vConDB.GetField(oldtime, 2);
if ((oldtime == NULL) || (difftime (oldtime,(long)localtime(¤ttime)) > 5184000))
{
return HandleErr(S_FALSE, pError);
}