37 #ifndef OMPL_UTIL_TIME_ 38 #define OMPL_UTIL_TIME_ 46 #if defined(__GNUC__) && (__GNUC__ < 5) 49 inline std::string put_time(
const std::tm *tmb,
const char *fmt)
52 std::strftime(mbstr,
sizeof(mbstr), fmt, tmb);
64 typedef std::chrono::system_clock::time_point
point;
67 typedef std::chrono::system_clock::duration
duration;
72 return std::chrono::system_clock::now();
79 auto us = (long)((sec - (
double)s) * 1000000);
80 return std::chrono::seconds(s) + std::chrono::microseconds(us);
86 return std::chrono::duration<double>(d).count();
92 std::time_t pt = std::chrono::system_clock::to_time_t(p);
94 ss << std::put_time(std::localtime(&pt),
"%F %T");
std::string as_string(const point &p)
Return string representation of point in time.
duration seconds(double sec)
Return the time duration representing a given number of seconds.
Main namespace. Contains everything in this library.
std::chrono::system_clock::duration duration
Representation of a time duration.
point now()
Get the current time point.
std::chrono::system_clock::time_point point
Representation of a point in time.