Commit 566f2dfa authored by Zhiping Jiang (蒋志平)'s avatar Zhiping Jiang (蒋志平) 💬

add chronoTime2StringUsingTimeFormat method

parent 873d8373
......@@ -13,7 +13,20 @@
#include <string>
#include <fstream>
#include <iomanip>
#include <chrono>
#include <ctime>
#include <sstream>
namespace cve {
std::string chronoTime2StringUsingTimeFormat(const std::string & timeFormat = "%Y%m%d_%H%M", const std::chrono::time_point<std::chrono::system_clock> & chronoTime = std::chrono::system_clock::now()) {
auto in_time_t = std::chrono::system_clock::to_time_t(chronoTime);
std::stringstream ss;
char strChar[512];
std::strftime(strChar, sizeof(strChar), timeFormat.c_str(), localtime(&in_time_t));
return std::string(strChar);
template<typename _Tp> class CSVFileWriter {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment