In c++, I would like to get the number of seconds from between the current time and January 1, 2000. The problem that I'm having is assigning one time struct with the current time, and another with other one. When I use difftime(), it just returns 0. There is something that I'm obviously missing.
#include <stdio.h>
#include <time.h>
#include <iostream>
int main ()
{
time_t oldTime;
struct tm oldTimePtr;
oldTimePtr.tm_year = 2000 - 1900;
oldTimePtr.tm_mday = 1;
oldTimePtr.tm_min = 0;
oldTimePtr.tm_mon = 0;
oldTimePtr.tm_sec = 0;
oldTimePtr.tm_wday = 0;
oldTime = mktime( &oldTimePtr );
//current time
time_t currentTime = time(0);
struct tm *currentTimeStruct = localtime( ¤tTime );
std::cout << difftime( currentTime, oldTime );
std::cin.get();
return 0;
}