Fixes
This commit is contained in:
@ -43,7 +43,7 @@ namespace IACore
|
|||||||
|
|
||||||
FLOAT64 GetSecondsCount()
|
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)
|
UINT32 GetRandom(IN UINT32 seed)
|
||||||
|
|||||||
@ -26,14 +26,14 @@ namespace IACore
|
|||||||
return parseResult;
|
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::error_code error{};
|
||||||
simdjson::dom::parser parser;
|
simdjson::dom::parser parser;
|
||||||
simdjson::dom::object object;
|
simdjson::dom::object object;
|
||||||
if ((error = parser.parse(json).get(object)))
|
if ((error = parser.parse(json).get(object)))
|
||||||
return MakeUnexpected(std::format("Failed to parse JSON : {}", simdjson::error_message(error)));
|
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)
|
String JSON::Encode(IN nlohmann::json data)
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace IACore
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
STATIC Expected<nlohmann::json, String> Parse(IN CONST String &json);
|
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);
|
template<typename _object_type> STATIC Expected<_object_type, String> ParseToStruct(IN CONST String &json);
|
||||||
|
|
||||||
STATIC String Encode(IN nlohmann::json data);
|
STATIC String Encode(IN nlohmann::json data);
|
||||||
|
|||||||
Reference in New Issue
Block a user