You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
Many thanks for this fantastic library!
I think it would be useful if it included conversion functions between
std::chrono::system_clock::timepoint
andboost::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 (staticfrom_chrono_timepoint()
and non-staticto_chrono_timepoint()
) or free functions. My slight preference would be constructor andto_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.
The text was updated successfully, but these errors were encountered: