Lei YU | af5abc5 | 2017-03-07 17:49:17 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "config.h" |
| 4 | #include "epoch_base.hpp" |
| 5 | |
| 6 | #include <chrono> |
| 7 | |
| 8 | namespace phosphor |
| 9 | { |
| 10 | namespace time |
| 11 | { |
| 12 | |
| 13 | /** @class HostEpoch |
| 14 | * @brief OpenBMC HOST EpochTime implementation. |
| 15 | * @details A concrete implementation for xyz.openbmc_project.Time.EpochTime |
| 16 | * DBus API for HOST's epoch time. |
| 17 | */ |
| 18 | class HostEpoch : public EpochBase |
| 19 | { |
| 20 | public: |
| 21 | friend class TestHostEpoch; |
| 22 | HostEpoch(sdbusplus::bus::bus& bus, |
| 23 | const char* objPath); |
| 24 | |
| 25 | /** |
| 26 | * @brief Get value of Elapsed property |
| 27 | * |
| 28 | * @return The elapsed microseconds since UTC |
| 29 | **/ |
| 30 | uint64_t elapsed() const override; |
| 31 | |
| 32 | /** |
| 33 | * @brief Set value of Elapsed property |
| 34 | * |
| 35 | * @param[in] value - The microseconds since UTC to set |
| 36 | * |
| 37 | * @return The updated elapsed microseconds since UTC |
| 38 | **/ |
| 39 | uint64_t elapsed(uint64_t value) override; |
| 40 | |
| 41 | private: |
| 42 | /** @brief The diff between BMC and Host time */ |
| 43 | std::chrono::microseconds offset; |
| 44 | |
| 45 | /** @brief The file to store the offset in File System. |
| 46 | * Read back when starts |
| 47 | **/ |
| 48 | static constexpr auto offsetFile = HOST_OFFSET_FILE; |
Lei YU | af5abc5 | 2017-03-07 17:49:17 +0800 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | } // namespace time |
| 52 | } // namespace phosphor |