0
目前我有使用这样的东西如何创建自定义boost :: posix_time to_string formaters?
ptime t = from_time_t(last_write_time(p));
std::string Created = boost::posix_time::to_iso_extended_string(t) ;
或:
ptime t = from_time_t(last_write_time(p));
std::ostringstream formatter;
formatter.imbue(std::locale(std::cout.getloc(), new boost::posix_time::time_facet("%a, %d %b %Y %H:%M:%S GMT")));
formatter << t;
std::string Created = formatter.str();
首先是快,但用什么浏览器要用作标题时间格式不兼容,二是太慢。所以我想知道 - 如何创建快速而有效的ptime到字符串formater,将ptime转换为"%a, %d %b %Y %H:%M:%S GMT"
格式,并且不会使用ostringstream
和.str()
(因为它们对于我的目的来说太慢了)?
嗨,我有同样的问题,我看你选中此答案正确的,但我似乎无法了解你使用它。你有什么传递给sprintf来获得写入值? –