PicoScenes API Docs
 
Loading...
Searching...
No Matches
SystemTools::Time Namespace Reference

Functions

template<typename TimeUnit = std::chrono::seconds>
std::chrono::duration< TimeUnit > time_t2Duration (const time_t time)
 Converts a time_t to a duration.
 
template<typename TimeUnit >
time_t 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 > timespec2Duration (const timespec &ts)
 Converts a timespec to a duration.
 
template<typename Rep , typename Period >
struct timespec duration2Timespec (const std::chrono::duration< Rep, Period > &dur)
 Converts a duration to a timespec.
 
template<typename TimeUnit = std::chrono::microseconds>
std::chrono::duration< TimeUnit > timeval2Duration (const timeval &tv)
 Converts a timeval to a duration.
 
template<typename TimeUnit >
struct timeval 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 > time_t2TimePoint (const time_t time)
 Converts a time_t to a time_point.
 
template<typename Duration >
time_t 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 > 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 > timeval2TimePoint (const timeval &tv)
 Converts a timeval to a time_point.
 
template<typename Duration >
timespec time_point2Timespec (const std::chrono::time_point< std::chrono::system_clock, Duration > &tp)
 Converts a time_point to a timespec.
 
template<typename Duration >
timeval 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 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 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 > string2time_point (const std::string &timeString, const std::string &timeStringFormat=DATEFORMAT)
 Converts a string to a time_point.
 
int32_t delay_periodic (int32_t delay_us)
 Delays execution periodically.
 

Function Documentation

◆ delay_periodic()

int32_t SystemTools::Time::delay_periodic ( int32_t  delay_us)

Delays execution periodically.

Parameters
delay_usThe delay in microseconds.
Returns
Status code indicating success or failure.

◆ duration2String()

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 Parameters
TimeUnitThe unit of time for the duration.
Parameters
durationThe duration to convert.
formatThe format string for the output.
Returns
A string representing the duration.

Definition at line 331 of file TimeTools.hxx.

References duration2Time_t().

◆ duration2Time_t()

template<typename TimeUnit >
time_t SystemTools::Time::duration2Time_t ( const std::chrono::duration< TimeUnit > &  duration)

Converts a duration to a time_t.

Template Parameters
TimeUnitThe unit of time for the duration.
Parameters
durationThe duration to convert.
Returns
A time_t representing the duration.

Definition at line 78 of file TimeTools.hxx.

Referenced by duration2String().

◆ duration2Timespec()

template<typename Rep , typename Period >
struct timespec SystemTools::Time::duration2Timespec ( const std::chrono::duration< Rep, Period > &  dur)

Converts a duration to a timespec.

Template Parameters
RepThe representation type for the duration.
PeriodThe period type for the duration.
Parameters
durThe duration to convert.
Returns
A timespec representing the duration.

Definition at line 103 of file TimeTools.hxx.

◆ duration2Timeval()

template<typename TimeUnit >
struct timeval SystemTools::Time::duration2Timeval ( const std::chrono::duration< TimeUnit > &  dur)

Converts a duration to a timeval.

Template Parameters
TimeUnitThe unit of time for the duration.
Parameters
durThe duration to convert.
Returns
A timeval representing the duration.

Definition at line 133 of file TimeTools.hxx.

◆ string2time_point()

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.

Template Parameters
DurationThe duration type for the time_point.
Parameters
timeStringThe string to convert.
timeStringFormatThe format of the input string.
Returns
A time_point representing the string.

Definition at line 414 of file TimeTools.hxx.

◆ time_point2String()

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 Parameters
DurationThe duration type for the time_point.
Parameters
tpThe time_point to convert.
formatThe format string for the output.
Returns
A string representing the time_point.

Definition at line 317 of file TimeTools.hxx.

◆ time_point2Time_t()

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 Parameters
DurationThe duration type for the time_point.
Parameters
tpThe time_point to convert.
Returns
A time_t representing the time_point.

Definition at line 162 of file TimeTools.hxx.

◆ time_point2Timespec()

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 Parameters
DurationThe duration type for the time_point.
Parameters
tpThe time_point to convert.
Returns
A timespec representing the time_point.

Definition at line 198 of file TimeTools.hxx.

◆ time_point2Timeval()

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 Parameters
DurationThe duration type for the time_point.
Parameters
tpThe time_point to convert.
Returns
A timeval representing the time_point.

Definition at line 215 of file TimeTools.hxx.

◆ time_t2Duration()

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 Parameters
TimeUnitThe unit of time for the duration.
Parameters
timeThe time_t value to convert.
Returns
A duration representing the time_t value.

Definition at line 67 of file TimeTools.hxx.

◆ time_t2TimePoint()

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 Parameters
DurationThe duration type for the time_point.
Parameters
timeThe time_t value to convert.
Returns
A time_point representing the time_t value.

Definition at line 151 of file TimeTools.hxx.

◆ timespec2Duration()

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 Parameters
TimeUnitThe unit of time for the duration.
Parameters
tsThe timespec to convert.
Returns
A duration representing the timespec.

Definition at line 90 of file TimeTools.hxx.

◆ timespec2TimePoint()

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 Parameters
DurationThe duration type for the time_point.
Parameters
tsThe timespec to convert.
Returns
A time_point representing the timespec.

Definition at line 174 of file TimeTools.hxx.

◆ timeval2Duration()

template<typename TimeUnit = std::chrono::microseconds>
std::chrono::duration< TimeUnit > SystemTools::Time::timeval2Duration ( const timeval &  tv)

Converts a timeval to a duration.

Template Parameters
TimeUnitThe unit of time for the duration.
Parameters
tvThe timeval to convert.
Returns
A duration representing the timeval.

Definition at line 121 of file TimeTools.hxx.

◆ timeval2TimePoint()

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 Parameters
DurationThe duration type for the time_point.
Parameters
tvThe timeval to convert.
Returns
A time_point representing the timeval.

Definition at line 186 of file TimeTools.hxx.