Document chrono

This commit is contained in:
Victor Zverovich 2020-11-07 10:51:08 -08:00
parent 32c4af8f0d
commit 8f2131cf2d
2 changed files with 14 additions and 2 deletions

View File

@ -431,6 +431,10 @@ For example::
The syntax is described in :ref:`chrono-specs`.
.. doxygenfunction:: localtime(std::time_t)
.. doxygenfunction:: gmtime(std::time_t)
.. _compile-api:
Format string compilation

View File

@ -288,7 +288,11 @@ inline null<> gmtime_r(...) { return null<>(); }
inline null<> gmtime_s(...) { return null<>(); }
} // namespace detail
// Thread-safe replacement for std::localtime
/**
Converts given time since epoch as ``std::time_t`` value into calendar time,
expressed in local time. Unlike ``std::localtime``, this function is
thread-safe on most platforms.
*/
inline std::tm localtime(std::time_t time) {
struct dispatcher {
std::time_t time_;
@ -330,7 +334,11 @@ inline std::tm localtime(
return localtime(std::chrono::system_clock::to_time_t(time_point));
}
// Thread-safe replacement for std::gmtime
/**
Converts given time since epoch as ``std::time_t`` value into calendar time,
expressed in Coordinated Universal Time (UTC). Unlike ``std::gmtime``, this
function is thread-safe on most platforms.
*/
inline std::tm gmtime(std::time_t time) {
struct dispatcher {
std::time_t time_;