As some websites that convert these unix timestamps say, print
2013/05/07 05:01:00 (yyyy/mm/dd, hh:mm:ss) is 1367902860.
As I do this in C ++, the brand is different from the date. Here is the code:
time_t rawtime;
struct tm * timeinfo;
int year=2013, month=5, day=7, hour = 5, min = 1, sec = 0;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
timeinfo->tm_year = year - 1900;
timeinfo->tm_mon = month - 1;
timeinfo->tm_mday = day;
timeinfo->tm_hour = hour;
timeinfo->tm_min = min;
timeinfo->tm_sec = sec;
date = mktime ( timeinfo );
printf ("Until the given date, since 1970/01/01 %i seconds have passed.\n", date);
Received Timestamp
1367899260, but not 1367902860.
What is the problem? Even if I switch to hour-1 or hour + 1, this does not match. EDIT: Well yes, if I add 1 hour, it works. previously also added from 1 to minutes.
source
share