LSST Applications g0f08755f38+9c285cab97,g1635faa6d4+bcae251498,g1653933729+a8ce1bb630,g1a0ca8cf93+bf6eb00ceb,g28da252d5a+0829b12dee,g29321ee8c0+18ecbd06b3,g2bbee38e9b+9634bc57db,g2bc492864f+9634bc57db,g2cdde0e794+c2c89b37c4,g3156d2b45e+41e33cbcdc,g347aa1857d+9634bc57db,g35bb328faa+a8ce1bb630,g3a166c0a6a+9634bc57db,g3e281a1b8c+9f2c4e2fc3,g414038480c+077ccc18e7,g41af890bb2+fde0dd39b6,g5fbc88fb19+17cd334064,g7642f7d749+9c285cab97,g781aacb6e4+a8ce1bb630,g80478fca09+55a9465950,g82479be7b0+ed77629bff,g858d7b2824+9c285cab97,g9125e01d80+a8ce1bb630,g9726552aa6+10f999ec6a,ga5288a1d22+2a84bb7594,gacf8899fa4+c69c5206e8,gae0086650b+a8ce1bb630,gb58c049af0+d64f4d3760,gbd46683f8f+1c79523530,gc28159a63d+9634bc57db,gcf0d15dbbd+4b7d09cae4,gda3e153d99+9c285cab97,gda6a2b7d83+4b7d09cae4,gdaeeff99f8+1711a396fd,ge2409df99d+dfd3d5294a,ge79ae78c31+9634bc57db,gf0baf85859+147a0692ba,gf3967379c6+02b11634a5,w.2024.46
LSST Data Management Base Package
Loading...
Searching...
No Matches
dateTime.cc
Go to the documentation of this file.
1#include "pybind11/pybind11.h"
3
5
6namespace py = pybind11;
7using namespace pybind11::literals;
8
9namespace lsst {
10namespace daf {
11namespace base {
13 auto clsDef = wrappers.wrapType(py::class_<DateTime>(wrappers.module, "DateTime"), [](auto &mod, auto &cls) {
14 cls.def(py::init<>());
15 cls.def_readonly_static("invalid_nsecs", &DateTime::invalid_nsecs);
16 cls.def(py::init<long long, DateTime::Timescale>(), "nsecs"_a, "scale"_a = DateTime::Timescale::TAI);
17 cls.def(py::init<double, DateTime::DateSystem, DateTime::Timescale>(), "date"_a,
18 "system"_a = DateTime::DateSystem::MJD, "scale"_a = DateTime::Timescale::TAI);
19 cls.def(py::init<int, int, int, int, int, int, DateTime::Timescale>());
20 cls.def(py::init<const std::string &, DateTime::Timescale>());
21 cls.def("nsecs", &DateTime::nsecs, "scale"_a = DateTime::Timescale::TAI);
22 cls.def("get", &DateTime::get, "system"_a = DateTime::DateSystem::MJD,
23 "scale"_a = DateTime::Timescale::TAI);
24 cls.def("toString", &DateTime::toString);
25 cls.def("gmtime", &DateTime::gmtime);
26 cls.def("timespec", &DateTime::timespec);
27 cls.def("timeval", &DateTime::timeval);
28 cls.def("isValid", &DateTime::isValid);
29 cls.def_static("now", &DateTime::now);
30 cls.def_static("initializeLeapSeconds", &DateTime::initializeLeapSeconds);
31 cls.def("__eq__", [](DateTime const &self, DateTime const &other) { return self == other; },
32 py::is_operator());
33 });
34
35 wrappers.wrapType(py::enum_<DateTime::Timescale>(clsDef, "Timescale"), [](auto &mod, auto &enm) {
36 enm.value("TAI", DateTime::Timescale::TAI);
37 enm.value("UTC", DateTime::Timescale::UTC);
38 enm.value("TT", DateTime::Timescale::TT);
39 enm.export_values();
40 });
41
42 wrappers.wrapType(py::enum_<DateTime::DateSystem>(clsDef, "DateSystem"), [](auto &mod, auto &enm) {
43 enm.value("JD", DateTime::DateSystem::JD);
44 enm.value("MJD", DateTime::DateSystem::MJD);
45 enm.value("EPOCH", DateTime::DateSystem::EPOCH);
46 enm.export_values();
47 });
48
49}
50
51} // base
52} // daf
53} // lsst
Interface for DateTime class.
A helper class for subdividing pybind11 module across multiple translation units (i....
Definition python.h:242
PyType wrapType(PyType cls, ClassWrapperCallback function, bool setModuleName=true)
Add a type (class or enum) wrapper, deferring method and other attribute definitions until finish() i...
Definition python.h:391
void wrapDateTime(WrapperCollection &wrappers)
Definition dateTime.cc:12