Skip to content

Commit dc50045

Browse files
committed
Replace steady_clock with system_clock
1 parent f090b74 commit dc50045

18 files changed

+28
-28
lines changed

core/include/prometheus/collectable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Collectable {
2222
/// \brief Returns a list of metrics and their samples.
2323
virtual std::vector<MetricFamily> Collect() const = 0;
2424
virtual std::vector<MetricFamily> Collect(
25-
const std::chrono::steady_clock::time_point& time) const = 0;
25+
const std::chrono::system_clock::time_point& time) const = 0;
2626
};
2727

2828
} // namespace prometheus

core/include/prometheus/counter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Counter {
5353
/// Expires is called by the Registry when collecting metrics.
5454
///
5555
/// A counter never expires.
56-
static bool Expired(const std::chrono::steady_clock::time_point& time,
56+
static bool Expired(const std::chrono::system_clock::time_point& time,
5757
const std::chrono::seconds& ttl);
5858

5959
private:

core/include/prometheus/detail/time_window_quantiles.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace prometheus {
1313
namespace detail {
1414

1515
class PROMETHEUS_CPP_CORE_EXPORT TimeWindowQuantiles {
16-
using Clock = std::chrono::steady_clock;
16+
using Clock = std::chrono::system_clock;
1717

1818
public:
1919
TimeWindowQuantiles(const std::vector<CKMSQuantiles::Quantile>& quantiles,

core/include/prometheus/family.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Family : public Collectable {
158158
///
159159
/// \return Zero or more samples for each dimensional data.
160160
std::vector<MetricFamily> Collect(
161-
const std::chrono::steady_clock::time_point& time) const override;
161+
const std::chrono::system_clock::time_point& time) const override;
162162

163163
private:
164164
std::unordered_map<Labels, std::unique_ptr<T>, detail::LabelHasher> metrics_;

core/include/prometheus/gauge.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ class PROMETHEUS_CPP_CORE_EXPORT Gauge {
6969
/// \param time Time to live in seconds.
7070
///
7171
/// \return Has the gauge expired.
72-
bool Expired(const std::chrono::steady_clock::time_point& time,
72+
bool Expired(const std::chrono::system_clock::time_point& time,
7373
const std::chrono::seconds& ttl) const;
7474

7575
private:
7676
void Change(double);
7777
std::atomic<double> value_{0.0};
78-
std::atomic<std::chrono::steady_clock::time_point> time_{
79-
std::chrono::steady_clock::now()};
78+
std::atomic<std::chrono::system_clock::time_point> time_{
79+
std::chrono::system_clock::now()};
8080
};
8181

8282
/// \brief Return a builder to configure and register a Gauge metric.

core/include/prometheus/histogram.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Histogram {
7373
/// Expires is called by the Registry when collecting metrics.
7474
///
7575
/// A histogram never expires.
76-
static bool Expired(const std::chrono::steady_clock::time_point& time,
76+
static bool Expired(const std::chrono::system_clock::time_point& time,
7777
const std::chrono::seconds& ttl);
7878

7979
private:

core/include/prometheus/registry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Registry : public Collectable {
9191
///
9292
/// \return Zero or more metrics and their samples.
9393
std::vector<MetricFamily> Collect(
94-
const std::chrono::steady_clock::time_point& time) const override;
94+
const std::chrono::system_clock::time_point& time) const override;
9595

9696
/// \brief Removes a metrics family from the registry.
9797
///

core/include/prometheus/summary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class PROMETHEUS_CPP_CORE_EXPORT Summary {
8888
/// Expires is called by the Registry when collecting metrics.
8989
///
9090
/// A summary never expires.
91-
static bool Expired(const std::chrono::steady_clock::time_point& time,
91+
static bool Expired(const std::chrono::system_clock::time_point& time,
9292
const std::chrono::seconds& ttl);
9393

9494
private:

core/src/counter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ClientMetric Counter::Collect() const {
1919
return metric;
2020
}
2121

22-
bool Counter::Expired(const std::chrono::steady_clock::time_point& time,
22+
bool Counter::Expired(const std::chrono::system_clock::time_point& time,
2323
const std::chrono::seconds& ttl) {
2424
(void)time;
2525
(void)ttl;

core/src/family.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ const Labels Family<T>::GetConstantLabels() const {
8989

9090
template <typename T>
9191
std::vector<MetricFamily> Family<T>::Collect() const {
92-
return Collect(std::chrono::steady_clock::now());
92+
return Collect(std::chrono::system_clock::now());
9393
}
9494

9595
template <typename T>
9696
std::vector<MetricFamily> Family<T>::Collect(
97-
const std::chrono::steady_clock::time_point& time) const {
97+
const std::chrono::system_clock::time_point& time) const {
9898
std::lock_guard<std::mutex> lock{mutex_};
9999

100100
if (metrics_.empty()) {

0 commit comments

Comments
 (0)