27 #ifndef PSS_ASTROTYPES_UTILS_TIMEPOINT_H
28 #define PSS_ASTROTYPES_UTILS_TIMEPOINT_H
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wall"
31 #pragma GCC diagnostic ignored "-Wpragmas"
32 #pragma GCC diagnostic ignored "-Wunused-parameter"
33 #pragma GCC diagnostic ignored "-Wunused-variable"
34 #include <boost/units/systems/si/time.hpp>
35 #include <boost/units/quantity.hpp>
36 #include <boost/units/is_quantity.hpp>
37 #include <boost/units/is_unit_of_dimension.hpp>
38 #pragma GCC diagnostic pop
44 namespace astrotypes {
52 template<
typename ClockType,
typename Duration =
typename ClockType::duration>
53 struct TimePoint :
public std::chrono::time_point<ClockType, Duration>
55 explicit TimePoint(
const Duration& d =
typename ClockType::duration() );
56 template<
typename QuantityType>
58 explicit TimePoint( QuantityType
const& d,
typename std::enable_if<
59 boost::units::is_quantity<QuantityType>::value
60 && boost::units::is_unit_of_dimension<typename QuantityType::unit_type, boost::units::time_dimension>::value
61 , QuantityType>::type = 0);
62 explicit TimePoint(
const std::chrono::system_clock::time_point& tp );
63 TimePoint(
const std::chrono::time_point<ClockType, Duration>& tp );
64 TimePoint( std::chrono::time_point<ClockType, Duration>&& );
66 operator typename std::chrono::system_clock::time_point()
const;
77 template<
typename ClockType,
typename Duration,
typename Duration2>
80 template<
typename ClockType,
typename Duration,
typename Duration2>
83 template<
typename ClockType,
typename Duration,
typename Duration2>
91 template<
typename ClockType,
typename Duration>
92 std::ostream& operator<<(std::ostream&, TimePoint<ClockType>
const& tp);
99 #endif // PSS_ASTROTYPES_UTILS_TIMEPOINT_H
TimePoint(const Duration &d=typename ClockType::duration())
std::time_t to_time_t() const
convert to a C style time struct. very useful if you want to output the time as a string with e...
TimePoint< ClockType, Duration > operator+(TimePoint< ClockType, Duration > const &lhs, Duration2 const &rhs)
TimePoint< ClockType, Duration > & operator-=(Duration const &)
TimePoint< ClockType, Duration > & operator+=(Duration const &)
TimePoint< ClockType, DurationType > operator-(TimePoint< ClockType, DurationType > const &lhs, boost::units::quantity< boost::units::si::time, Rep > const &rhs)
extension of std::chrono::time_point for astrotypes clocks