mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 14:10:06 +00:00
Use HH date library when not using MSVC
This commit is contained in:
parent
e78dc9b3db
commit
593010acc2
10 changed files with 98 additions and 14 deletions
|
|
@ -11,6 +11,10 @@
|
|||
#include <cpr/cpr.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
# include <date/date.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
|
@ -177,13 +181,16 @@ void DirListSAXHandler::Characters(void* userData, const xmlChar* ch, int len)
|
|||
{
|
||||
using namespace std::chrono;
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
using namespace date;
|
||||
#endif
|
||||
|
||||
// Date time format: yyyy-mm-dd hh:mm
|
||||
static const std::string kDateTimeFormat {"%Y-%m-%d %H:%M"};
|
||||
static constexpr size_t kDateTimeSize {16u};
|
||||
|
||||
// Attempt to parse the date time
|
||||
std::istringstream ssCharacters {characters};
|
||||
sys_time<minutes> mtime;
|
||||
std::istringstream ssCharacters {characters};
|
||||
std::chrono::sys_time<minutes> mtime;
|
||||
ssCharacters >> parse(kDateTimeFormat, mtime);
|
||||
|
||||
if (!ssCharacters.fail())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue