probleme de date avec mktime et gmtime
Bonjour,
j'ai des petits soucis à utiliser ces fonctions, voici ma demarche :
je definis une date (pour les tests)
Code:
1 2 3 4 5 6 7 8 9 10 11
| CString tmp;
tmp = "20070605160939";
struct tm tmSynchro;
FillMemory(&tmSynchro, sizeof(tmSynchro), 0);
tmSynchro.tm_year = atoi(tmp.Left(4)) - 1900;
tmSynchro.tm_mon = atoi(tmp.Mid(4,2)) - 1;
tmSynchro.tm_mday = atoi(tmp.Mid(6,2)) - 1;
tmSynchro.tm_hour = atoi(tmp.Mid(8,2));
tmSynchro.tm_min = atoi(tmp.Mid(10,2));
tmSynchro.tm_sec = atoi(tmp.Right(2)); |
Dans ma structure tmSynchro, j'ai les bonnes valeurs, je poursuis avec :
Code:
time_t timeSynchro = mktime(&tmSynchro);
et la, bizzarement, tmSynchro.tm_hour passe à 17 alors qu'il etait a 16
je continue avec ca :
Code:
1 2
| time_t value = (time_t) this->timeSynchro;
struct tm *newtime = gmtime(&value); |
et la, tout aussi bizzarement, tm.tm_hour passe à 15
Que se passe t'il ? comment faire que tm_hour reste a 16 tout le temps ?
Merci