summaryrefslogtreecommitdiff
path: root/redfish-core/lib/metric_report.hpp
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-08-04 00:22:34 +0300
committerEd Tanous <edtanous@google.com>2022-08-15 18:06:22 +0300
commit2b82937ecef572954b49569177b16831cbc09cfe (patch)
treeaa26e2904cbaed410dc333c9991c436e143023a6 /redfish-core/lib/metric_report.hpp
parent1e5b7c8892238b5d17c269bfa0ecdaf60825e801 (diff)
downloadbmcweb-2b82937ecef572954b49569177b16831cbc09cfe.tar.xz
Move time utils to be in one place
We've accumulated several time utility functions in the http classes. Time isn't a core HTTP primitive, so http is not where those functions below. This commit moves all the time functions from the crow::utility namespace into the redfish::time_utils namespace, as well as moves the unit tests. No code changes where made to the individual functions, with the exception of changing the namespace on the unit tests. Tested: Unit tests pass. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8493375f60aea31899c84ae703e0f71a17dbdb73
Diffstat (limited to 'redfish-core/lib/metric_report.hpp')
-rw-r--r--redfish-core/lib/metric_report.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
index b93483c4bf..18830f139b 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -2,6 +2,7 @@
#include "utils/collection.hpp"
#include "utils/telemetry_utils.hpp"
+#include "utils/time_utils.hpp"
#include <app.hpp>
#include <dbus_utility.hpp>
@@ -32,7 +33,7 @@ inline nlohmann::json toMetricValues(const Readings& readings)
{"MetricId", id},
{"MetricProperty", metadata},
{"MetricValue", std::to_string(sensorValue)},
- {"Timestamp", crow::utility::getDateTimeUintMs(timestamp)},
+ {"Timestamp", redfish::time_utils::getDateTimeUintMs(timestamp)},
});
}
@@ -55,7 +56,7 @@ inline bool fillReport(nlohmann::json& json, const std::string& id,
.string();
const auto& [timestamp, readings] = timestampReadings;
- json["Timestamp"] = crow::utility::getDateTimeUintMs(timestamp);
+ json["Timestamp"] = redfish::time_utils::getDateTimeUintMs(timestamp);
json["MetricValues"] = toMetricValues(readings);
return true;
}