]> git.sesse.net Git - nageru/blobdiff - metrics.cpp
Expose the start time point instead of the uptime, as per Prometheus recommendations.
[nageru] / metrics.cpp
index 1f3f8a1c18b6478b2c7d5b3956137a3aa67169d9..fd5e54c1c7f48b09d38f64ddd91d84bee4a3b6c0 100644 (file)
@@ -4,13 +4,20 @@
 #include <math.h>
 
 #include <algorithm>
+#include <chrono>
 #include <locale>
 #include <sstream>
 
 using namespace std;
+using namespace std::chrono;
 
 Metrics global_metrics;
 
+double get_timestamp_for_metrics()
+{
+       return duration<double>(system_clock::now().time_since_epoch()).count();
+}
+
 namespace {
 
 string serialize_name(const string &name, const vector<pair<string, string>> &labels)