summaryrefslogtreecommitdiff
path: root/redfish-core/lib
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core/lib')
-rw-r--r--redfish-core/lib/certificate_service.hpp4
-rw-r--r--redfish-core/lib/log_services.hpp31
-rw-r--r--redfish-core/lib/managers.hpp5
-rw-r--r--redfish-core/lib/metric_report.hpp5
-rw-r--r--redfish-core/lib/systems.hpp3
-rw-r--r--redfish-core/lib/task.hpp6
6 files changed, 30 insertions, 24 deletions
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index fc347dcc3a..471b45a25a 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -690,7 +690,7 @@ static void getCertificateProperties(
if (value != nullptr)
{
asyncResp->res.jsonValue["ValidNotAfter"] =
- crow::utility::getDateTimeUint(*value);
+ redfish::time_utils::getDateTimeUint(*value);
}
}
else if (property.first == "ValidNotBefore")
@@ -699,7 +699,7 @@ static void getCertificateProperties(
if (value != nullptr)
{
asyncResp->res.jsonValue["ValidNotBefore"] =
- crow::utility::getDateTimeUint(*value);
+ redfish::time_utils::getDateTimeUint(*value);
}
}
}
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index e806bfa59d..32afd36c5c 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -38,6 +38,7 @@
#include <error_messages.hpp>
#include <query.hpp>
#include <registries/privilege_registry.hpp>
+#include <utils/time_utils.hpp>
#include <charconv>
#include <filesystem>
@@ -178,7 +179,8 @@ inline static bool getEntryTimestamp(sd_journal* journal,
<< strerror(-ret);
return false;
}
- entryTimestamp = crow::utility::getDateTimeUint(timestamp / 1000 / 1000);
+ entryTimestamp =
+ redfish::time_utils::getDateTimeUint(timestamp / 1000 / 1000);
return true;
}
@@ -495,7 +497,8 @@ inline void
thisEntry["@odata.id"] = entriesPath + entryID;
thisEntry["Id"] = entryID;
thisEntry["EntryType"] = "Event";
- thisEntry["Created"] = crow::utility::getDateTimeUint(timestamp);
+ thisEntry["Created"] =
+ redfish::time_utils::getDateTimeUint(timestamp);
thisEntry["Name"] = dumpType + " Dump Entry";
if (dumpType == "BMC")
@@ -580,7 +583,7 @@ inline void
asyncResp->res.jsonValue["Id"] = entryID;
asyncResp->res.jsonValue["EntryType"] = "Event";
asyncResp->res.jsonValue["Created"] =
- crow::utility::getDateTimeUint(timestamp);
+ redfish::time_utils::getDateTimeUint(timestamp);
asyncResp->res.jsonValue["Name"] = dumpType + " Dump Entry";
if (dumpType == "BMC")
@@ -990,7 +993,7 @@ inline void requestRoutesEventLogService(App& app)
asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
+ redfish::time_utils::getDateTimeOffsetNow();
asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
@@ -1442,9 +1445,9 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
thisEntry["Severity"] =
translateSeverityDbusToRedfish(*severity);
thisEntry["Created"] =
- crow::utility::getDateTimeUintMs(*timestamp);
+ redfish::time_utils::getDateTimeUintMs(*timestamp);
thisEntry["Modified"] =
- crow::utility::getDateTimeUintMs(*updateTimestamp);
+ redfish::time_utils::getDateTimeUintMs(*updateTimestamp);
if (filePath != nullptr)
{
thisEntry["AdditionalDataURI"] =
@@ -1565,9 +1568,9 @@ inline void requestRoutesDBusEventLogEntry(App& app)
asyncResp->res.jsonValue["Severity"] =
translateSeverityDbusToRedfish(*severity);
asyncResp->res.jsonValue["Created"] =
- crow::utility::getDateTimeUintMs(*timestamp);
+ redfish::time_utils::getDateTimeUintMs(*timestamp);
asyncResp->res.jsonValue["Modified"] =
- crow::utility::getDateTimeUintMs(*updateTimestamp);
+ redfish::time_utils::getDateTimeUintMs(*updateTimestamp);
if (filePath != nullptr)
{
asyncResp->res.jsonValue["AdditionalDataURI"] =
@@ -2106,7 +2109,7 @@ inline void requestRoutesBMCJournalLogService(App& app)
asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
+ redfish::time_utils::getDateTimeOffsetNow();
asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
redfishDateTimeOffset.second;
@@ -2378,7 +2381,7 @@ inline void
asyncResp->res.jsonValue["OverWritePolicy"] = std::move(overWritePolicy);
std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
+ redfish::time_utils::getDateTimeOffsetNow();
asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
redfishDateTimeOffset.second;
@@ -2578,7 +2581,7 @@ inline void requestRoutesSystemDumpService(App& app)
asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
+ redfish::time_utils::getDateTimeOffsetNow();
asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
redfishDateTimeOffset.second;
@@ -2712,7 +2715,7 @@ inline void requestRoutesCrashdumpService(App& app)
asyncResp->res.jsonValue["MaxNumberOfRecords"] = 3;
std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
+ redfish::time_utils::getDateTimeOffsetNow();
asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
redfishDateTimeOffset.second;
@@ -3195,7 +3198,7 @@ inline void requestRoutesPostCodesLogService(App& app)
"/redfish/v1/Systems/system/LogServices/PostCodes/Entries";
std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
+ redfish::time_utils::getDateTimeOffsetNow();
asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
redfishDateTimeOffset.second;
@@ -3302,7 +3305,7 @@ static void fillPostCodeEntry(
// Get the Created time from the timestamp
std::string entryTimeStr;
entryTimeStr =
- crow::utility::getDateTimeUint(usecSinceEpoch / 1000 / 1000);
+ redfish::time_utils::getDateTimeUint(usecSinceEpoch / 1000 / 1000);
// assemble messageArgs: BootIndex, TimeOffset(100us), PostCode(hex)
std::ostringstream hexCode;
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index a98ff22387..b8fe156bae 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -24,6 +24,7 @@
#include "utils/dbus_utils.hpp"
#include "utils/sw_utils.hpp"
#include "utils/systemd_utils.hpp"
+#include "utils/time_utils.hpp"
#include <boost/date_time.hpp>
#include <sdbusplus/asio/property.hpp>
@@ -1750,7 +1751,7 @@ inline void
// Convert to ISO 8601 standard
aResp->res.jsonValue["LastResetTime"] =
- crow::utility::getDateTimeUint(lastResetTimeStamp);
+ redfish::time_utils::getDateTimeUint(lastResetTimeStamp);
});
}
@@ -1984,7 +1985,7 @@ inline void requestRoutesManager(App& app)
resetToDefaults["ResetType@Redfish.AllowableValues"] = {"ResetAll"};
std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
+ redfish::time_utils::getDateTimeOffsetNow();
asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
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;
}
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index dd58e1b641..0c2c53c192 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -21,6 +21,7 @@
#include "pcie.hpp"
#include "query.hpp"
#include "redfish_util.hpp"
+#include "utils/time_utils.hpp"
#include <app.hpp>
#include <boost/container/flat_map.hpp>
@@ -1079,7 +1080,7 @@ inline void getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
// Convert to ISO 8601 standard
aResp->res.jsonValue["LastResetTime"] =
- crow::utility::getDateTimeUint(lastResetTimeStamp);
+ redfish::time_utils::getDateTimeUint(lastResetTimeStamp);
});
}
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 7d96e42e62..be48a5b05e 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -395,11 +395,11 @@ inline void requestRoutesTask(App& app)
asyncResp->res.jsonValue["Name"] = "Task " + strParam;
asyncResp->res.jsonValue["TaskState"] = ptr->state;
asyncResp->res.jsonValue["StartTime"] =
- crow::utility::getDateTimeStdtime(ptr->startTime);
+ redfish::time_utils::getDateTimeStdtime(ptr->startTime);
if (ptr->endTime)
{
asyncResp->res.jsonValue["EndTime"] =
- crow::utility::getDateTimeStdtime(*(ptr->endTime));
+ redfish::time_utils::getDateTimeStdtime(*(ptr->endTime));
}
asyncResp->res.jsonValue["TaskStatus"] = ptr->status;
asyncResp->res.jsonValue["Messages"] = ptr->messages;
@@ -473,7 +473,7 @@ inline void requestRoutesTaskService(App& app)
asyncResp->res.jsonValue["Name"] = "Task Service";
asyncResp->res.jsonValue["Id"] = "TaskService";
asyncResp->res.jsonValue["DateTime"] =
- crow::utility::getDateTimeOffsetNow().first;
+ redfish::time_utils::getDateTimeOffsetNow().first;
asyncResp->res.jsonValue["CompletedTaskOverWritePolicy"] = "Oldest";
asyncResp->res.jsonValue["LifeCycleEventOnTaskStateChange"] = true;