diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 51c5195c..8a5f1192 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -51,7 +51,7 @@ namespace sinks { class sink; } -using log_clock = std::chrono::system_clock; +using log_clock = spd_clock_t; using sink_ptr = std::shared_ptr; using sinks_init_list = std::initializer_list; using log_err_handler = std::function; diff --git a/include/spdlog/tweakme.h b/include/spdlog/tweakme.h index d91159f7..9d7bb689 100644 --- a/include/spdlog/tweakme.h +++ b/include/spdlog/tweakme.h @@ -128,3 +128,27 @@ // // #define SPDLOG_DISABLE_DEFAULT_LOGGER /////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +// Install spd_clock_t compatible with chrono clock to be used by spdlog +// +// // example of custom clock that has std::chrono compatible interface +// struct custom_clock +// { +// typedef chrono::nanoseconds duration; +// typedef duration::rep rep; +// typedef duration::period period; +// typedef chrono::time_point time_point; +// +// /// set true if clock increases at uniform rate +// static constexpr bool is_steady = false; +// +// /// \return time_point representing now in nanosecond precision +// /// as specified in duration typedef +// static time_point now() noexcept; +// +// static std::time_t to_time_t(const time_point& __t) noexcept; +// }; +#include +using spd_clock_t = std::chrono::system_clock; +///////////////////////////////////////////////////////////////////////////////