Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion between std::chrono and numpy.datetime64 #2078

Open
phil-zxx opened this issue Jan 17, 2020 · 1 comment
Open

Conversion between std::chrono and numpy.datetime64 #2078

phil-zxx opened this issue Jan 17, 2020 · 1 comment

Comments

@phil-zxx
Copy link
Contributor

Using #include <pybind11/chrono.h> we can define

def(py::init([](const std::chrono::system_clock::time_point& obj)

so that we can convert between std::chrono and python's datetime.

Is there a similar concept for conversions between std::chrono and numpy's datetime64? I had a look at pybind11/numpy.h but couldn't find anything.

I am happy implement it and submit a PR, if someone could point me in the right direction for how to do it. Many thanks!

@phil-zxx
Copy link
Contributor Author

I've tried it myself, please see PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant