I was trying to compile this example program using GCC (tested versions 4.5.1, 4.6.3, 4.8.4):
#include <iostream>
#include <iomanip>
#include <ctime>
#include <chrono>
using std::chrono::system_clock;
int main()
{
system_clock::time_point now = system_clock::now();
std::time_t now_c = system_clock::to_time_t(
now - std::chrono::hours(24));
std::cout << "One day ago, the time was "
<< std::put_time(std::localtime(&now_c), "%F %T") << '
';
}
But it tells me:
prog.cpp: In function 'int main()':
prog.cpp:14:18: error: 'put_time' is not a member of 'std'
I thought, probably it's not implemented yet. So I tried to check the implementation status for this function. I only found this page:
but there I could not find any note on put_time
or chrono
or alike. Can anyone point me to a resource that provides information on the implementation status for this library?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…