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));
70template <
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> >,
79template <
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> >,
88template <
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> >,
98template <
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> >,
111template <
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::
120 return goby::time::SystemClock::now<time::MicroTime>().value();
124[[deprecated(
"use goby::time::SystemClock::now<goby::time::SITime>().value()")]]
inline double
131[[deprecated(
"use goby::time::SystemClock::now<boost::posix_time::ptime>()")]]
inline boost::
138[[deprecated(
"use goby::time::SystemClock::now<boost::posix_time::ptime>()")]]
inline boost::
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);
boost::posix_time::ptime nmea_time2ptime(const std::string &mt)
double ptime2unix_double(boost::posix_time::ptime given_time)
std::string goby_time< std::string >()
Returns current UTC time as a human-readable string.
std::time_t ptime2time_t(boost::posix_time::ptime t)
convert from ptime to time_t from time.h (whole seconds since UNIX)
double goby_time< double >()
std::uint64_t ptime2unix_microsec(boost::posix_time::ptime given_time)
boost::posix_time::ptime goby_time< boost::posix_time::ptime >()
boost::posix_time::ptime unix_microsec2ptime(std::uint64_t given_time)
boost::posix_time::ptime unix_double2ptime(double given_time)
std::string goby_file_timestamp()
ISO string representation of goby_time()
boost::posix_time::ptime time_t2ptime(std::time_t t)
convert to ptime from time_t from time.h (whole seconds since UNIX)
std::uint64_t goby_time< std::uint64_t >()
std::string goby_time_as_string(const boost::posix_time::ptime &t=goby_time())
Simple string representation of goby_time()
boost::enable_if< boost::mpl::and_< boost::is_same< To, double >, boost::is_same< From, boost::posix_time::ptime > >, To >::type as(const From &from)
The global namespace for the Goby project.