aboutsummaryrefslogtreecommitdiff
path: root/src/node/timeoffsets.h
diff options
context:
space:
mode:
authorstickies-v <stickies-v@protonmail.com>2024-05-07 14:21:35 +0100
committerstickies-v <stickies-v@protonmail.com>2024-06-13 11:20:49 +0100
commit260f8da71a35232d859d7705861fc1a88bfbbe81 (patch)
tree0b6a6ab3dcbc06affa5c84bbf8f7966d5ba6d5cc /src/node/timeoffsets.h
parent9c4b0b7ce459765fa1a63b410c3423b90f0d2a5f (diff)
refactor: remove warnings globals
Diffstat (limited to 'src/node/timeoffsets.h')
-rw-r--r--src/node/timeoffsets.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node/timeoffsets.h b/src/node/timeoffsets.h
index 2b12584e12..eba706ac1e 100644
--- a/src/node/timeoffsets.h
+++ b/src/node/timeoffsets.h
@@ -11,8 +11,16 @@
#include <cstddef>
#include <deque>
+namespace node {
+class Warnings;
+} // namespace node
+
class TimeOffsets
{
+public:
+ TimeOffsets(node::Warnings& warnings) : m_warnings{warnings} {}
+
+private:
//! Maximum number of timeoffsets stored.
static constexpr size_t MAX_SIZE{50};
//! Minimum difference between system and network time for a warning to be raised.
@@ -23,6 +31,8 @@ class TimeOffsets
* positive offset means our peer's clock is ahead of our local clock. */
std::deque<std::chrono::seconds> m_offsets GUARDED_BY(m_mutex){};
+ node::Warnings& m_warnings;
+
public:
/** Add a new time offset sample. */
void Add(std::chrono::seconds offset) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex);