diff --git a/Source/Crypto/X509/GenerateCertificate.cpp b/Source/Crypto/X509/GenerateCertificate.cpp index 65749fa1..9cc7018a 100644 --- a/Source/Crypto/X509/GenerateCertificate.cpp +++ b/Source/Crypto/X509/GenerateCertificate.cpp @@ -173,13 +173,13 @@ namespace Aurora::Crypto::X509 { auto issueNorm = AuTime::ToCivilTime(request.iIssuedDateMs, AuTime::ETimezoneShift::eUTC); auto issue = fmt::format("{:04}{:02}{:02}{:02}{:02}{:02}", - issueNorm.tm_year + 1900, issueNorm.tm_mon + 1, issueNorm.tm_mday, - issueNorm.tm_hour, issueNorm.tm_min, issueNorm.tm_sec); + issueNorm.year, issueNorm.mon + 1, issueNorm.mday + 1, + issueNorm.hour, issueNorm.min, issueNorm.sec); auto expireNorm = AuTime::ToCivilTime(request.iExpirationDateMs, AuTime::ETimezoneShift::eUTC); auto expire = fmt::format("{:04}{:02}{:02}{:02}{:02}{:02}", - expireNorm.tm_year + 1900, expireNorm.tm_mon + 1, expireNorm.tm_mday, - expireNorm.tm_hour, expireNorm.tm_min, expireNorm.tm_sec); + expireNorm.year, expireNorm.mon + 1, expireNorm.mday + 1, + expireNorm.hour, expireNorm.min, expireNorm.sec); if (mbedtls_x509write_crt_set_validity(&crt, issue.c_str(), expire.c_str()) != 0) { SysPushErrorCrypto("Couldn't update certificate validity"); diff --git a/Source/Crypto/X509/x509.cpp b/Source/Crypto/X509/x509.cpp index 43031b47..4aa32d20 100644 --- a/Source/Crypto/X509/x509.cpp +++ b/Source/Crypto/X509/x509.cpp @@ -345,12 +345,12 @@ namespace Aurora::Crypto::X509 static AuInt64 ConvertTime(const mbedtls_x509_time &time) { AuTime::tm tm = {}; - tm.tm_year = time.year - 1900; - tm.tm_mon = time.mon - 1; - tm.tm_mday = time.day; - tm.tm_sec = time.sec; - tm.tm_min = time.min; - tm.tm_hour = time.hour; + tm.year = time.year; + tm.mon = time.mon - 1; + tm.mday = time.day - 1; + tm.sec = time.sec; + tm.min = time.min; + tm.hour = time.hour; return AuTime::FromCivilTime(tm, AuTime::ETimezoneShift::eUTC); } diff --git a/Source/Locale/LocaleStrings.cpp b/Source/Locale/LocaleStrings.cpp index 7250df59..b02583ff 100644 --- a/Source/Locale/LocaleStrings.cpp +++ b/Source/Locale/LocaleStrings.cpp @@ -169,16 +169,16 @@ namespace Aurora::Locale { try { - bool simple = time.tm_mday == 0 && time.tm_mon == 0 && time.tm_year == 0; + bool simple = time.mday == 0 && time.mon == 0 && time.year == 0; if (simple) { - return fmt::format("{:02}-{:02}-{:02}", time.tm_hour, time.tm_min, time.tm_sec); + return fmt::format("{:02}-{:02}-{:02}", time.hour, time.min, time.sec); } else { // Hard-code ISO-8601 locale because, the Americans locale doesn't make any sense whatsoever, and east asia has the right idea // EU users and burgers seethe... we normalize one sane standard to disambiguate this shit across locale boundaries - return fmt::format("{:04}-{:02}-{:02} {:02}-{:02}-{:02}", time.tm_year + 1900, time.tm_mon + 1, time.tm_mday, time.tm_hour, time.tm_min, time.tm_sec); + return fmt::format("{:04}-{:02}-{:02} {:02}-{:02}-{:02}", time.year, time.mon + 1, time.mday + 1, time.hour, time.min, time.sec); } } catch (...) @@ -195,8 +195,8 @@ namespace Aurora::Locale AuString tz {}; auto tnorm = AuTime::NormalizeCivilTimezone(time, shift); return fmt::format("{:04}-{:02}-{:02}T{:02}-{:02}-{:02}Z", - tnorm.tm_year + 1900, tnorm.tm_mon + 1, tnorm.tm_mday, - tnorm.tm_hour, tnorm.tm_min, tnorm.tm_sec); + tnorm.year, tnorm.mon + 1, tnorm.mday + 1, + tnorm.hour, tnorm.min, tnorm.sec); } catch (...) { @@ -212,8 +212,8 @@ namespace Aurora::Locale AuString tz {}; auto tnorm = AuTime::NormalizeCivilTimezone(time, shift); return fmt::format("{:04}-{:02}-{:02}T{:02}:{:02}:{:02}Z", - tnorm.tm_year + 1900, tnorm.tm_mon + 1, tnorm.tm_mday, - tnorm.tm_hour, tnorm.tm_min, tnorm.tm_sec); + tnorm.year, tnorm.mon + 1, tnorm.mday + 1, + tnorm.hour, tnorm.min, tnorm.sec); } catch (...) { diff --git a/Source/Logging/Sinks/DirLogArchive.cpp b/Source/Logging/Sinks/DirLogArchive.cpp index 55b40ad1..0c112514 100644 --- a/Source/Logging/Sinks/DirLogArchive.cpp +++ b/Source/Logging/Sinks/DirLogArchive.cpp @@ -183,8 +183,8 @@ namespace Aurora::Logging::Sinks auto tm = Time::ToCivilTime(Time::CurrentClockMS()); path = fmt::format("{}/{:04}-{:02}-{:02}T{:02}-{:02}-{:02}Z.{}", baseDirectory, - tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec, + tm.year, tm.mon + 1, tm.mday + 1, + tm.hour, tm.min, tm.sec, bBinary ? "log" : "txt"); CleanupOldLogs(meta, baseDirectory);