Convertir la date d'horodatage unix en c++

Comme certains sites qui convertissent ces temps unix timbres dire, le cachet de la

2013/05/07 05:01:00 (yyyy/mm/dd, hh:mm:ss) is 1367902860.

La façon dont je le fais en C++, le timbre diffère de la date.
Voici le code:

time_t rawtime;
struct tm * timeinfo;

int year=2013, month=5, day=7, hour = 5, min = 1, sec = 0;

/* get current timeinfo: */
time ( &rawtime ); //or: rawtime = time(0);
/* convert to struct: */
timeinfo = localtime ( &rawtime ); 

/* now modify the timeinfo to the given date: */
timeinfo->tm_year   = year - 1900;
timeinfo->tm_mon    = month - 1;    //months since January - [0,11]
timeinfo->tm_mday   = day;          //day of the month - [1,31] 
timeinfo->tm_hour   = hour;         //hours since midnight - [0,23]
timeinfo->tm_min    = min;          //minutes after the hour - [0,59]
timeinfo->tm_sec    = sec;          //seconds after the minute - [0,59]

/* call mktime: create unix time stamp from timeinfo struct */
date = mktime ( timeinfo );

printf ("Until the given date, since 1970/01/01 %i seconds have passed.\n", date);

La résultante d'horodatage est

1367899260, but not 1367902860.

Quel est le problème ici? Même si je change d'heure-1 heure ou+1, il ne correspond pas. EDIT: eh Bien oui, si j'ajoute 1 à l'heure, il fonctionne. auparavant également ajouté 1 minutes.

OriginalL'auteur user2366975 | 2014-02-10