diff options
author | ipkn <ipknhama@gmail.com> | 2014-05-02 01:17:49 -0400 |
---|---|---|
committer | ipkn <ipknhama@gmail.com> | 2014-05-02 01:17:49 -0400 |
commit | 81bd1e1fb6cb2a74c4e372410fb419cfc94991e0 (patch) | |
tree | fecebb2f7887cf73f6e6aa1d5ce9ee1d7d3cc57c /datetime.h | |
parent | f8893eb138eae88f35ba752221a02b318d275364 (diff) | |
download | crow-81bd1e1fb6cb2a74c4e372410fb419cfc94991e0.tar.gz crow-81bd1e1fb6cb2a74c4e372410fb419cfc94991e0.zip |
caching datetime string for Date header
Diffstat (limited to 'datetime.h')
-rw-r--r-- | datetime.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -23,12 +23,12 @@ namespace crow // return datetime string std::string str() { + static const std::locale locale_(std::locale::classic(), new boost::local_time::local_time_facet("%a, %d %b %Y %H:%M:%S GMT") ); std::string result; - boost::local_time::local_time_facet* lf(new boost::local_time::local_time_facet("%a, %d %b %Y %H:%M:%S GMT")); try { std::stringstream ss; - ss.imbue(std::locale(ss.getloc(), lf)); + ss.imbue(locale_); ss << m_dt; result = ss.str(); } @@ -59,9 +59,9 @@ namespace crow // parse datetime string void parse(const std::string& dt) { - boost::local_time::local_time_input_facet* lif(new boost::local_time::local_time_input_facet("%a, %d %b %Y %H:%M:%S GMT")); + static const std::locale locale_(std::locale::classic(), new boost::local_time::local_time_facet("%a, %d %b %Y %H:%M:%S GMT") ); std::stringstream ss(dt); - ss.imbue(std::locale(std::locale::classic(), lif)); + ss.imbue(locale_); ss >> m_dt; } |