Friday 20 July 2018

Android NDK chrono epoch is not correct (std::chrono::high_resolution_clock)

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_clockand it worked. Why?



from Android NDK chrono epoch is not correct (std::chrono::high_resolution_clock)

No comments:

Post a Comment