File: fake_clock.hh

package info (click to toggle)
libtoxcore 0.2.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,992 kB
  • sloc: ansic: 70,235; cpp: 14,770; sh: 1,576; python: 649; makefile: 255; perl: 39
file content (26 lines) | stat: -rw-r--r-- 565 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef C_TOXCORE_TESTING_SUPPORT_DOUBLES_FAKE_CLOCK_H
#define C_TOXCORE_TESTING_SUPPORT_DOUBLES_FAKE_CLOCK_H

#include <atomic>
#include <cstdint>

#include "../public/clock.hh"

namespace tox::test {

class FakeClock : public ClockSystem {
public:
    explicit FakeClock(uint64_t start_time_ms = 1000);

    uint64_t current_time_ms() const override;
    uint64_t current_time_s() const override;

    void advance(uint64_t ms);

private:
    std::atomic<uint64_t> now_ms_;
};

}  // namespace tox::test

#endif  // C_TOXCORE_TESTING_SUPPORT_DOUBLES_FAKE_CLOCK_H