Timestamp: Update workaround to support MinGW alongside MSVC (#296)

This commit is contained in:
Doekin
2024-12-18 08:34:05 +01:00
committed by GitHub
parent 5934aea9a3
commit fe8a5c580f
+2 -5
View File
@@ -3,9 +3,6 @@
#include <ctime>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <locale>
#include <sstream>
#include <stdexcept>
#include <string>
@@ -75,8 +72,8 @@ class Timestamp {
const std::tm& tm() const { return tm_; }
private:
#ifdef _MSC_VER
// This workaround is necessary, because MSVC doesn't support strptime.
#if defined(_MSC_VER) || defined(__MINGW32__)
// This workaround is necessary, because strptime is not available on Windows.
char* strptime(const char* _s, const char* _f, std::tm* _tm) {
std::istringstream input(_s);
input.imbue(std::locale(setlocale(LC_ALL, nullptr)));