Ockonal Ockonal - 6 months ago 37
C++ Question

How to get current time and date in C++?

Is there a cross-platform way to get the current date and time in C++?

Answer

std C libraries provide time(). This is seconds from the epoch and can be converted to date and H:M:S using standard C functions. Boost also has a time/date library that you can check.

time_t  timev;
time(&timev);