Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,17 @@ int my_mkdir(const std::string& path, int perms)
char* my_strptime(const char* s,
const char* f,
struct tm* tm)
{
// just use normal strptime, the DIY implementation was being Weird
return strptime(s, f, tm);

// std::istringstream input(s);
// input.imbue(std::locale(setlocale(LC_ALL, nullptr)));
// input >> std::get_time(tm, f);
// if (input.fail())
// {
// return nullptr;
// }
// return (char*)(s + input.tellg());
try {
std::istringstream input(s);
input.imbue(std::locale::classic());
input >> std::get_time(tm, f);
if (input.fail())
{
return nullptr;
}
return (char*)(s + input.tellg());
} catch (...) {
return nullptr;
}

// http://stackoverflow.com/a/11366985
Expand Down
Loading