inline char const* time_now_string() { static std::ostringstream oss; if (oss.str().empty()) { boost::posix_time::time_facet* _facet = new boost::posix_time::time_facet("%Y-%m-%d %H:%M:%S.%f"); oss.imbue(std::locale(std::locale::classic(), _facet)); } oss.str(""); oss << boost::posix_time::microsec_clock::local_time(); std::string s = oss.str(); if (s.size() > 3) s = std::string(s.substr(0, s.size() - 3)); static char str[200]; std::sprintf(str, "%s ", s.c_str()); return str; }