mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-03 00:26:19 +08:00
Timestamp: Update workaround to support MinGW alongside MSVC (#296)
This commit is contained in:
@@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <iostream>
|
|
||||||
#include <iterator>
|
|
||||||
#include <locale>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -75,8 +72,8 @@ class Timestamp {
|
|||||||
const std::tm& tm() const { return tm_; }
|
const std::tm& tm() const { return tm_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
||||||
// This workaround is necessary, because MSVC doesn't support strptime.
|
// This workaround is necessary, because strptime is not available on Windows.
|
||||||
char* strptime(const char* _s, const char* _f, std::tm* _tm) {
|
char* strptime(const char* _s, const char* _f, std::tm* _tm) {
|
||||||
std::istringstream input(_s);
|
std::istringstream input(_s);
|
||||||
input.imbue(std::locale(setlocale(LC_ALL, nullptr)));
|
input.imbue(std::locale(setlocale(LC_ALL, nullptr)));
|
||||||
|
|||||||
Reference in New Issue
Block a user