jeudi 25 février 2016

Convert high_resolution_clock::time_point to a std::string Using Clang

I have a high_resolution_clock::time_point which I want to print so I need to convert it to a std::string. On Linux this works fine:

std::time_t time_t_value = std::chrono::system_clock::to_time_t(my_time_point); std::string label_text = std::ctime(&time_t_value);

However, running it on Mac it doesn't like it so much:

error: no viable conversion from 'time_point<std::__1::chrono::steady_clock, duration<[...], ratio<[...], 1000000000>>>' to 'const time_point<std::__1::chrono::system_clock, duration<[...], ratio<[...], 1000000>>>' std::time_t time_t_value = std::chrono::system_clock::to_time_t(std::chrono::high_resolution_clock::now());

I'm guessing there is a difference between clang and gcc here. Any suggestions?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire