1 #include "pybind11/pybind11.h" 5 namespace py = pybind11;
13 py::module mod(
"dateTime");
15 py::class_<DateTime> cls(mod,
"DateTime");
17 py::enum_<DateTime::Timescale>(cls,
"Timescale")
18 .value(
"TAI", DateTime::Timescale::TAI)
19 .value(
"UTC", DateTime::Timescale::UTC)
20 .value(
"TT", DateTime::Timescale::TT)
23 py::enum_<DateTime::DateSystem>(cls,
"DateSystem")
24 .value(
"JD", DateTime::DateSystem::JD)
25 .value(
"MJD", DateTime::DateSystem::MJD)
26 .value(
"EPOCH", DateTime::DateSystem::EPOCH)
30 .def_readonly_static(
"invalid_nsecs", &DateTime::invalid_nsecs)
31 .def(py::init<long long, DateTime::Timescale>(),
"nsecs"_a,
"scale"_a = DateTime::Timescale::TAI)
32 .def(py::init<double, DateTime::DateSystem, DateTime::Timescale>(),
"date"_a,
33 "system"_a = DateTime::DateSystem::MJD,
"scale"_a = DateTime::Timescale::TAI)
34 .def(py::init<int, int, int, int, int, int, DateTime::Timescale>())
35 .def(py::init<const std::string &, DateTime::Timescale>())
36 .def(
"nsecs", &DateTime::nsecs,
"scale"_a = DateTime::Timescale::TAI)
37 .def(
"get", &DateTime::get,
"system"_a = DateTime::DateSystem::MJD,
38 "scale"_a = DateTime::Timescale::TAI)
39 .def(
"toString", &DateTime::toString)
40 .def(
"gmtime", &DateTime::gmtime)
41 .def(
"timespec", &DateTime::timespec)
42 .def(
"timeval", &DateTime::timeval)
43 .def(
"isValid", &DateTime::isValid)
44 .def_static(
"now", &DateTime::now)
45 .def_static(
"initializeLeapSeconds", &DateTime::initializeLeapSeconds)
46 .def(
"__eq__", [](
DateTime const &
self,
DateTime const &other) {
return self == other; },
Class for handling dates/times, including MJD, UTC, and TAI.
Interface for DateTime class.
PYBIND11_PLUGIN(dateTime)