For the trivial case that you present, the time functions are fairly easy to make use of. For anything much beyond this, be prepared to shed some tears..
Here's some code that will perform the calculation you mention.
Note that:
1. The value returned by time increments by 1 each second.
2. A value of 0 corresponds to Jan 1 1970 (the Unix Epoch)
3. I could have used difftime instead of performing the subtraction manually.
#include <cstdio>
#include <ctime>
int main(int argc, char **argv)
{
time_t now = time(NULL);
tm birthDateTm = {0};
birthDateTm.tm_year = 1996-1900;
birthDateTm.tm_mon = 0;
birthDateTm.tm_mday = 3;
time_t birthTime = mktime(&birthDateTm);
printf("BirthTime: %ld\n", birthTime);
unsigned long dif = now - birthTime;
unsigned long years = dif / (24 * 3600 * 7 * 52);
printf("Elapsed time between %s and %s in years is: %ld\n", ctime(&birthTime), ctime(&now), years);
}
Output:
BirthTime: 820591200
Elapsed time between Wed Jan 03 01:00:00 1996
and Wed Jan 03 01:00:00 1996
in years is: 19