diff options
| author | William A. Kennington III <wak@google.com> | 2018-07-23 16:30:52 -0700 |
|---|---|---|
| committer | William A. Kennington III <wak@google.com> | 2018-07-23 16:30:52 -0700 |
| commit | f16d9038f049a732aaa24001227762eabc95bae3 (patch) | |
| tree | 6d3cc692bf29cc0731ae5ccc7abeccbd1a2178de /src | |
| parent | 0005e30c3c6a6499308ea4765588f0483e7c32a2 (diff) | |
| download | sdeventplus-f16d9038f049a732aaa24001227762eabc95bae3.tar.gz sdeventplus-f16d9038f049a732aaa24001227762eabc95bae3.zip | |
clock: Document header
Diffstat (limited to 'src')
| -rw-r--r-- | src/sdeventplus/clock.hpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/sdeventplus/clock.hpp b/src/sdeventplus/clock.hpp index c59d721..b3a7ea9 100644 --- a/src/sdeventplus/clock.hpp +++ b/src/sdeventplus/clock.hpp @@ -10,6 +10,8 @@ namespace sdeventplus { +/** @brief Specifies the underlying clock implementation + */ enum class ClockId : clockid_t { RealTime = CLOCK_REALTIME, @@ -19,19 +21,34 @@ enum class ClockId : clockid_t BootTimeAlarm = CLOCK_BOOTTIME_ALARM, }; +/** @class Clock<Id> + * @brief Implements a Clock to be used with std::time_point + * Based on the underlying sd_event time functions + */ template <ClockId Id> class Clock { public: + /** @brief Types needed by chrono functions to store time data + */ using rep = SdEventDuration::rep; using period = SdEventDuration::period; using duration = SdEventDuration; using time_point = std::chrono::time_point<Clock>; static constexpr bool is_steady = Id == ClockId::Monotonic; + /** @brief Constructs a new Clock with time data from the Event + * + * @param[in] event - The event used as the basis for the clock + */ Clock(const Event& event); Clock(Event&& event); + /** @brief Gets the current time of the clock + * + * @throws SdEventError for underlying sd_event errors + * @return The std::chrono::time_point representing the current time + */ time_point now() const; private: |

