Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
toolbox::sys Namespace Reference

Namespaces

namespace  detail
 

Classes

class  AsyncLogger
 
class  CyclTime
 
struct  IsoDatePolicy
 
struct  JDayPolicy
 
class  Log
 
class  Logger
 The Logger is implemented by types that write log messages to a sink. More...
 
struct  MonoClock
 
struct  PutTime
 
class  Runner
 
class  ScopedLogger
 
class  ScopedLogLevel
 
class  SigWait
 
struct  ThreadConfig
 ThreadConfig holds the thread attributes. More...
 
struct  WallClock
 

Typedefs

using IsoDate = IntWrapper< IsoDatePolicy >
 ISO8601 date in yyymmdd format.
 
using JDay = IntWrapper< JDayPolicy >
 Julian day.
 
using LogStream = util::OStream< MaxLogLine >
 Logger callback function.
 
using LogMsgPtr = StoragePtr< MaxLogLine >
 
using LogBufPool = boost::lockfree::stack< LogMsgPtr, boost::lockfree::capacity< LogBufPoolCapacity > >
 
using PidFile = std::unique_ptr< pidfh, detail::PidFileDeleter >
 
using Seconds = std::chrono::seconds
 
using Decis = std::chrono::duration< int64_t, std::deci >
 
using Millis = std::chrono::milliseconds
 
using Micros = std::chrono::microseconds
 
using Nanos = std::chrono::nanoseconds
 
using NanoTime = Nanos
 
using Duration = Nanos
 
using MonoTime = MonoClock::time_point
 
using WallTime = WallClock::time_point
 

Enumerations

enum  : std::size_t {
  CacheLineBits = 6 , CacheLineSize = 1 << CacheLineBits , PageBits = 12 , PageSize = 1 << PageBits ,
  MaxLogLine = 4096
}
 
enum class  LogLevel : int {
  None , Crit , Error , Warn ,
  Metric , Notice , Info , Debug
}
 

Functions

void close_all () noexcept
 Close all non-standard file handles.
 
void daemon ()
 Daemonise process. Detach from controlling terminal and run in the background as a system daemon.
 
constexpr auto operator""_ymd (unsigned long long val) noexcept
 
constexpr auto operator""_jd (unsigned long long val) noexcept
 
constexpr auto ymd_to_iso (int year, int mon, int mday) noexcept
 Gregorian to ISO8601 date.
 
constexpr auto ymd_to_jd (int year, int mon, int mday) noexcept
 Gregorian date to Julian day.
 
constexpr auto iso_to_jd (IsoDate iso) noexcept
 ISO8601 to Julian day.
 
constexpr auto jd_to_iso (JDay jd) noexcept
 Julian day to ISO8601.
 
constexpr std::int32_t jd_to_mjd (JDay jd) noexcept
 Juilian day to Modified Julian day. Epoch is November 17, 1858.
 
constexpr auto mjd_to_jd (std::int32_t mjd) noexcept
 Modified Julian day to Julian day. Epoch is November 17, 1858.
 
constexpr std::int32_t jd_to_tjd (JDay jd) noexcept
 Julian day to Truncated Julian day. Epoch is May 24, 1968.
 
constexpr JDay tjd_to_jd (std::int32_t tjd) noexcept
 Truncated Julian day to Julian day. Epoch is May 24, 1968.
 
constexpr WallTime jd_to_time (JDay jd) noexcept
 Julian day to Unix time.
 
constexpr IsoDate maybe_jd_to_iso (JDay jd) noexcept
 Julian day to ISO8601 if argument is non-zero.
 
constexpr JDay maybe_iso_to_jd (IsoDate iso) noexcept
 ISO8601 to Julian day if argument is non-zero.
 
constexpr WallTime iso_to_time (IsoDate iso) noexcept
 ISO8601 to Unix time.
 
constexpr bool is_week_day (JDay jday) noexcept
 
constexpr bool is_weekend_day (JDay jday) noexcept
 
constexpr auto parse_date (std::string_view sv) noexcept
 
constexpr std::optional< WallTimeparse_time (std::string_view sv) noexcept
 
std::error_code make_error (int err) noexcept
 
constexpr std::size_t ceil_cache_line (std::size_t size) noexcept
 
constexpr std::size_t ceil_page (std::size_t size) noexcept
 
LogStreamlog_stream () noexcept
 
LogBufPoollog_buf_pool () noexcept
 A pool of log buffers, eliminating the need for dynamic memory allocations when logging.
 
void set_log_warming_mode (bool enabled) noexcept
 
bool log_warming_mode_enabled () noexcept
 Returns true if log warming mode is enabled.
 
Loggernull_logger () noexcept
 Null logger. This logger does nothing and is effectively /dev/null.
 
Loggerstd_logger () noexcept
 
Loggersys_logger () noexcept
 System logger. This logger calls syslog().
 
const charlog_label (LogLevel level) noexcept
 Return log label for given log level.
 
LogLevel get_log_level () noexcept
 Return current log level.
 
LogLevel set_log_level (LogLevel level) noexcept
 Set log level globally for all threads.
 
Loggerget_logger () noexcept
 Return current logger.
 
Loggerset_logger (Logger &logger) noexcept
 Set logger globally for all threads.
 
void write_log (WallTime ts, LogLevel level, LogMsgPtr &&msg, std::size_t size) noexcept
 
bool is_log_level (LogLevel level) noexcept
 Return true if level is less than or equal to current log level.
 
Loggerset_logger (std::nullptr_t) noexcept
 
template<typename StreamT >
requires Streamable<StreamT>
StreamToperator<< (StreamT &os, LogLevel level)
 
PidFile open_pid_file (const char *path, mode_t mode)
 
void close_pid_file (PidFile &pf) noexcept
 Close pidfile without removing it. This function should be used when forking daemon processes.
 
void write_pid_file (PidFile &pf)
 Write process' PID into pidfile.
 
void sig_block_all ()
 Block all signals.
 
cpu_set_t parse_cpu_set (string_view s) noexcept
 
int parse_sched_policy (string_view s)
 
void set_thread_attrs (const ThreadConfig &config)
 
TOOLBOX_WEAK Nanos get_time (clockid_t clock_id) noexcept
 
template<typename RepT , typename PeriodT >
constexpr bool is_zero (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr bool is_zero (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT , typename DurationT >
constexpr DurationT time_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT >
constexpr std::int64_t ms_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT >
constexpr std::int64_t us_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT >
constexpr std::int64_t ns_since_epoch (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename ClockT , typename RepT , typename PeriodT >
constexpr auto to_time (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr auto to_time (timeval tv) noexcept
 
template<typename ClockT >
constexpr auto to_time (timespec ts) noexcept
 
template<typename RepT , typename PeriodT >
constexpr timeval to_timeval (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr timeval to_timeval (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename RepT , typename PeriodT >
constexpr timespec to_timespec (std::chrono::duration< RepT, PeriodT > d) noexcept
 
template<typename ClockT >
constexpr timespec to_timespec (std::chrono::time_point< ClockT, Duration > t) noexcept
 
template<typename StreamT >
requires Streamable<StreamT>
StreamToperator<< (StreamT &os, MonoTime t)
 
template<typename StreamT >
requires Streamable<StreamT>
StreamToperator<< (StreamT &os, WallTime t)
 
template<typename DurationT = Seconds>
auto put_time (WallTime t, const char *fmt) noexcept
 
template<typename DurationT , typename StreamT >
requires Streamable<StreamT>
StreamToperator<< (StreamT &os, PutTime< DurationT > pt)
 
constexpr bool is_zero (timeval tv) noexcept
 
void clear (timeval &tv) noexcept
 
timeval operator+ (timeval lhs, timeval rhs) noexcept
 
timeval operator- (timeval lhs, timeval rhs) noexcept
 
constexpr bool is_zero (timespec ts) noexcept
 
void clear (timespec &ts) noexcept
 
timespec operator+ (timespec lhs, timespec rhs) noexcept
 
timespec operator- (timespec lhs, timespec rhs) noexcept
 
constexpr auto parse_nanos (std::string_view sv) noexcept
 
constexpr std::optional< Nanosparse_time_only (std::string_view sv) noexcept
 

Variables

constexpr std::size_t LogBufPoolCapacity = 64
 

Typedef Documentation

◆ IsoDate

ISO8601 date in yyymmdd format.

Definition at line 30 of file Date.hpp.

◆ JDay

Julian day.

Definition at line 38 of file Date.hpp.

◆ LogStream

Logger callback function.

Definition at line 28 of file Log.hpp.

◆ LogMsgPtr

Definition at line 54 of file Logger.hpp.

◆ LogBufPool

using toolbox::sys::LogBufPool = typedef boost::lockfree::stack<LogMsgPtr, boost::lockfree::capacity<LogBufPoolCapacity> >

Definition at line 56 of file Logger.hpp.

◆ PidFile

Definition at line 34 of file PidFile.hpp.

◆ Seconds

using toolbox::sys::Seconds = typedef std::chrono::seconds

Definition at line 35 of file Time.hpp.

◆ Decis

using toolbox::sys::Decis = typedef std::chrono::duration<int64_t, std::deci>

Definition at line 36 of file Time.hpp.

◆ Millis

using toolbox::sys::Millis = typedef std::chrono::milliseconds

Definition at line 37 of file Time.hpp.

◆ Micros

using toolbox::sys::Micros = typedef std::chrono::microseconds

Definition at line 38 of file Time.hpp.

◆ Nanos

using toolbox::sys::Nanos = typedef std::chrono::nanoseconds

Definition at line 39 of file Time.hpp.

◆ NanoTime

Definition at line 41 of file Time.hpp.

◆ Duration

Definition at line 42 of file Time.hpp.

◆ MonoTime

Definition at line 112 of file Time.hpp.

◆ WallTime

Definition at line 113 of file Time.hpp.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum : std::size_t
Enumerator
CacheLineBits 
CacheLineSize 
PageBits 
PageSize 
MaxLogLine 

Maximum log line size.

Definition at line 29 of file Limits.hpp.

◆ LogLevel

Enumerator
None 

None.

Crit 

Critical.

Error 

Error.

Warn 

Warning.

Metric 
Notice 

Notice.

Info 

Information.

Debug 

Debug.

Definition at line 35 of file Logger.hpp.

Function Documentation

◆ close_all()

TOOLBOX_API void toolbox::sys::close_all ( )
noexcept

Close all non-standard file handles.

Definition at line 27 of file Daemon.cpp.

◆ daemon()

TOOLBOX_API void toolbox::sys::daemon ( )

Daemonise process. Detach from controlling terminal and run in the background as a system daemon.

Definition at line 36 of file Daemon.cpp.

◆ operator""_ymd()

constexpr auto toolbox::sys::operator""_ymd ( unsigned long long  val)
constexprnoexcept

Definition at line 32 of file Date.hpp.

◆ operator""_jd()

constexpr auto toolbox::sys::operator""_jd ( unsigned long long  val)
constexprnoexcept

Definition at line 40 of file Date.hpp.

◆ ymd_to_iso()

constexpr auto toolbox::sys::ymd_to_iso ( int  year,
int  mon,
int  mday 
)
constexprnoexcept

Gregorian to ISO8601 date.

Definition at line 46 of file Date.hpp.

◆ ymd_to_jd()

constexpr auto toolbox::sys::ymd_to_jd ( int  year,
int  mon,
int  mday 
)
constexprnoexcept

Gregorian date to Julian day.

Definition at line 54 of file Date.hpp.

◆ iso_to_jd()

constexpr auto toolbox::sys::iso_to_jd ( IsoDate  iso)
constexprnoexcept

ISO8601 to Julian day.

Definition at line 69 of file Date.hpp.

◆ jd_to_iso()

constexpr auto toolbox::sys::jd_to_iso ( JDay  jd)
constexprnoexcept

Julian day to ISO8601.

Definition at line 79 of file Date.hpp.

◆ jd_to_mjd()

constexpr std::int32_t toolbox::sys::jd_to_mjd ( JDay  jd)
constexprnoexcept

Juilian day to Modified Julian day. Epoch is November 17, 1858.

Definition at line 100 of file Date.hpp.

◆ mjd_to_jd()

constexpr auto toolbox::sys::mjd_to_jd ( std::int32_t  mjd)
constexprnoexcept

Modified Julian day to Julian day. Epoch is November 17, 1858.

Definition at line 106 of file Date.hpp.

◆ jd_to_tjd()

constexpr std::int32_t toolbox::sys::jd_to_tjd ( JDay  jd)
constexprnoexcept

Julian day to Truncated Julian day. Epoch is May 24, 1968.

Definition at line 112 of file Date.hpp.

◆ tjd_to_jd()

constexpr JDay toolbox::sys::tjd_to_jd ( std::int32_t  tjd)
constexprnoexcept

Truncated Julian day to Julian day. Epoch is May 24, 1968.

Definition at line 118 of file Date.hpp.

◆ jd_to_time()

constexpr WallTime toolbox::sys::jd_to_time ( JDay  jd)
constexprnoexcept

Julian day to Unix time.

Definition at line 124 of file Date.hpp.

◆ maybe_jd_to_iso()

constexpr IsoDate toolbox::sys::maybe_jd_to_iso ( JDay  jd)
constexprnoexcept

Julian day to ISO8601 if argument is non-zero.

Definition at line 134 of file Date.hpp.

◆ maybe_iso_to_jd()

constexpr JDay toolbox::sys::maybe_iso_to_jd ( IsoDate  iso)
constexprnoexcept

ISO8601 to Julian day if argument is non-zero.

Definition at line 140 of file Date.hpp.

◆ iso_to_time()

constexpr WallTime toolbox::sys::iso_to_time ( IsoDate  iso)
constexprnoexcept

ISO8601 to Unix time.

Definition at line 146 of file Date.hpp.

◆ is_week_day()

constexpr bool toolbox::sys::is_week_day ( JDay  jday)
constexprnoexcept

Definition at line 152 of file Date.hpp.

◆ is_weekend_day()

constexpr bool toolbox::sys::is_weekend_day ( JDay  jday)
constexprnoexcept

Definition at line 157 of file Date.hpp.

◆ parse_date()

constexpr auto toolbox::sys::parse_date ( std::string_view  sv)
constexprnoexcept

Date represented in UTC (Universal Time Coordinated, also known as "GMT") in YYYYMMDD format. This special-purpose field is paired with UTCTimeOnly to form a proper UTCTimestamp for bandwidth-sensitive messages.

Valid values:

  • YYYY = 0000-9999;
  • MM = 01-12;
  • DD = 01-31.

Definition at line 170 of file Date.hpp.

◆ parse_time()

constexpr std::optional< WallTime > toolbox::sys::parse_time ( std::string_view  sv)
constexprnoexcept

Time/date combination represented in UTC (Universal Time Coordinated, also known as "GMT") in either YYYYMMDD-HH:MM:SS (whole seconds) or YYYYMMDD-HH:MM:SS.sss (milliseconds) format, colons, dash, and period required.

Valid values:

  • YYYY = 0000-9999;
  • MM = 01-12;
  • DD = 01-31;
  • HH = 00-23;
  • MM = 00-59;
  • SS = 00-60 (60 only if UTC leap second);
  • sss = 000-999 (indicating milliseconds).

Definition at line 188 of file Date.hpp.

◆ make_error()

std::error_code toolbox::sys::make_error ( int  err)
inlinenoexcept

◆ ceil_cache_line()

constexpr std::size_t toolbox::sys::ceil_cache_line ( std::size_t  size)
constexprnoexcept

Definition at line 38 of file Limits.hpp.

◆ ceil_page()

constexpr std::size_t toolbox::sys::ceil_page ( std::size_t  size)
constexprnoexcept

Definition at line 43 of file Limits.hpp.

◆ log_stream()

TOOLBOX_API LogStream & toolbox::sys::log_stream ( )
noexcept

Thread-local log stream. This thread-local instance of OStream can be used to format log messages before writing them the log.

Definition at line 26 of file Log.cpp.

◆ log_buf_pool()

TOOLBOX_API LogBufPool & toolbox::sys::log_buf_pool ( )
noexcept

A pool of log buffers, eliminating the need for dynamic memory allocations when logging.

Definition at line 187 of file Logger.cpp.

◆ set_log_warming_mode()

TOOLBOX_API void toolbox::sys::set_log_warming_mode ( bool  enabled)
noexcept

Enables log warming mode. In this mode, the logging path is exercised without producing actual log output. This is a per-thread setting, so other threads will be able to log as normal.

Definition at line 192 of file Logger.cpp.

◆ log_warming_mode_enabled()

TOOLBOX_API bool toolbox::sys::log_warming_mode_enabled ( )
noexcept

Returns true if log warming mode is enabled.

Definition at line 197 of file Logger.cpp.

◆ null_logger()

TOOLBOX_API Logger & toolbox::sys::null_logger ( )
noexcept

Null logger. This logger does nothing and is effectively /dev/null.

Definition at line 202 of file Logger.cpp.

◆ std_logger()

TOOLBOX_API Logger & toolbox::sys::std_logger ( )
noexcept

Standard logger. This logger writes to stderr if the severity is Error or higher and stdout otherwise.

Definition at line 207 of file Logger.cpp.

◆ sys_logger()

TOOLBOX_API Logger & toolbox::sys::sys_logger ( )
noexcept

System logger. This logger calls syslog().

Definition at line 212 of file Logger.cpp.

◆ log_label()

TOOLBOX_API const char * toolbox::sys::log_label ( LogLevel  level)
noexcept

Return log label for given log level.

Definition at line 217 of file Logger.cpp.

◆ get_log_level()

TOOLBOX_API LogLevel toolbox::sys::get_log_level ( )
noexcept

Return current log level.

Definition at line 222 of file Logger.cpp.

◆ set_log_level()

TOOLBOX_API LogLevel toolbox::sys::set_log_level ( LogLevel  level)
noexcept

Set log level globally for all threads.

Definition at line 227 of file Logger.cpp.

◆ get_logger()

TOOLBOX_API Logger & toolbox::sys::get_logger ( )
noexcept

Return current logger.

Definition at line 232 of file Logger.cpp.

◆ set_logger() [1/2]

TOOLBOX_API Logger & toolbox::sys::set_logger ( Logger logger)
noexcept

Set logger globally for all threads.

Definition at line 237 of file Logger.cpp.

◆ write_log()

TOOLBOX_API void toolbox::sys::write_log ( WallTime  ts,
LogLevel  level,
LogMsgPtr &&  msg,
std::size_t  size 
)
noexcept

Unconditionally write log message to the logger. Specifically, this function does not check that level is allowed by the current log level; users are expected to call is_log_level() first, before formatting the log message.

Definition at line 242 of file Logger.cpp.

Referenced by toolbox::sys::Log::~Log().

◆ is_log_level()

bool toolbox::sys::is_log_level ( LogLevel  level)
inlinenoexcept

Return true if level is less than or equal to current log level.

Definition at line 85 of file Logger.hpp.

◆ set_logger() [2/2]

Logger & toolbox::sys::set_logger ( std::nullptr_t  )
inlinenoexcept

Definition at line 99 of file Logger.hpp.

◆ operator<<() [1/4]

template<typename StreamT >
requires Streamable<StreamT>
StreamT & toolbox::sys::operator<< ( StreamT os,
LogLevel  level 
)

Definition at line 224 of file Logger.hpp.

◆ open_pid_file()

TOOLBOX_API PidFile toolbox::sys::open_pid_file ( const char path,
mode_t  mode 
)

Create pidfile and obtain lock. An exception is thrown if the pidfile cannot be locked, because a daemon is already running. If the path argument is null, then /var/run/{progname}.pid is used as the pidfile location.

Definition at line 38 of file PidFile.cpp.

◆ close_pid_file()

TOOLBOX_API void toolbox::sys::close_pid_file ( PidFile pf)
noexcept

Close pidfile without removing it. This function should be used when forking daemon processes.

Definition at line 51 of file PidFile.cpp.

◆ write_pid_file()

TOOLBOX_API void toolbox::sys::write_pid_file ( PidFile pf)

Write process' PID into pidfile.

Definition at line 58 of file PidFile.cpp.

◆ sig_block_all()

TOOLBOX_API void toolbox::sys::sig_block_all ( )

Block all signals.

Definition at line 82 of file Signal.cpp.

Referenced by toolbox::sys::Runner< RunnableT >::operator=().

◆ parse_cpu_set()

TOOLBOX_API cpu_set_t toolbox::sys::parse_cpu_set ( std::string_view  s)
noexcept

Parse an isolcpus-style set of CPUs.

The CPU set is either a list: "<cpu>,...,<cpu>", or a range: "<cpu>-<cpu>", or a combination or both: "<cpu>,...,<cpu>-<cpu>", where "<cpu>" begins at 0 and the maximum value is "number of CPUs in system - 1". For example: "0,1,10-11,22-23".

Parameters
sAn isolcpus-style set of CPUs.
Returns
a copy of the CPU set.

Definition at line 35 of file Thread.cpp.

◆ parse_sched_policy()

TOOLBOX_API int toolbox::sys::parse_sched_policy ( std::string_view  s)

Parse scheduler policy name, where

Parameters
sis one of: other, fifo, rr, batch or idle.

Realtime scheduling policies are: fifo and rr.

Parameters
sThe policy name.
Returns
the policy.

Definition at line 51 of file Thread.cpp.

◆ set_thread_attrs()

TOOLBOX_API void toolbox::sys::set_thread_attrs ( const ThreadConfig config)

Set attributes for current thread from config.

Parameters
configThe configuration.

Definition at line 70 of file Thread.cpp.

Referenced by toolbox::sys::Runner< RunnableT >::operator=().

◆ get_time()

TOOLBOX_API NanoTime toolbox::sys::get_time ( clockid_t  clock_id)
noexcept

Definition at line 25 of file Time.cpp.

Referenced by toolbox::sys::MonoClock::now(), and toolbox::sys::WallClock::now().

◆ is_zero() [1/4]

template<typename RepT , typename PeriodT >
constexpr bool toolbox::sys::is_zero ( std::chrono::duration< RepT, PeriodT d)
constexprnoexcept

Definition at line 155 of file Time.hpp.

◆ is_zero() [2/4]

template<typename ClockT >
constexpr bool toolbox::sys::is_zero ( std::chrono::time_point< ClockT, Duration t)
constexprnoexcept

Definition at line 161 of file Time.hpp.

◆ time_since_epoch()

constexpr DurationT toolbox::sys::time_since_epoch ( std::chrono::time_point< ClockT, Duration t)
constexprnoexcept

Definition at line 167 of file Time.hpp.

◆ ms_since_epoch()

template<typename ClockT >
constexpr std::int64_t toolbox::sys::ms_since_epoch ( std::chrono::time_point< ClockT, Duration t)
constexprnoexcept

Definition at line 175 of file Time.hpp.

◆ us_since_epoch()

template<typename ClockT >
constexpr std::int64_t toolbox::sys::us_since_epoch ( std::chrono::time_point< ClockT, Duration t)
constexprnoexcept

Definition at line 182 of file Time.hpp.

◆ ns_since_epoch()

template<typename ClockT >
constexpr std::int64_t toolbox::sys::ns_since_epoch ( std::chrono::time_point< ClockT, Duration t)
constexprnoexcept

Definition at line 189 of file Time.hpp.

◆ to_time() [1/3]

constexpr auto toolbox::sys::to_time ( std::chrono::duration< RepT, PeriodT d)
constexprnoexcept

Definition at line 197 of file Time.hpp.

◆ to_time() [2/3]

template<typename ClockT >
constexpr auto toolbox::sys::to_time ( timeval  tv)
constexprnoexcept

Definition at line 204 of file Time.hpp.

◆ to_time() [3/3]

template<typename ClockT >
constexpr auto toolbox::sys::to_time ( timespec  ts)
constexprnoexcept

Definition at line 211 of file Time.hpp.

◆ to_timeval() [1/2]

template<typename RepT , typename PeriodT >
constexpr timeval toolbox::sys::to_timeval ( std::chrono::duration< RepT, PeriodT d)
constexprnoexcept

Definition at line 218 of file Time.hpp.

◆ to_timeval() [2/2]

template<typename ClockT >
constexpr timeval toolbox::sys::to_timeval ( std::chrono::time_point< ClockT, Duration t)
constexprnoexcept

Definition at line 226 of file Time.hpp.

◆ to_timespec() [1/2]

template<typename RepT , typename PeriodT >
constexpr timespec toolbox::sys::to_timespec ( std::chrono::duration< RepT, PeriodT d)
constexprnoexcept

Definition at line 233 of file Time.hpp.

Referenced by toolbox::sys::SigWait::operator()().

◆ to_timespec() [2/2]

template<typename ClockT >
constexpr timespec toolbox::sys::to_timespec ( std::chrono::time_point< ClockT, Duration t)
constexprnoexcept

Definition at line 241 of file Time.hpp.

◆ operator<<() [2/4]

template<typename StreamT >
requires Streamable<StreamT>
StreamT & toolbox::sys::operator<< ( StreamT os,
MonoTime  t 
)

Definition at line 249 of file Time.hpp.

◆ operator<<() [3/4]

template<typename StreamT >
requires Streamable<StreamT>
StreamT & toolbox::sys::operator<< ( StreamT os,
WallTime  t 
)

Definition at line 257 of file Time.hpp.

◆ put_time()

template<typename DurationT = Seconds>
auto toolbox::sys::put_time ( WallTime  t,
const char fmt 
)
noexcept

Definition at line 270 of file Time.hpp.

◆ operator<<() [4/4]

template<typename DurationT , typename StreamT >
requires Streamable<StreamT>
StreamT & toolbox::sys::operator<< ( StreamT os,
PutTime< DurationT pt 
)

Definition at line 277 of file Time.hpp.

◆ is_zero() [3/4]

constexpr bool toolbox::sys::is_zero ( timeval  tv)
constexprnoexcept

Definition at line 299 of file Time.hpp.

◆ clear() [1/2]

void toolbox::sys::clear ( timeval tv)
inlinenoexcept

Definition at line 304 of file Time.hpp.

◆ operator+() [1/2]

timeval toolbox::sys::operator+ ( timeval  lhs,
timeval  rhs 
)
inlinenoexcept

Definition at line 309 of file Time.hpp.

◆ operator-() [1/2]

timeval toolbox::sys::operator- ( timeval  lhs,
timeval  rhs 
)
inlinenoexcept

Definition at line 321 of file Time.hpp.

◆ is_zero() [4/4]

constexpr bool toolbox::sys::is_zero ( timespec  ts)
constexprnoexcept

Definition at line 333 of file Time.hpp.

◆ clear() [2/2]

void toolbox::sys::clear ( timespec ts)
inlinenoexcept

Definition at line 338 of file Time.hpp.

◆ operator+() [2/2]

timespec toolbox::sys::operator+ ( timespec  lhs,
timespec  rhs 
)
inlinenoexcept

Definition at line 343 of file Time.hpp.

◆ operator-() [2/2]

timespec toolbox::sys::operator- ( timespec  lhs,
timespec  rhs 
)
inlinenoexcept

Definition at line 355 of file Time.hpp.

◆ parse_nanos()

constexpr auto toolbox::sys::parse_nanos ( std::string_view  sv)
constexprnoexcept

Parse fractional nanoseconds.

Parameters
svString of decimal digits.
Returns
nanoseconds.

Definition at line 370 of file Time.hpp.

◆ parse_time_only()

constexpr std::optional< Nanos > toolbox::sys::parse_time_only ( std::string_view  sv)
constexprnoexcept

Time-only represented in UTC (Universal Time Coordinated, also known as "GMT") in either HH:MM:SS (whole seconds) or HH:MM:SS.sss (milliseconds) format, colons, and period required. This special-purpose field is paired with UTCDateOnly to form a proper UTCTimestamp for bandwidth-sensitive messages. Valid values: HH = 00-23, MM = 00-59, SS = 00-5960 (60 only if UTC leap second) (without milliseconds). HH = 00-23, MM = 00-59, SS = 00-5960 (60 only if UTC leap second), sss=000-999 (indicating milliseconds).

Definition at line 409 of file Time.hpp.

Variable Documentation

◆ LogBufPoolCapacity

constexpr std::size_t toolbox::sys::LogBufPoolCapacity = 64
inlineconstexpr

Definition at line 55 of file Logger.hpp.