blob: 3798f8f6a96bf9e3335a6e106baa32451818f153 [file] [log] [blame]
Lei YUaf5abc52017-03-07 17:49:17 +08001#pragma once
2
3#include "config.h"
4#include "epoch_base.hpp"
5
6#include <chrono>
7
8namespace phosphor
9{
10namespace 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 */
18class 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 YUaf5abc52017-03-07 17:49:17 +080049};
50
51} // namespace time
52} // namespace phosphor