目前我必须使用类似的东西
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 到字符串格式化程序,它将 ptime 转换为"%a, %d %b %Y %H:%M:%S GMT"
格式并且不会使用ostringstream
and .str()
(因为它们对于我的目的来说太慢了)?