25 #ifndef GOBY_TIME_LEGACY_H
26 #define GOBY_TIME_LEGACY_H
43 [[deprecated(
"use time::convert()")]]
inline double
46 return time::convert<time::SITime>(given_time).value();
49 [[deprecated(
"use time::convert()")]]
inline boost::posix_time::ptime
52 return time::convert<boost::posix_time::ptime>(time::SITime::from_value(given_time));
55 [[deprecated(
"use time::convert()")]]
inline std::uint64_t
58 return time::convert<time::MicroTime>(given_time).value();
61 [[deprecated(
"use time::convert()")]]
inline boost::posix_time::ptime
64 return time::convert<boost::posix_time::ptime>(time::MicroTime::from_value(given_time));
70 template <
typename To,
typename From>
71 [[deprecated(
"use time::convert()")]]
typename boost::enable_if<
72 boost::mpl::and_<boost::is_same<To, double>, boost::is_same<From, boost::posix_time::ptime> >,
79 template <
typename To,
typename From>
80 [[deprecated(
"use time::convert()")]]
typename boost::enable_if<
81 boost::mpl::and_<boost::is_same<To, boost::posix_time::ptime>, boost::is_same<From, double> >,
88 template <
typename To,
typename From>
89 [[deprecated(
"use time::convert()")]]
90 typename boost::enable_if<boost::mpl::and_<boost::is_same<To, std::uint64_t>,
91 boost::is_same<From, boost::posix_time::ptime> >,
98 template <
typename To,
typename From>
99 [[deprecated(
"use time::convert()")]]
100 typename boost::enable_if<boost::mpl::and_<boost::is_same<To, boost::posix_time::ptime>,
101 boost::is_same<From, std::uint64_t> >,
111 template <
typename ReturnType>
112 [[deprecated(
"use goby::time::SystemClock::now()")]] ReturnType
goby_time() {
113 static_assert(
sizeof(ReturnType) == 0,
"Invalid ReturnType for goby_time<>()");
117 [[deprecated(
"use goby::time::SystemClock::now<goby::time::MicroTime>().value()")]]
inline std::
118 uint64_t goby_time<std::uint64_t>()
120 return goby::time::SystemClock::now<time::MicroTime>().value();
124 [[deprecated(
"use goby::time::SystemClock::now<goby::time::SITime>().value()")]]
inline double
127 return static_cast<double>(goby_time<std::uint64_t>()) / 1.0e6;
131 [[deprecated(
"use goby::time::SystemClock::now<boost::posix_time::ptime>()")]]
inline boost::
133 goby_time<boost::posix_time::ptime>()
135 return util::as<boost::posix_time::ptime>(goby_time<std::uint64_t>());
138 [[deprecated(
"use goby::time::SystemClock::now<boost::posix_time::ptime>()")]]
inline boost::
142 return goby_time<boost::posix_time::ptime>();
146 template <>[[deprecated(
"use goby::time::str()")]]
inline std::string goby_time<std::string>()
148 return goby::util::as<std::string>(goby_time<boost::posix_time::ptime>());
152 [[deprecated(
"use goby::time::str()")]]
inline std::string
155 return goby::util::as<std::string>(t);
161 using namespace boost::posix_time;
162 return to_iso_string(second_clock::universal_time());
166 [[deprecated]]
inline boost::posix_time::ptime
time_t2ptime(std::time_t t)
168 return boost::posix_time::from_time_t(t);
172 [[deprecated]]
inline std::time_t
ptime2time_t(boost::posix_time::ptime t)
174 std::tm out = boost::posix_time::to_tm(t);
178 [[deprecated(
"use convert_from_nmea")]]
inline boost::posix_time::ptime
181 return time::convert_from_nmea<boost::posix_time::ptime>(mt);