The code below does not print epoch.
typedef std::chrono::high_resolution_clock Clock;
typedef std::chrono::milliseconds Milliseconds;
auto res = std::chrono::duration_cast<Milliseconds>(Clock::now().time_since_epoch()).count();
std::stringstream ss;
ss << res;
printf(">>>>>>>>>>> TimeUtiles::getTimestamp %s", ss.str().c_str());
I use NDK r9d and selected NDK toolchain version was 4.8 !
EDIT:
Changed std::chrono::high_resolution_clock
to std::chrono::system_clock
and it worked. Why?
system_clock
is like a watch (the thing on your wrist before smart phones took over the planet). It can tell you the time of day. And because no clock keeps perfect time, it sometimes asks another clock what time it is and makes tiny adjustments to itself to stay accurate.
steady_clock
is like a stopwatch. It is great for timing a runner on a lap, or timing your function. It never adjusts itself, but strives to mark one second per second as best it can. But it has no idea what the time of day is, or even what day of the year.
high_resolution_clock
also has no relationship to any human calendar or time system, and is allowed to be a typedef
to either system_clock
or steady_clock
. And in practice, it always is a typedef
to one of these clocks.
On your system, high_resolution_clock
is evidently the same type as steady_clock
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With