summaryrefslogtreecommitdiff
path: root/lib/chronology.cpp
blob: 8707bba08d1f44c0585abbb3c7aadfa35501daee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include "chronology.h"

time_t
operator""_time_t(const char * iso, size_t)
{
	struct tm tm {};

	if (const auto end = strptime(iso, "%FT%T", &tm); !end || *end) {
		throw std::invalid_argument("Invalid date");
	}
	return mktime(&tm);
}