chrono icon indicating copy to clipboard operation
chrono copied to clipboard

timegm

Open MBkkt opened this issue 6 years ago • 4 comments

Why is there no something like boost::chrono::*something*::timegm(std::tm *)? At the same time, chrono use timegm in time_point_io.hpp

If there are no objective reasons for this, I would like to write it.

MBkkt avatar Aug 25 '19 11:08 MBkkt

Please, could you elaborate?

viboes avatar Aug 26 '19 05:08 viboes

I mean, it would be convenient if boost had the cross-platform function timegm (http://man7.org/linux/man-pages/man3/timegm.3.html, https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/mkgmtime-mkgmtime32-mkgmtime64?view=vs-2019). Especially if it is used in the boost https://github.com/boostorg/chrono/blob/develop/include/boost/chrono/io/time_point_io.hpp#L1166 One of my colleagues made a bug due to the fact that the standard library does not have timegm

MBkkt avatar Aug 26 '19 07:08 MBkkt

boost::posix_time::to_time_t(boost::posix_time::ptime_from_tm(tm_time)) Sorry, for example, such code works correctly, but in general it may be worthwhile to achieve some kind of consistency

MBkkt avatar Aug 26 '19 14:08 MBkkt

Ok, i'll consider a pr with tests and doc

viboes avatar Aug 26 '19 19:08 viboes