I have this code:
time_t tt = time(NULL);
tm* currentTime = gmtime(&tt);
tm* storedTime = gmtime(&m_time);
Where m_time is a time_t member data set at construction time.
When I set storedTime with this data member, current time acquires the same value, as if both tm pointers points to the same variable. Is this the expected behavior? How could I have separated tm structs to compare times?
Thanks
From documentation about
gmtime:Use this code to create a copy:
(pointer deference here is equivalent to
memcpy(¤tTime, gmtime(&tt), sizeof(tm)))