utx::print_time and utx::print_time_to are very simple and convenient c++ functions to print std::chrono::time_point.
template <typename ... type_list> inline void print_time(const type_list & ... tp_list);
utx::print_time can be used to print many time point values.
The out stream of utx::print_time is std::cout, and the delim (utx::delim) of utx::print_time is a newline character.
template <utx::kspt::ostream out_stream, typename ... type_list> inline void print_time_to(out_stream & os, const utx::delim & deli, const type_list & ... tp_list);
#include <utxcpp/core.hpp>
![]() |
Note |
---|---|
|
#include <utxcpp/core.hpp> int main() { auto start = std::chrono::time_point<std::chrono::system_clock>{}; auto now = std::chrono::system_clock::now(); utx::print_time(now, start); utx::print_time(now); utx::print_time(start); // 0:0:0.0 1.1 1970+++10:58:27.109 11.24 2022+++ utx::print_time_to(std::clog, "+++", start, now); std::clog << "\n\n"; // 0:0:0.0 1.1 1970*** utx::print_time_to(std::cerr, "***", start); std::cerr << "\n\n"; // 1669287507109014233ns std::cout << (now-start) << '\n'; // -1669287507109014233ns utx::print(start-now); }
Last revised: January 01, 2023 at 18:52:16 GMT |