I\'ve created a time point, but I have been struggling to print it to the terminal.
#include
#include
int main(){
//set
Updated answer for an old question:
For a std::chrono::time_point there is now a 3rd party libraries that give you much better control. For time_points based on other clocks, there is still no better solution than to just get the internal representation and print it out.
But for system_clock, using this library, this is as easy as:
#include "date.h"
#include
int
main()
{
using namespace date;
using namespace std::chrono;
std::cout << system_clock::now() << " UTC\n";
}
which just output for me:
2016-07-19 03:21:01.910626 UTC
which is the current UTC date and time to microsecond precision. If on your platform system_clock::time_point has nanosecond precision, it will print out nanosecond precision for you.