test: Allow time_point in boost checks
What changed, and why it matters
This is a tiny test-only code change that lets Boost unit tests print std::chrono::time_point values when a check fails. It only touches a test helper header, adds a standard library include, and defines a stream output operator. There is no production code change and no security relevance.
No security action needed; this is a benign test utility change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit adds an operator<< overload in src/test/util/common.h for std::chrono::time_point
Changed components
src/test/util/common.hInspect captured patch +8 / −1
diff --git a/src/test/util/common.h b/src/test/util/common.h
index 591f651f..2fa4cb3c 100644
--- a/src/test/util/common.h
+++ b/src/test/util/common.h
@@ -5,8 +5,9 @@
#ifndef BITCOIN_TEST_UTIL_COMMON_H
#define BITCOIN_TEST_UTIL_COMMON_H
-#include <ostream>
+#include <chrono>
#include <optional>
+#include <ostream>
#include <string>
/**
@@ -27,6 +28,12 @@ private:
// Make types usable in BOOST_CHECK_* @{
namespace std {
+template <typename Clock, typename Duration>
+inline std::ostream& operator<<(std::ostream& os, const std::chrono::time_point<Clock, Duration>& tp)
+{
+ return os << tp.time_since_epoch().count();
+}
+
template <typename T> requires std::is_enum_v<T>
inline std::ostream& operator<<(std::ostream& os, const T& e)
{
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.