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

Request: introduce conversion between ptime and chrono system time #186

Open
arthur-tacca opened this issue Apr 8, 2021 · 0 comments
Open

Comments

@arthur-tacca
Copy link

Many thanks for this fantastic library!

I think it would be useful if it included conversion functions between std::chrono::system_clock::timepoint and boost::posix_time::ptime. They're conceptually the same thing so it ought to be easy for application code to convert between them. It's straightforward for application writers to their own conversion functions of course, but that code has to go somewhere so ends up being a bit less convenient than if it were in the library.

Personally I don't think the exact form of the functions is particularly important e.g. they could be proper conversion functions (constructor from time point and operator timepoint()), or methods (static from_chrono_timepoint() and non-static to_chrono_timepoint()) or free functions. My slight preference would be constructor and to_chrono_timepoint(). But any conversion operator should probably be explicit for backwards compatibility (e.g. for user code passing times to a function overloaded by ptime vs chrono time point).

There are probably other types that could potentially be converted - certainly at least posix time interval and chrono's system_clock::duration. But I think the most important would be the time point itself.

Here is a related changeset from 2009 but I assume it's a bit out of date by now.

@arthur-tacca arthur-tacca changed the title Request introduct conversion between ptime and chrono system time Request: introduce conversion between ptime and chrono system time Apr 8, 2021
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