1 #include "pybind11/pybind11.h"
6 using namespace pybind11::literals;
13 py::class_<DateTime>
cls(mod,
"DateTime");
15 py::enum_<DateTime::Timescale>(
cls,
"Timescale")
16 .value(
"TAI", DateTime::Timescale::TAI)
17 .value(
"UTC", DateTime::Timescale::UTC)
18 .value(
"TT", DateTime::Timescale::TT)
21 py::enum_<DateTime::DateSystem>(
cls,
"DateSystem")
22 .value(
"JD", DateTime::DateSystem::JD)
23 .value(
"MJD", DateTime::DateSystem::MJD)
24 .value(
"EPOCH", DateTime::DateSystem::EPOCH)
28 .def_readonly_static(
"invalid_nsecs", &DateTime::invalid_nsecs)
29 .def(py::init<long long, DateTime::Timescale>(),
"nsecs"_a,
"scale"_a = DateTime::Timescale::TAI)
30 .def(py::init<double, DateTime::DateSystem, DateTime::Timescale>(),
"date"_a,
31 "system"_a = DateTime::DateSystem::MJD,
"scale"_a = DateTime::Timescale::TAI)
32 .def(py::init<int, int, int, int, int, int, DateTime::Timescale>())
33 .def(py::init<const std::string &, DateTime::Timescale>())
34 .def(
"nsecs", &DateTime::nsecs,
"scale"_a = DateTime::Timescale::TAI)
35 .def(
"get", &DateTime::get,
"system"_a = DateTime::DateSystem::MJD,
36 "scale"_a = DateTime::Timescale::TAI)
37 .def(
"toString", &DateTime::toString)
38 .def(
"gmtime", &DateTime::gmtime)
39 .def(
"timespec", &DateTime::timespec)
40 .def(
"timeval", &DateTime::timeval)
42 .def_static(
"now", &DateTime::now)
43 .def_static(
"initializeLeapSeconds", &DateTime::initializeLeapSeconds)