{ return lft->get_date() > rht->get_date(); });
}
std::tm get_time(const std::string& date)
int64_t parse_time(const std::string& date)
{
int year = 0;
int month = 0;
int day = 0;
std::sscanf(date.c_str(), "%d-%d-%d", &year, &month, &day); // NOLINT
tm time = {.tm_sec = 0,
.tm_min = 0,
.tm_hour = 0,
.tm_mday = day,
.tm_mon = month - 1,
.tm_year = year - 1900,
.tm_wday = 0,
.tm_yday = 0,
.tm_isdst = 0,
.tm_gmtoff = 0,
.tm_zone = nullptr};
return time;
}
#define rfc882_f "{:%a, %d %b %Y %H:%M:%S %z}" // NOLINT
#define rfc3339_f "{:%FT%H:%M:%SZ}" // NOLINT
std::string to_rfc882(const std::string& date)
{
using namespace std::chrono; // NOLINT
tm time = get_time(date);
const auto tmp = std::mktime(&time);
const auto chrono_time =
time_point_cast<seconds>(system_clock::from_time_t(tmp));
return std::format(rfc882_f, chrono_time);
}
std::string to_rfc3339(const std::string& date)
{
using namespace std::chrono; // NOLINT
tm time = get_time(date);
const auto tmp = std::mktime(&time);
const auto chrono_time =
time_point_cast<seconds>(system_clock::from_time_t(tmp));
return std::format(rfc3339_f, chrono_time);
std::tm tms = {};
std::stringstream stream(date);
stream >> std::get_time(&tms, "%Y-%m-%d");
return std::mktime(&tms);
}
void Indexer::create_index(std::ostream& ost, const std::string& name)