std :: put_time在GCC的实现状态? [英] std::put_time implementation status in GCC?
问题描述
我试图使用GCC(测试版本4.5.1,4.6)来编译此示例程序。 3,4.8.4):
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") << '\n';
}
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:
- http://gcc.gnu.org/projects/cxx0x.html
但我找不到任何注释 put_time
或 chrono
等。任何人都可以指向我提供有关此库实施状态信息的资源。
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?
推荐答案
请参阅 TODO扩展iomanip操纵器std :: get_time和std :: put_time for gcc 4.8.0。
See TODO extended iomanip manipulators std::get_time and std::put_time for gcc 4.8.0.
另请参阅跨平台方式来获取一天的时间声明未实现4.7.0。
See also Cross Platform way to get the time of day? claiming that is not implemented in 4.7.0.
UPDATE:作为gcc开发人员 Jonathan Wakely确认如下: std :: gcc 4.9中仍然缺少get_time
和 std :: put_time
操纵器。
UPDATE: As the gcc developer Jonathan Wakely confirmed below: The std::get_time
and std::put_time
manipulators are still missing in gcc 4.9.
更新: Jonathan Wakely 关闭这张票于2014年12月22日:
UPDATE: Jonathan Wakely closed this ticket on 22 Dec, 2014:
修正了GCC 5
Fixed for GCC 5
感谢 simonwo 通知我们。
这篇关于std :: put_time在GCC的实现状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!