std::put_time implementation status in GCC?
我正尝试使用GCC编译此示例程序(测试版本4.5.1、4.6.3、4.8.4):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #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") << '\ '; } |
但是它告诉我:
1 2 | prog.cpp: In function 'int main()': prog.cpp:14:18: error: 'put_time' is not a member of 'std' |
我认为,可能尚未实施。因此,我尝试检查此功能的实现状态。我只找到此页面:
- http://gcc.gnu.org/projects/cxx0x.html
,但是在
有关gcc 4.8.0,请参见TODO扩展iomanip操纵器std :: get_time和std :: put_time。
另请参阅跨平台方式来获取一天中的时间?声称在4.7.0中未实现。
更新:正如gcc开发人员Jonathan Wakely确认的那样:
更新:Jonathan Wakely于2014年12月22日关闭了这张票:
Fixed for GCC 5
感谢simonwo让我知道这件事。
您可能已经注意到,您提供的链接未列出库的任何部分!但在表格下方显示:
The status of the library implementation can be tracked in this table
该表指出
编辑: