faster csv loading
This commit is contained in:
@@ -23,12 +23,16 @@ std::string date_to_string(const long datetime, const std::string format) {
|
||||
return "invalid argument";
|
||||
}
|
||||
|
||||
|
||||
std::istringstream in_ss;
|
||||
long string_to_date(const std::string &datestr, const std::string &format) {
|
||||
// format for example "%d.%m.%Y";
|
||||
|
||||
std::istringstream in{datestr.c_str()};
|
||||
in_ss.clear();
|
||||
in_ss.str(datestr);
|
||||
|
||||
date::sys_seconds tp;
|
||||
in >> date::parse(format, tp);
|
||||
date::from_stream(in_ss, format.c_str(), tp);
|
||||
return tp.time_since_epoch().count();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user