dimanche 27 novembre 2016

C++ struct tm & time_t

I have an array of time here:

struct cl{
    unsigned char *buffer;
    time_t t = time(0);  
    struct tm * ct = localtime(&t);
};

and then:

cl sadi[10];

But for example I got sadi[5] at 21:58, and when I got a sadi[6] at 21:59. Then I check again all my sadi[].ct->tm_min are 59. What is the problem with that? Is that it can't hold the moment that you capture it, will it always update ? If so, how can I capture the moment of time and it not update like that.

Aucun commentaire:

Enregistrer un commentaire