mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
dateparser class removed
This commit is contained in:
parent
bc511cad69
commit
73eeb7321f
5 changed files with 1 additions and 99 deletions
|
@ -8,11 +8,10 @@ project(myext)
|
|||
set(SOURCE_HEADERS
|
||||
minicsv.h
|
||||
format.h
|
||||
dateparser.h)
|
||||
)
|
||||
|
||||
set(SOURCE_FILES
|
||||
format.cc
|
||||
dateparser.cpp
|
||||
date/tz.cpp)
|
||||
|
||||
# make static library called libmyxrm
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// Created by marcin on 22/11/15.
|
||||
//
|
||||
|
||||
#include "dateparser.h"
|
||||
|
||||
|
||||
dateparser::dateparser(std::string fmt)
|
||||
{
|
||||
// set format
|
||||
using namespace boost::local_time;
|
||||
local_time_input_facet* input_facet = new local_time_input_facet();
|
||||
input_facet->format(fmt.c_str());
|
||||
ss.imbue(std::locale(ss.getloc(), input_facet));
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
dateparser::operator()(std::string const& text)
|
||||
{
|
||||
ss.clear();
|
||||
ss.str(text);
|
||||
|
||||
bool ok = bool(ss >> pt);
|
||||
|
||||
if (ok)
|
||||
{
|
||||
auto tm = to_tm(pt);
|
||||
year = tm.tm_year;
|
||||
month = tm.tm_mon + 1; // for 1-based (1:jan, .. 12:dec)
|
||||
day = tm.tm_mday;
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
//
|
||||
// Created by marcin on 22/11/15.
|
||||
//
|
||||
|
||||
#ifndef XMR2CSV_DATEPARSER_H
|
||||
#define XMR2CSV_DATEPARSER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/date_time/local_time/local_time.hpp>
|
||||
|
||||
|
||||
// taken from: http://stackoverflow.com/a/19482908/248823
|
||||
struct dateparser
|
||||
{
|
||||
boost::posix_time::ptime pt;
|
||||
unsigned year, month, day;
|
||||
|
||||
dateparser(std::string fmt);
|
||||
|
||||
bool
|
||||
operator()(std::string const& text);
|
||||
|
||||
private:
|
||||
std::stringstream ss;
|
||||
};
|
||||
|
||||
#endif //XMR2CSV_DATEPARSER_H
|
Loading…
Add table
Add a link
Reference in a new issue