Get current time crossplatform in c++
c++, time
Solution
The routines in `<time.h>` are cross-platform and in fact required to be available for conforming implementations of ISO C. Use `time` to retrieve the elapsed time since 1970, and `localtime` or `gmtime` to break that down into hours, minutes, and seconds, as needed.
You shouldn't be concerned that `struct tm` uses too much memory to store unneeded fields unless you are programming extremely memory-constrained devices, in which case you probably aren't looking for a cross-platform solution.
Problem
How can I get current time (I need hours, minutes, seconds) crossplatform in c++? I saw here make structure of values but there are a lots of another stuff that I don't need. And memory is very important here.