MinnisotaFreezing
Programmer
Hello, code snippit follows
CTime time = CTime::GetCurrentTime();
month = time.GetMonth()+2;
year = time.GetYear();
day = time.GetDay();
CTime time2(year, month, day, 0, 0, 0);
That gets a CTime object that = 2 months from now. But look, I use 2 CTime objects. Can anyone suggest something else? Maybe
CTime * newtime = new CTime();
newtime->GetCurrentTime();
month = newtime->GetMonth()+2;
year = newtime->GetYear();
day = newtime->GetDay();
newtime = new CTime(year, month, day, 0,0,0);
The only problem there is GetCurrentTime returns a CTime object, not a pointer to CTime, so I have no way of getting newtime to point to a CTime object with the current time in it. Unless we go this way, which is better. Rather than 2 CTime objects we have an object and a pointer.
CTime time1 = CTime::GetCurrentTime();
month = time1.GetMonth()+2;
year = time1.GetYear();
day = time1.GetDay();
CTime * newtime = new CTime(year, month, day, 0,0,0);
Can anyone see a way to do this either with only a pointer or only on CTime object?
Yea, I guess I have a little time on my hands. Also, this is just example code, it would fail if it were Nov or Dec.
CJB
CTime time = CTime::GetCurrentTime();
month = time.GetMonth()+2;
year = time.GetYear();
day = time.GetDay();
CTime time2(year, month, day, 0, 0, 0);
That gets a CTime object that = 2 months from now. But look, I use 2 CTime objects. Can anyone suggest something else? Maybe
CTime * newtime = new CTime();
newtime->GetCurrentTime();
month = newtime->GetMonth()+2;
year = newtime->GetYear();
day = newtime->GetDay();
newtime = new CTime(year, month, day, 0,0,0);
The only problem there is GetCurrentTime returns a CTime object, not a pointer to CTime, so I have no way of getting newtime to point to a CTime object with the current time in it. Unless we go this way, which is better. Rather than 2 CTime objects we have an object and a pointer.
CTime time1 = CTime::GetCurrentTime();
month = time1.GetMonth()+2;
year = time1.GetYear();
day = time1.GetDay();
CTime * newtime = new CTime(year, month, day, 0,0,0);
Can anyone see a way to do this either with only a pointer or only on CTime object?
Yea, I guess I have a little time on my hands. Also, this is just example code, it would fail if it were Nov or Dec.
CJB