Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
Time Utilities

A collection of utility functions for working with timestamps and time components. More...

Functions

const struct timespec time_shield::get_timespec_impl () noexcept
 Get the current timespec.
 
template<class T = int>
const T time_shield::ns_of_sec () noexcept
 Get the nanosecond part of the current second.
 
template<class T = int>
const T time_shield::us_of_sec () noexcept
 Get the microsecond part of the current second.
 
template<class T = int>
const T time_shield::ms_of_sec () noexcept
 Get the millisecond part of the current second.
 
const ts_t time_shield::ts () noexcept
 Get the current UTC timestamp in seconds.
 
const ts_t time_shield::timestamp () noexcept
 Get the current UTC timestamp in seconds.
 
const fts_t time_shield::fts () noexcept
 Get the current UTC timestamp in floating-point seconds.
 
const fts_t time_shield::ftimestamp () noexcept
 Get the current UTC timestamp in floating-point seconds.
 
const ts_ms_t time_shield::ts_ms () noexcept
 Get the current UTC timestamp in milliseconds.
 
const ts_ms_t time_shield::timestamp_ms () noexcept
 Get the current UTC timestamp in milliseconds.
 
const ts_ms_t time_shield::now () noexcept
 Get the current UTC timestamp in milliseconds.
 
const ts_us_t time_shield::ts_us () noexcept
 Get the current UTC timestamp in microseconds.
 
const ts_us_t time_shield::timestamp_us () noexcept
 Get the current UTC timestamp in microseconds.
 

Detailed Description

A collection of utility functions for working with timestamps and time components.

This module provides functions for obtaining the current timestamps in various formats (e.g., seconds, milliseconds, microseconds, floating-point seconds) and extracting sub-second components such as nanoseconds, microseconds, and milliseconds.

Key Features:

Usage Examples:

Function Documentation

◆ ftimestamp()

const fts_t time_shield::ftimestamp ( )
inlinenoexcept

Get the current UTC timestamp in floating-point seconds.

Returns
fts_t Current UTC timestamp in floating-point seconds.

Definition at line 107 of file time_utils.hpp.

◆ fts()

const fts_t time_shield::fts ( )
inlinenoexcept

Get the current UTC timestamp in floating-point seconds.

Returns
fts_t Current UTC timestamp in floating-point seconds.

Definition at line 100 of file time_utils.hpp.

◆ get_timespec_impl()

const struct timespec time_shield::get_timespec_impl ( )
inlinenoexcept

Get the current timespec.

Returns
struct timespec The current timespec.

Definition at line 46 of file time_utils.hpp.

◆ ms_of_sec()

template<class T = int>
const T time_shield::ms_of_sec ( )
noexcept

Get the millisecond part of the current second.

Template Parameters
TType of the returned value (default is int).
Returns
T Millisecond part of the current second.

Definition at line 79 of file time_utils.hpp.

◆ now()

const ts_ms_t time_shield::now ( )
inlinenoexcept

Get the current UTC timestamp in milliseconds.

Returns
ts_ms_t Current UTC timestamp in milliseconds.

Definition at line 128 of file time_utils.hpp.

◆ ns_of_sec()

template<class T = int>
const T time_shield::ns_of_sec ( )
inlinenoexcept

Get the nanosecond part of the current second.

Template Parameters
TType of the returned value (default is int).
Returns
T Nanosecond part of the current second.

Definition at line 61 of file time_utils.hpp.

◆ timestamp()

const ts_t time_shield::timestamp ( )
inlinenoexcept

Get the current UTC timestamp in seconds.

Returns
ts_t Current UTC timestamp in seconds.

Definition at line 93 of file time_utils.hpp.

◆ timestamp_ms()

const ts_ms_t time_shield::timestamp_ms ( )
inlinenoexcept

Get the current UTC timestamp in milliseconds.

Returns
ts_ms_t Current UTC timestamp in milliseconds.

Definition at line 121 of file time_utils.hpp.

◆ timestamp_us()

const ts_us_t time_shield::timestamp_us ( )
inlinenoexcept

Get the current UTC timestamp in microseconds.

Returns
ts_us_t Current UTC timestamp in microseconds.

Definition at line 142 of file time_utils.hpp.

◆ ts()

const ts_t time_shield::ts ( )
inlinenoexcept

Get the current UTC timestamp in seconds.

Returns
ts_t Current UTC timestamp in seconds.

Definition at line 86 of file time_utils.hpp.

◆ ts_ms()

const ts_ms_t time_shield::ts_ms ( )
inlinenoexcept

Get the current UTC timestamp in milliseconds.

Returns
ts_ms_t Current UTC timestamp in milliseconds.

Definition at line 114 of file time_utils.hpp.

◆ ts_us()

const ts_us_t time_shield::ts_us ( )
inlinenoexcept

Get the current UTC timestamp in microseconds.

Returns
ts_us_t Current UTC timestamp in microseconds.

Definition at line 135 of file time_utils.hpp.

◆ us_of_sec()

template<class T = int>
const T time_shield::us_of_sec ( )
noexcept

Get the microsecond part of the current second.

Template Parameters
TType of the returned value (default is int).
Returns
T Microsecond part of the current second.

Definition at line 70 of file time_utils.hpp.