简体   繁体   English

GCC中的std :: put_time实施状态?

[英]std::put_time implementation status in GCC?

I was trying to compile this example program using GCC (tested versions 4.5.1, 4.6.3, 4.8.4): 我试图使用GCC(测试版本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';
}

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. 但我找不到任何音符put_timechrono或一致好评。 Can anyone point me to a resource that provides information on the implementation status for this library? 任何人都可以指向我提供有关此库的实施状态的信息的资源吗?

See TODO extended iomanip manipulators std::get_time and std::put_time for gcc 4.8.0. 有关gcc 4.8.0的信息,请参阅TODO扩展iomanip操纵器std :: get_time和std :: put_time。

See also Cross Platform way to get the time of day? 另请参阅Cross Platform获取时间的方法? claiming that is not implemented in 4.7.0. 声称没有在4.7.0中实现。


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. 更新:正如gcc开发人员Jonathan Wakely在下面证实的那样:gcc 4.9中仍然缺少std::get_timestd::put_time操纵器。


UPDATE: Jonathan Wakely closed this ticket on 22 Dec, 2014: 更新: Jonathan Wakely 2014年12月22日关闭此门票:

Fixed for GCC 5 适用于GCC 5

Thanks simonwo for letting me know about it. 谢谢simonwo让我知道它。

You might have noticed the link you gave doesn't list any parts of the library! 您可能已经注意到您提供的链接未列出库的任何部分! But below the table it says: 但在表格下面说:

The status of the library implementation can be tracked in this table 可以在此表中跟踪库实现的状态

That table notes that std::get_time and std::put_time manipulators are not implemented yet. 该表指出std::get_timestd::put_time操纵器尚未实现。

Edit: put_time is now on the GCC development trunk. 编辑: put_time现在在GCC开发主干上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM