diff options
Diffstat (limited to 'boost/date_time/posix_time/conversion.hpp')
-rw-r--r-- | boost/date_time/posix_time/conversion.hpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/boost/date_time/posix_time/conversion.hpp b/boost/date_time/posix_time/conversion.hpp index 59e5cb7c12..ed3d4867e9 100644 --- a/boost/date_time/posix_time/conversion.hpp +++ b/boost/date_time/posix_time/conversion.hpp @@ -30,6 +30,14 @@ namespace posix_time { return start + seconds(static_cast<long>(t)); } + //! Function that converts a ptime into a time_t + inline + std::time_t to_time_t(ptime pt) + { + time_duration dur = pt - ptime(gregorian::date(1970,1,1)); + return std::time_t(dur.total_seconds()); + } + //! Convert a time to a tm structure truncating any fractional seconds inline std::tm to_tm(const boost::posix_time::ptime& t) { |