I have to update an old date class for one of my assignment and I'm stuck on this function I have to redo.
The function needs to return a Bool if the operation is possible.
What I want to do is subtract days with ColeDateTimeSpan to a ColeDateTime
I know I can do something like this :
int i = 2;    
COleDateTime time_DT = COleDateTime(2014, 2, 20, 0, 0, 0);
COleDateTimeSpan time_SP = COleDateTimeSpan(i);
time_DT = time_DT - time_SP;
cout << time_DT.GetDay() << endl;
In this case my function would return true;
long i = 999999999999;    
COleDateTime time_DT = COleDateTime(2014, 2, 20, 0, 0, 0);
COleDateTimeSpan time_SP = COleDateTimeSpan(i);
time_DT = time_DT - time_SP;
cout << time_DT.GetDay() << endl;
In this case my function would return false instead of crashing
This is what I have so far:
bool Date::addDays(long days)
{
    bool bRet = true;
    COleDateTimeSpan ts(m_time); //m_time being my COleDateTime
    COleDateTimeSpan tl(days);
    if (tl > ts)
    {
        bRet = false;
        return bRet;
    }
    else
    {
        return bRet;
    }   
}
Thanks!
EDIT : I meant subtract....