Assuming that both the server and the client use the same std::time_t - this is very likely; in almost all implementations std::time_t is an integer type holding the Unix time (seconds since 00:00:00, 1 Jan 1970 UTC, not counting leap seconds): https://en.wikipedia.org/wiki/Unix_time
> Right now my code creates memory leak cause i don't delete the allocated memory that localtime creates.
Your code is fine; std::localtime() does not allocate dynamic memory.
Return value: pointer to a static internal std::tm object on success, or NULL otherwise. The structure may be shared between std::gmtime, std::localtime, and std::ctime, and may be overwritten on each invocation. http://en.cppreference.com/w/cpp/chrono/c/localtime
Okay this is something new to me.
I always thought that if something returns a pointer, i have to deallocate it cause
well, when else it is going to get deallocated.
Forget all about static/local variables.
Thank you again so much!