From e74e56e8ff8c45afc5862103042987dc77bdf245 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sun, 10 Mar 2024 12:21:30 +0200 Subject: [PATCH] change datetime parsing to use std::get_time for mac and android compat --- loader/src/server/Server.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/loader/src/server/Server.cpp b/loader/src/server/Server.cpp index 1bdf587e..c218d5c8 100644 --- a/loader/src/server/Server.cpp +++ b/loader/src/server/Server.cpp @@ -101,10 +101,11 @@ std::string ServerDateTime::toAgoString() const { Result ServerDateTime::parse(std::string const& str) { std::stringstream ss(str); - Value value; - if (std::chrono::from_stream(ss, "%FT%TZ", value)) { + std::tm value; + if (ss >> std::get_time(&value, "%Y-%m-%dT%H:%M:%SZ")) { + auto time = std::mktime(&value); return Ok(ServerDateTime { - .value = value, + .value = Clock::from_time_t(time), }); } return Err("Invalid date time format '{}'", str);