This commit is contained in:
2025-12-04 16:35:52 +05:30
parent d18b22d702
commit 99e2e9bfce
3 changed files with 4 additions and 4 deletions

View File

@ -43,7 +43,7 @@ namespace IACore
FLOAT64 GetSecondsCount()
{
return (HighResClock::now() - g_startTime).count();
return std::chrono::duration_cast<std::chrono::seconds>(HighResClock::now() - g_startTime) .count();
}
UINT32 GetRandom(IN UINT32 seed)

View File

@ -26,14 +26,14 @@ namespace IACore
return parseResult;
}
Expected<simdjson::dom::object, String> JSON::ParseReadOnly(IN CONST String &json)
Expected<Pair<simdjson::dom::parser, simdjson::dom::object>, String> JSON::ParseReadOnly(IN CONST String &json)
{
simdjson::error_code error{};
simdjson::dom::parser parser;
simdjson::dom::object object;
if ((error = parser.parse(json).get(object)))
return MakeUnexpected(std::format("Failed to parse JSON : {}", simdjson::error_message(error)));
return object;
return std::make_pair(IA_MOVE(parser), IA_MOVE(object));
}
String JSON::Encode(IN nlohmann::json data)

View File

@ -31,7 +31,7 @@ namespace IACore
public:
STATIC Expected<nlohmann::json, String> Parse(IN CONST String &json);
STATIC Expected<simdjson::dom::object, String> ParseReadOnly(IN CONST String &json);
STATIC Expected<Pair<simdjson::dom::parser, simdjson::dom::object>, String> ParseReadOnly(IN CONST String &json);
template<typename _object_type> STATIC Expected<_object_type, String> ParseToStruct(IN CONST String &json);
STATIC String Encode(IN nlohmann::json data);