I\'ve created a time point, but I have been struggling to print it to the terminal.
#include
#include
int main(){
//set
The ctime() does not work for Visual C++. I use MS Visual Studio 2013. I changed the above code to use ctime_s(...), as prompted by MSVC compiler. It worked.
//set time_point to current time
std::chrono::time_point<std::chrono::system_clock> time_point;
time_point = std::chrono::system_clock::now();
std::time_t ttp = std::chrono::system_clock::to_time_t(time_point);
char chr[50];
errno_t e = ctime_s(chr, 50, &ttp);
if (e) std::cout << "Error." << std::endl;
else std::cout << chr << std::endl;