File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,8 @@ class PROMETHEUS_CPP_CORE_EXPORT Gauge {
75
75
private:
76
76
void Change (double );
77
77
std::atomic<double > value_{0.0 };
78
- std::atomic<std::chrono::system_clock::time_point > time_{
79
- std::chrono::system_clock::now ()};
78
+ std::atomic<std::chrono::system_clock::duration > time_{
79
+ std::chrono::system_clock::now (). time_since_epoch () };
80
80
};
81
81
82
82
// / \brief Return a builder to configure and register a Gauge metric.
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ void Gauge::Decrement(const double value) { Change(-1.0 * value); }
16
16
17
17
void Gauge::Set (const double value) {
18
18
value_.store (value);
19
- time_.store (std::chrono::system_clock::now ());
19
+ time_.store (std::chrono::system_clock::now (). time_since_epoch () );
20
20
}
21
21
22
22
void Gauge::Change (const double value) {
@@ -25,7 +25,7 @@ void Gauge::Change(const double value) {
25
25
while (!value_.compare_exchange_weak (current, current + value)) {
26
26
// intentionally empty block
27
27
}
28
- time_.store (std::chrono::system_clock::now ());
28
+ time_.store (std::chrono::system_clock::now (). time_since_epoch () );
29
29
}
30
30
31
31
void Gauge::SetToCurrentTime () {
@@ -43,8 +43,8 @@ ClientMetric Gauge::Collect() const {
43
43
44
44
bool Gauge::Expired (const std::chrono::system_clock::time_point& time,
45
45
const std::chrono::seconds& ttl) const {
46
- return std::chrono::duration_cast<std::chrono::seconds>(time -
47
- time_.load ()) >= ttl;
46
+ return std::chrono::duration_cast<std::chrono::seconds>(
47
+ time. time_since_epoch () - time_.load ()) >= ttl;
48
48
}
49
49
50
50
} // namespace prometheus
You can’t perform that action at this time.
0 commit comments