-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirtc.hpp
31 lines (23 loc) · 860 Bytes
/
irtc.hpp
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
27
28
29
30
31
#pragma once
#include <linux/rtc.h>
#include <memory>
#include <string_view>
struct IRTC {
enum class Clock { LOCAL, UTC, INVALID };
virtual rtc_time get_time() const = 0;
virtual void set_wakeup(rtc_time const &time) = 0;
virtual rtc_wkalrm get_wakeup() const = 0;
virtual void clear_wakeup() = 0;
virtual Clock type() const noexcept = 0;
virtual std::string_view name() const noexcept = 0;
static std::unique_ptr<IRTC> get(std::string_view name,
std::string_view adj = {});
static Clock parse_adjfile(std::string_view adj);
virtual ~IRTC() = default;
};
struct MockRTC : IRTC {
virtual void set_time(rtc_time const &time) = 0;
virtual void wakeup_occured() = 0;
static std::unique_ptr<MockRTC> get(std::string_view name,
std::string_view adj = {});
};