I need to use CTimespan to depict the difference between two CTime objects, and use this to calculate an age. Is there a more accurate way of giving a persons age other than dividing the CTimespan object age by 365 (not taking into account leap years)to get the total years? - Only using a CTimespan member function.
#include <afx.h>
void main()
{
int currentage,days;
CTime dob(1981, 11, 17, 0, 0, 0);
CTime now = CTime::GetCurrentTime();
CTimeSpan age = now - dob;
days = age.GetDays();
currentage = days/365;
printf("Age = %d\n",currentage);
}
#include <afx.h>
void main()
{
int currentage,days;
CTime dob(1981, 11, 17, 0, 0, 0);
CTime now = CTime::GetCurrentTime();
CTimeSpan age = now - dob;
days = age.GetDays();
currentage = days/365;
printf("Age = %d\n",currentage);
}