PicoScenes API Docs
 
Loading...
Searching...
No Matches
TimeTools.hxx File Reference
#include <iomanip>
#include <chrono>
#include <thread>
#include "BoostHeaders.hxx"
Include dependency graph for TimeTools.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  SystemTools
 
namespace  SystemTools::Time
 

Macros

#define DATEFORMAT   "%Y-%m-%d %T"
 

Typedefs

typedef std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds > TimePoint_System_Millisecond
 Type alias for system time points with millisecond precision.
 
typedef std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds > TimePoint_System_Microsecond
 Type alias for system time points with microsecond precision.
 
typedef std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds > TimePoint_System_Second
 Type alias for system time points with second precision.
 

Functions

std::ostream & operator<< (std::ostream &os, const std::chrono::system_clock::time_point &t)
 Overloads the << operator for time_point.
 
std::ostream & operator<< (std::ostream &os, const timespec &ts)
 Overloads the << operator for timespec.
 
std::ostream & operator<< (std::ostream &os, const timeval &tv)
 Overloads the << operator for timeval.
 
template<typename TimeUnit = std::chrono::seconds>
std::chrono::duration< TimeUnit > SystemTools::Time::time_t2Duration (const time_t time)
 Converts a time_t to a duration.
 
template<typename TimeUnit >
time_t SystemTools::Time::duration2Time_t (const std::chrono::duration< TimeUnit > &duration)
 Converts a duration to a time_t.
 
template<typename TimeUnit = std::chrono::nanoseconds, typename Rep = typename TimeUnit::rep, typename Period = typename TimeUnit::period>
std::chrono::duration< Rep, Period > SystemTools::Time::timespec2Duration (const timespec &ts)
 Converts a timespec to a duration.
 
template<typename Rep , typename Period >
struct timespec SystemTools::Time::duration2Timespec (const std::chrono::duration< Rep, Period > &dur)
 Converts a duration to a timespec.
 
template<typename TimeUnit = std::chrono::microseconds>
std::chrono::duration< TimeUnit > SystemTools::Time::timeval2Duration (const timeval &tv)
 Converts a timeval to a duration.
 
template<typename TimeUnit >
struct timeval SystemTools::Time::duration2Timeval (const std::chrono::duration< TimeUnit > &dur)
 Converts a duration to a timeval.
 
template<typename Duration = std::chrono::seconds>
std::chrono::time_point< std::chrono::system_clock, Duration > SystemTools::Time::time_t2TimePoint (const time_t time)
 Converts a time_t to a time_point.
 
template<typename Duration >
time_t SystemTools::Time::time_point2Time_t (const std::chrono::time_point< std::chrono::system_clock, Duration > &tp)
 Converts a time_point to a time_t.
 
template<typename Duration = std::chrono::nanoseconds>
std::chrono::time_point< std::chrono::system_clock, Duration > SystemTools::Time::timespec2TimePoint (const timespec &ts)
 Converts a timespec to a time_point.
 
template<typename Duration = std::chrono::microseconds>
std::chrono::time_point< std::chrono::system_clock, Duration > SystemTools::Time::timeval2TimePoint (const timeval &tv)
 Converts a timeval to a time_point.
 
template<typename Duration >
timespec SystemTools::Time::time_point2Timespec (const std::chrono::time_point< std::chrono::system_clock, Duration > &tp)
 Converts a time_point to a timespec.
 
template<typename Duration >
timeval SystemTools::Time::time_point2Timeval (const std::chrono::time_point< std::chrono::system_clock, Duration > &tp)
 Converts a time_point to a timeval.
 
template<typename Duration >
std::string SystemTools::Time::time_point2String (const std::chrono::time_point< std::chrono::system_clock, Duration > &tp, const std::string &format=DATEFORMAT)
 Converts a time_point to a string.
 
template<typename TimeUnit >
std::string SystemTools::Time::duration2String (const std::chrono::duration< TimeUnit > &duration, const std::string &format=DATEFORMAT)
 Converts a duration to a string.
 
template<typename Duration = std::chrono::seconds>
std::chrono::time_point< std::chrono::system_clock, Duration > SystemTools::Time::string2time_point (const std::string &timeString, const std::string &timeStringFormat=DATEFORMAT)
 Converts a string to a time_point.
 
int32_t SystemTools::Time::delay_periodic (int32_t delay_us)
 Delays execution periodically.
 

Macro Definition Documentation

◆ DATEFORMAT

#define DATEFORMAT   "%Y-%m-%d %T"

Definition at line 13 of file TimeTools.hxx.

Typedef Documentation

◆ TimePoint_System_Microsecond

typedef std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds> TimePoint_System_Microsecond

Type alias for system time points with microsecond precision.

Definition at line 25 of file TimeTools.hxx.

◆ TimePoint_System_Millisecond

typedef std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds> TimePoint_System_Millisecond

Type alias for system time points with millisecond precision.

Definition at line 20 of file TimeTools.hxx.

◆ TimePoint_System_Second

typedef std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds> TimePoint_System_Second

Type alias for system time points with second precision.

Definition at line 30 of file TimeTools.hxx.

Function Documentation

◆ operator<<() [1/3]

std::ostream & operator<< ( std::ostream &  os,
const std::chrono::system_clock::time_point &  t 
)

Overloads the << operator for time_point.

Parameters
osThe output stream.
tThe time_point to output.
Returns
The output stream.

◆ operator<<() [2/3]

std::ostream & operator<< ( std::ostream &  os,
const timespec &  ts 
)

Overloads the << operator for timespec.

Parameters
osThe output stream.
tsThe timespec to output.
Returns
The output stream.

◆ operator<<() [3/3]

std::ostream & operator<< ( std::ostream &  os,
const timeval &  tv 
)

Overloads the << operator for timeval.

Parameters
osThe output stream.
tvThe timeval to output.
Returns
The output stream.