I'm trying to get Unix Timestamp for this particular date and time
2010-05-31 05:46:37
The correct timestamp should be 1275284797,
ctime is giving me the correct date,however i'm getting a time stamp of 1292866122 instead of 1275284797. Just want to check whats wrong with my source code. Thanks
struct tm timeinfo;
timeinfo.tm_year = 2010-1900;
timeinfo.tm_mon = 05-1;
timeinfo.tm_mday = 31;
timeinfo.tm_hour = 05;
timeinfo.tm_min = 46;
timeinfo.tm_sec = 37;
timeinfo.tm_isdst = -1;
time_t rawtime = mktime (&timeinfo);
cout << "The time from the string is: " << ctime (&rawtime) << endl;
cout << "The time from the string is: " << time(&rawtime) << endl;