From 51e8b0cda7f3eb834d44ec16cb7190d2fa14a057 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Fri, 5 Apr 2019 11:48:44 +0200 Subject: [PATCH] document some more timefunc member functions --- src/timefunc.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 57 insertions(+), 0 deletions(-) diff --git a/src/timefunc.cpp b/src/timefunc.cpp index 0883055..a4d38b8 100644 --- a/src/timefunc.cpp +++ b/src/timefunc.cpp @@ -1245,6 +1245,23 @@ namespace clock { return *this; } + /** + * @brief Format timestamp according to the ISO standard rules. + * + * @param utc Whether to normalize the timestamp to UTC or local time. + * @param date Whether to include the date (%F). + * @param time Whether to include the time (%T). + * @param tz Whether to include the UTC offset (%z). + * + * @return \c none if the formatting operation failed, the + * formatted timestamp otherwise. + * + * @note The standard allows for extending the format using + * a fractional component. However, this is subject to + * local conventions so we don’t support it. For more + * than seconds granularity use a better suited format + * like LDAP Generalized time instead. + */ boost::optional Time::format_iso8601 (const bool utc, const bool date, @@ -1276,6 +1293,16 @@ namespace clock { Time::format_date (void) const { return ::format_date (this->value.tv_sec); } + /** + * @brief Obtain the current time wrt. the given + * clock variants. + * + * @param id Clock id. + * @param var Clock variant. + * + * @return \c none if the underlying \c clock_gettime() operation + * failed, a fully initialized \c struct Time otherwise. + */ boost::optional