Advertisement
pneave

::time_point to string

Apr 5th, 2023
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | Software | 0 0
  1.     static std::string timePointAsString(const std::chrono::system_clock::time_point& tp)
  2.     {
  3.         std::time_t t = std::chrono::system_clock::to_time_t(tp);
  4.         std::string ts = std::ctime(&t);
  5.         ts.resize(ts.size() - 1);
  6.         return ts;
  7.     }
  8.  
Tags: C++20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement