mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-02 16:16:19 +08:00
Timestamp: Update workaround to support MinGW alongside MSVC (#296)
This commit is contained in:
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user