I\'ve written a c++ function to get the current time in HH:MM:SS format. How can I add milliseconds or nanoseconds, so I can have a format like HH:MM:SS:M
HH:MM:SS
HH:MM:SS:M
This is a cleaner solution using HowardHinnant's date library.
std::string get_time() { using namespace std::chrono; auto now = time_point_cast(system_clock::now()); return date::format("%T", now); }