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

A comprehensive set of functions and utilities for working with timestamps and time-related data. More...

Functions

template<class T = int>
constexpr const T time_shield::ns_of_sec (fts_t ts) noexcept
 Get the nanosecond part of the second from a floating-point timestamp.
 
template<class T = int>
constexpr const T time_shield::us_of_sec (fts_t ts) noexcept
 Get the microsecond part of the second from a floating-point timestamp.
 
template<class T = int>
constexpr const T time_shield::ms_of_sec (fts_t ts) noexcept
 Get the millisecond part of the second from a floating-point timestamp.
 
template<class T = int>
constexpr const T time_shield::ms_of_ts (ts_ms_t ts) noexcept
 Get the millisecond part of the timestamp.
 
template<class T >
constexpr const ts_ms_t time_shield::sec_to_ms_impl (T t, std::true_type) noexcept
 
template<class T >
constexpr const ts_ms_t time_shield::sec_to_ms_impl (T t, std::false_type) noexcept
 
template<class T1 = ts_ms_t, class T2 >
constexpr const T1 time_shield::sec_to_ms (T2 ts) noexcept
 Converts a timestamp from seconds to milliseconds.
 
constexpr const ts_ms_t time_shield::fsec_to_ms (fts_t ts) noexcept
 Converts a floating-point timestamp from seconds to milliseconds.
 
template<class T1 = ts_t, class T2 = ts_ms_t>
constexpr const T1 time_shield::ms_to_sec (T2 ts_ms) noexcept
 Converts a timestamp from milliseconds to seconds.
 
template<class T = ts_ms_t>
constexpr const fts_t time_shield::ms_to_fsec (T ts_ms) noexcept
 Converts a timestamp from milliseconds to floating-point seconds.
 
template<class T = year_t>
constexpr const T time_shield::get_unix_year (ts_t ts) noexcept
 Converts a UNIX timestamp to a year.
 
template<class T = year_t>
constexpr const T time_shield::unix_year (ts_t ts) noexcept
 Alias for get_unix_year function.
 
template<class T = year_t>
constexpr const T time_shield::to_unix_year (ts_t ts) noexcept
 Alias for get_unix_year function.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::hour24_to_12 (T hour) noexcept
 Converts a 24-hour format hour to a 12-hour format.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::h24_to_h12 (T hour) noexcept
 Alias for hour24_to_12 function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
 Converts a date and time to a timestamp.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
 Alias for to_timestamp function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::get_ts (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
 Alias for to_timestamp function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
 Alias for to_timestamp function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
 Alias for to_timestamp function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::get_timestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
 Alias for to_timestamp function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::tm_to_timestamp (const std::tm *timeinfo)
 Converts a std::tm structure to a timestamp.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts_from_tm (const std::tm *timeinfo)
 Alias for tm_to_timestamp function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::to_timestamp_ms (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T2 ms=0)
 Converts a date and time to a timestamp in milliseconds.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::to_ts_ms (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T2 ms=0)
 Alias for to_timestamp_ms function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::ts_ms (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T2 ms=0)
 Alias for to_timestamp_ms function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::timestamp_ms (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T2 ms=0)
 Alias for to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::tm_to_timestamp_ms (const std::tm *timeinfo)
 Converts a std::tm structure to a timestamp in milliseconds.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp_ms (const std::tm *timeinfo)
 Alias for tm_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts_ms (const std::tm *timeinfo)
 Alias for tm_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts_ms (const std::tm *timeinfo)
 Alias for tm_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp_ms (const std::tm *timeinfo)
 Alias for tm_to_timestamp_ms function.
 
template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_ftimestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Converts a date and time to a floating-point timestamp.
 
template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_fts (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Alias for to_ftimestamp function.
 
template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::fts (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Alias for to_ftimestamp function.
 
template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::ftimestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Alias for to_ftimestamp function.
 
TIME_SHIELD_CONSTEXPR const fts_t time_shield::tm_to_ftimestamp (const std::tm *timeinfo)
 Converts a std::tm structure to a floating-point timestamp.
 
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_ftimestamp (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp function.
 
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_fts (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp function.
 
TIME_SHIELD_CONSTEXPR const fts_t time_shield::fts (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp function.
 
TIME_SHIELD_CONSTEXPR const fts_t time_shield::ftimestamp (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp function.
 
template<class T = uday_t>
constexpr const T time_shield::get_unix_day (ts_t ts=ts()) noexcept
 Get UNIX day.
 
template<class T = uday_t>
constexpr const T time_shield::get_unixday (ts_t ts=ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr const T time_shield::unix_day (ts_t ts=ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr const T time_shield::unixday (ts_t ts=ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr const T time_shield::uday (ts_t ts=ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = int>
constexpr const T time_shield::get_days_difference (ts_t start, ts_t stop) noexcept
 Get the number of days between two timestamps.
 
template<class T = int>
constexpr const T time_shield::get_days (ts_t start, ts_t stop) noexcept
 Alias for get_days_difference function.
 
template<class T = int>
constexpr const T time_shield::days (ts_t start, ts_t stop) noexcept
 Alias for get_days_difference function.
 
template<class T = uday_t>
constexpr const T time_shield::get_unix_day_ms (ts_ms_t t_ms=ts_ms()) noexcept
 Get UNIX day from milliseconds timestamp.
 
template<class T = uday_t>
constexpr const T time_shield::get_unixday_ms (ts_ms_t t_ms=ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = uday_t>
constexpr const T time_shield::unix_day_ms (ts_ms_t t_ms=ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = uday_t>
constexpr const T time_shield::unixday_ms (ts_ms_t t_ms=ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = uday_t>
constexpr const T time_shield::uday_ms (ts_ms_t t_ms=ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = ts_t>
constexpr const T time_shield::unix_day_to_timestamp (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp in seconds.
 
template<class T = ts_t>
constexpr const T time_shield::unix_day_to_ts (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T time_shield::unixday_to_ts (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T time_shield::uday_to_ts (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T time_shield::start_of_day_from_unix_day (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T time_shield::unix_day_to_timestamp_ms (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp in milliseconds.
 
template<class T = ts_t>
constexpr const T time_shield::unix_day_to_ts_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T time_shield::unixday_to_ts_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T time_shield::uday_to_ts_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T time_shield::start_of_day_from_unix_day_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T time_shield::end_of_day_from_unix_day (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the end of the day in seconds.
 
template<class T = ts_ms_t>
constexpr const T time_shield::end_of_day_from_unix_day_ms (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the end of the day in milliseconds.
 
template<class T = ts_ms_t>
constexpr const T time_shield::start_of_next_day_from_unix_day (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the start of the next day in seconds.
 
template<class T = ts_ms_t>
constexpr const T time_shield::start_of_next_day_from_unix_day_ms (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.
 
template<class T = ts_t>
constexpr const T time_shield::next_day_from_unix_day (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_t>
constexpr const T time_shield::next_day_unix_day (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_t>
constexpr const T time_shield::next_day_unixday (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_ms_t>
constexpr const T time_shield::next_day_from_unix_day_ms (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = ts_ms_t>
constexpr const T time_shield::next_day_unix_day_ms (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = ts_ms_t>
constexpr const T time_shield::next_day_unixday_ms (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = int64_t>
constexpr const T time_shield::get_unix_min (ts_t ts=ts())
 Get UNIX minute.
 
template<class T = int64_t>
constexpr const T time_shield::unix_min (ts_t ts=ts())
 Alias for get_unix_min function.
 
template<class T = int64_t>
constexpr const T time_shield::to_unix_min (ts_t ts=ts())
 Alias for get_unix_min function.
 
template<class T = int64_t>
constexpr const T time_shield::umin (ts_t ts=ts())
 Alias for get_unix_min function.
 
template<class T = int>
constexpr const T time_shield::sec_of_day (ts_t ts=ts()) noexcept
 Get the second of the day.
 
template<class T = int>
constexpr const T time_shield::sec_of_day_ms (ts_ms_t ts_ms) noexcept
 Get the second of the day from milliseconds timestamp.
 
template<class T1 = int, class T2 = int>
constexpr const T1 time_shield::sec_of_day (T2 hour, T2 min, T2 sec) noexcept
 Get the second of the day.
 
template<class T = int>
constexpr const T time_shield::sec_of_min (ts_t ts=ts())
 Get the second of the minute.
 
template<class T = int>
constexpr const T time_shield::sec_of_hour (ts_t ts=ts())
 Get the second of the hour.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::get_year (ts_t ts=ts())
 Get the year from the timestamp.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::year (ts_t ts=ts())
 Alias for get_year function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::to_year (ts_t ts=ts())
 Alias for get_year function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::get_year_ms (ts_ms_t ts_ms=ts_ms())
 Get the year from the timestamp in milliseconds.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::year_ms (ts_ms_t ts_ms=ts_ms())
 Alias for get_year_ms function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::to_year_ms (ts_ms_t ts_ms=ts_ms())
 Alias for get_year_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::start_of_year (ts_t ts) noexcept
 Get the start of the year timestamp.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_start (ts_t ts=ts())
 Alias for start_of_year function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin (ts_t ts=ts())
 Alias for start_of_year function.
 
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::start_of_year_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the start of the year timestamp in milliseconds.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_start_ms (ts_t ts_ms=ts_ms())
 Alias for start_of_year_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin_ms (ts_t ts_ms=ts_ms())
 Alias for start_of_year_ms function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::start_of_year_date (T year)
 Get the timestamp of the start of the year.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_start_date (T year)
 Alias for start_of_year_date function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin_date (T year)
 Alias for start_of_year_date function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::start_of_year_date_ms (T year)
 Get the timestamp in milliseconds of the start of the year.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::year_start_date_ms (T year)
 Alias for start_of_year_date_ms function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::year_begin_date_ms (T year)
 Alias for start_of_year_date_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t time_shield::end_of_year (ts_t ts=ts())
 Get the end-of-year timestamp.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_end (ts_t ts=ts())
 Alias for end_of_year function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::end_of_year_ms (ts_ms_t ts_ms=ts_ms())
 Get the timestamp in milliseconds of the end of the year.
 
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::year_end_ms (ts_ms_t ts_ms=ts_ms())
 Alias for end_of_year_ms function.
 
template<class T = int>
const T time_shield::day_of_year (ts_t ts=ts())
 Get the day of the year.
 
template<class T = Month>
TIME_SHIELD_CONSTEXPR const T time_shield::month_of_year (ts_t ts) noexcept
 Get the month of the year.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::day_of_month (ts_t ts)
 Get the day of the month.
 
template<class T1 = int, class T2 = year_t, class T3 = int>
constexpr const T1 time_shield::num_days_in_month (T2 year, T3 month) noexcept
 Get the number of days in a month.
 
template<class T1 = int, class T2 = year_t, class T3 = int>
constexpr const T1 time_shield::days_in_month (T2 year, T3 month) noexcept
 Alias for num_days_in_month function.
 
template<class T1 = int>
TIME_SHIELD_CONSTEXPR const T1 time_shield::num_days_in_month_ts (ts_t ts=ts()) noexcept
 Get the number of days in the month of the given timestamp.
 
template<class T1 = int>
constexpr const T1 time_shield::num_days_in_month (ts_t ts=ts()) noexcept
 Alias for num_days_in_month_ts function.
 
template<class T1 = int>
constexpr const T1 time_shield::days_in_month (ts_t ts=ts()) noexcept
 Alias for num_days_in_month_ts function.
 
template<class T1 = int, class T2 = year_t>
constexpr const T1 time_shield::num_days_in_year (T2 year) noexcept
 Get the number of days in a given year.
 
template<class T1 = int, class T2 = year_t>
constexpr const T1 time_shield::days_in_year (T2 year) noexcept
 Alias for num_days_in_year function.
 
template<class T = int>
constexpr const T time_shield::num_days_in_year_ts (ts_t ts=ts())
 Get the number of days in the current year.
 
template<class T = int>
constexpr const T time_shield::days_in_year_ts (ts_t ts=ts())
 Alias for num_days_in_year_ts function.
 
constexpr const ts_t time_shield::start_of_day (ts_t ts=ts()) noexcept
 Get the start of the day timestamp.
 
constexpr const ts_t time_shield::day_start (ts_t ts=ts()) noexcept
 Alias for start_of_day function.
 
template<class T = int>
constexpr const ts_t time_shield::start_of_prev_day (ts_t ts=ts(), T days=1) noexcept
 Get timestamp of the start of the previous day.
 
template<class T = int>
constexpr const ts_t time_shield::previous_day_start (ts_t ts=ts(), T days=1) noexcept
 Alias for start_of_prev_day function.
 
constexpr const ts_t time_shield::start_of_day_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the start of the day timestamp in seconds.
 
constexpr const ts_t time_shield::day_start_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for start_of_day_sec function.
 
constexpr const ts_ms_t time_shield::start_of_day_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the start of the day timestamp in milliseconds.
 
constexpr const ts_ms_t time_shield::day_start_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for start_of_day_ms function.
 
template<class T = int>
constexpr const ts_t time_shield::start_of_next_day (ts_t ts, T days=1) noexcept
 Get the timestamp of the start of the day after a specified number of days.
 
template<class T = int>
constexpr const ts_t time_shield::next_day_start (ts_t ts, T days=1) noexcept
 Alias for start_of_next_day function.
 
template<class T = int>
constexpr const ts_ms_t time_shield::start_of_next_day_ms (ts_ms_t ts_ms, T days=1) noexcept
 Get the timestamp of the start of the day after a specified number of days.
 
template<class T = int>
constexpr const ts_ms_t time_shield::next_day_start_ms (ts_ms_t ts_ms, T days=1) noexcept
 Alias for start_of_next_day_ms function.
 
template<class T = int>
constexpr const ts_t time_shield::next_day (ts_t ts, T days=1) noexcept
 Calculate the timestamp for a specified number of days in the future.
 
template<class T = int>
constexpr const ts_ms_t time_shield::next_day_ms (ts_ms_t ts_ms, T days=1) noexcept
 Calculate the timestamp for a specified number of days in the future (milliseconds).
 
constexpr const ts_t time_shield::end_of_day (const ts_t &ts=ts()) noexcept
 Get the timestamp at the end of the day.
 
constexpr const ts_t time_shield::day_end (const ts_t &ts=ts()) noexcept
 Alias for end_of_day function.
 
constexpr const ts_t time_shield::end_of_day_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the timestamp at the end of the day in seconds.
 
constexpr const ts_t time_shield::day_end_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for end_of_day_sec function.
 
constexpr const ts_ms_t time_shield::end_of_day_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the timestamp at the end of the day in milliseconds.
 
constexpr const ts_ms_t time_shield::day_end_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for end_of_day_ms function.
 
template<class T1 = Weekday, class T2 = year_t, class T3 = int>
constexpr const T1 time_shield::day_of_week_date (T2 year, T3 month, T3 day)
 Get the day of the week.
 
template<class T1 = Weekday, class T2 = year_t, class T3 = int>
constexpr const T1 time_shield::get_weekday (T2 year, T3 month, T3 day)
 Alias for day_of_week_date function.
 
template<class T1 = Weekday, class T2 = year_t, class T3 = int>
constexpr const T1 time_shield::day_of_week (T2 year, T3 month, T3 day)
 Alias for day_of_week_date function.
 
template<class T = Weekday>
constexpr const T time_shield::get_weekday_from_ts (ts_t ts) noexcept
 Get the weekday from a timestamp.
 
template<class T = Weekday>
constexpr const T time_shield::day_of_week (ts_t ts) noexcept
 Alias for get_weekday_from_ts function.
 
template<class T = Weekday>
constexpr const T time_shield::get_weekday_from_ts_ms (ts_ms_t ts_ms)
 Get the weekday from a timestamp in milliseconds.
 
template<class T = Weekday>
constexpr const T time_shield::day_of_week_ms (const ts_ms_t &ts_ms)
 Alias for get_weekday_from_ts_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::start_of_month (ts_t ts=ts())
 Get the timestamp at the start of the current month.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::month_begin (ts_t ts=ts())
 Alias for start_of_month function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::end_of_month (ts_t ts=ts())
 Get the last timestamp of the current month.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::last_day_of_month (ts_t ts=ts())
 Alias for end_of_month function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::last_sunday_of_month (ts_t ts=ts())
 Get the timestamp of the last Sunday of the current month.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::final_sunday_of_month (ts_t ts=ts())
 Alias for last_sunday_of_month function.
 
template<class T1 = int, class T2 = year_t, class T3 = int>
TIME_SHIELD_CONSTEXPR const T1 time_shield::last_sunday_month_day (T2 year, T3 month)
 Get the day of the last Sunday of the given month and year.
 
template<class T1 = int, class T2 = year_t, class T3 = int>
TIME_SHIELD_CONSTEXPR const T1 time_shield::final_sunday_month_day (T2 year, T3 month)
 Alias for last_sunday_month_day function.
 
constexpr const ts_t time_shield::start_of_hour (ts_t ts=ts()) noexcept
 Get the timestamp at the start of the hour.
 
constexpr const ts_t time_shield::hour_begin (ts_t ts=ts()) noexcept
 Alias for start_of_hour function.
 
constexpr const ts_t time_shield::start_of_hour_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the timestamp at the start of the hour.
 
constexpr const ts_t time_shield::hour_begin_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for start_of_hour_sec function.
 
constexpr const ts_ms_t time_shield::start_of_hour_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the timestamp at the start of the hour. This function sets the minute and second to zero.
 
constexpr const ts_ms_t time_shield::hour_begin_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for start_of_hour_ms function.
 
constexpr const ts_t time_shield::end_of_hour (ts_t ts=ts()) noexcept
 Get the timestamp at the end of the hour. This function sets the minute and second to 59.
 
constexpr const ts_t time_shield::finish_of_hour (ts_t ts=ts()) noexcept
 Alias for end_of_hour function.
 
constexpr const ts_t time_shield::end_of_hour_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the timestamp at the end of the hour.
 
constexpr const ts_t time_shield::finish_of_hour_sec (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for end_of_hour_sec function.
 
constexpr const ts_ms_t time_shield::end_of_hour_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Get the timestamp at the end of the hour.
 
constexpr const ts_ms_t time_shield::finish_of_hour_ms (ts_ms_t ts_ms=ts_ms()) noexcept
 Alias for end_of_hour_ms function.
 
template<class T = int>
constexpr const T time_shield::hour_of_day (ts_t ts=ts()) noexcept
 Get the hour of the day.
 
template<class T = int>
constexpr const T time_shield::hour_in_day (ts_t ts=ts()) noexcept
 Alias for hour_of_day function.
 
constexpr const ts_t time_shield::start_of_week (ts_t ts=ts())
 Get the timestamp of the beginning of the week.
 
constexpr const ts_t time_shield::week_begin (ts_t ts=ts())
 Alias for start_of_week function.
 
constexpr const ts_t time_shield::end_of_week (ts_t ts=ts())
 Get the timestamp of the end of the week.
 
constexpr const ts_t time_shield::finish_of_week (ts_t ts=ts())
 Alias for end_of_week function.
 
constexpr const ts_t time_shield::start_of_saturday (ts_t ts=ts())
 Get the timestamp of the start of Saturday.
 
constexpr const ts_t time_shield::saturday_begin (ts_t ts=ts())
 Alias for start_of_saturday function.
 
constexpr const ts_t time_shield::start_of_min (ts_t ts=ts()) noexcept
 Get the timestamp of the beginning of the minute.
 
constexpr const ts_t time_shield::min_begin (ts_t ts=ts()) noexcept
 Alias for start_of_min function.
 
constexpr const ts_t time_shield::end_of_min (ts_t ts=ts()) noexcept
 Get the timestamp of the end of the minute.
 
constexpr const ts_t time_shield::finish_of_min (ts_t ts=ts()) noexcept
 Alias for end_of_min function.
 
template<class T = int>
constexpr const T time_shield::min_of_day (ts_t ts=ts()) noexcept
 Get minute of day. This function returns a value between 0 to 1439 (minute of day).
 
template<class T = int>
constexpr const T time_shield::min_of_hour (ts_t ts=ts()) noexcept
 Get minute of hour. This function returns a value between 0 to 59.
 
template<class T = int>
constexpr const ts_t time_shield::start_of_period (T p, ts_t ts=ts())
 Get the timestamp of the start of the period.
 
template<class T = int>
constexpr const ts_t time_shield::end_of_period (T p, ts_t ts=ts())
 Get the timestamp of the end of the period.
 
template<class T = TimeZoneStruct>
const TimeZoneStruct time_shield::to_time_zone (tz_t offset)
 Converts an integer to a time zone structure.
 
const TimeZoneStruct time_shield::to_time_zone_struct (tz_t offset)
 Converts an integer to a TimeZoneStruct.
 
const TimeZoneStruct time_shield::to_tz (tz_t offset)
 Alias for to_time_zone_struct function.
 
const tz_t time_shield::time_zone_struct_to_offset (const TimeZoneStruct &tz)
 Converts a TimeZoneStruct to a single integer representation.
 
const tz_t time_shield::tz_to_offset (const TimeZoneStruct &tz)
 Alias for time_zone_struct_to_offset function.
 
const tz_t time_shield::to_offset (const TimeZoneStruct &tz)
 Alias for time_zone_struct_to_offset function.
 

Detailed Description

A comprehensive set of functions and utilities for working with timestamps and time-related data.

This module provides functionalities to convert, manipulate, and analyze timestamps in seconds, milliseconds, and floating-point formats. It also includes utilities for working with date-time structures, UNIX days, and various time units (hours, minutes, seconds, etc.).

Key Features:

Usage Examples:

Function Documentation

◆ day_end()

const ts_t time_shield::day_end ( const ts_t & ts = ts())
constexprnoexcept

Alias for end_of_day function.

Get the timestamp at the end of the day.

This function sets the hour to 23, minute to 59, and second to 59.

Parameters
tsTimestamp.
Returns
Timestamp at the end of the day.

Definition at line 2016 of file time_conversions.hpp.

◆ day_end_ms()

const ts_ms_t time_shield::day_end_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for end_of_day_ms function.

Get the timestamp at the end of the day in milliseconds.

This function sets the hour to 23, minute to 59, second to 59, and millisecond to 999.

Parameters
ts_msTimestamp in milliseconds.
Returns
Timestamp at the end of the day in milliseconds.

Definition at line 2052 of file time_conversions.hpp.

◆ day_end_sec()

const ts_t time_shield::day_end_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for end_of_day_sec function.

Get the timestamp at the end of the day in seconds.

This function sets the hour to 23, minute to 59, and second to 59.

Parameters
ts_msTimestamp in milliseconds.
Returns
Timestamp at the end of the day in seconds.

Definition at line 2034 of file time_conversions.hpp.

◆ day_of_month()

template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::day_of_month ( ts_t ts)
inline

Get the day of the month.

This function returns the day of the month for the specified timestamp.

Parameters
tsTimestamp.
Returns
Day of the month.

Definition at line 1727 of file time_conversions.hpp.

◆ day_of_week() [1/2]

template<class T1 = Weekday, class T2 = year_t, class T3 = int>
const T1 time_shield::day_of_week ( T2 year,
T3 month,
T3 day )
constexpr

Alias for day_of_week_date function.

Get the day of the week.

Parameters
yearYear.
monthMonth of the year.
dayDay of the month.
Returns
Day of the week (SUN = 0, MON = 1, ... SAT = 6).

Definition at line 2083 of file time_conversions.hpp.

◆ day_of_week() [2/2]

template<class T = Weekday>
const T time_shield::day_of_week ( ts_t ts)
constexprnoexcept

Alias for get_weekday_from_ts function.

Get the weekday from a timestamp.

Parameters
tsTimestamp.
Returns
Weekday (SUN = 0, MON = 1, ... SAT = 6).

Definition at line 2131 of file time_conversions.hpp.

◆ day_of_week_date()

template<class T1 = Weekday, class T2 = year_t, class T3 = int>
const T1 time_shield::day_of_week_date ( T2 year,
T3 month,
T3 day )
constexpr

Get the day of the week.

Parameters
yearYear.
monthMonth of the year.
dayDay of the month.
Returns
Day of the week (SUN = 0, MON = 1, ... SAT = 6).

Definition at line 2064 of file time_conversions.hpp.

◆ day_of_week_ms()

template<class T = Weekday>
const T time_shield::day_of_week_ms ( const ts_ms_t & ts_ms)
constexpr

Alias for get_weekday_from_ts_ms function.

Get the weekday from a timestamp in milliseconds.

Parameters
ts_msTimestamp in milliseconds.
Returns
Weekday (SUN = 0, MON = 1, ... SAT = 6).

Definition at line 2148 of file time_conversions.hpp.

◆ day_of_year()

template<class T = int>
const T time_shield::day_of_year ( ts_t ts = ts())
inline

Get the day of the year.

This function returns the day of the year for the specified timestamp.

Parameters
tsTimestamp.
Returns
Day of the year.

Definition at line 1684 of file time_conversions.hpp.

◆ day_start()

const ts_t time_shield::day_start ( ts_t ts = ts())
constexprnoexcept

Alias for start_of_day function.

Get the start of the day timestamp.

This function returns the timestamp at the start of the day. The function sets the hours, minutes, and seconds to zero.

Parameters
tsTimestamp.
Returns
Start of the day timestamp.

Definition at line 1869 of file time_conversions.hpp.

◆ day_start_ms()

const ts_ms_t time_shield::day_start_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for start_of_day_ms function.

Get the start of the day timestamp in milliseconds.

This function returns the timestamp at the start of the day in milliseconds. The function sets the hours, minutes, seconds, and milliseconds to zero.

Parameters
ts_msTimestamp in milliseconds.
Returns
Start of the day timestamp in milliseconds.

Definition at line 1928 of file time_conversions.hpp.

◆ day_start_sec()

const ts_t time_shield::day_start_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for start_of_day_sec function.

Get the start of the day timestamp in seconds.

This function returns the timestamp at the start of the day in seconds. The function sets the hours, minutes, and seconds to zero.

Parameters
ts_msTimestamp in milliseconds.
Returns
Start of the day timestamp in seconds.

Definition at line 1909 of file time_conversions.hpp.

◆ days()

template<class T = int>
const T time_shield::days ( ts_t start,
ts_t stop )
constexprnoexcept

Alias for get_days_difference function.

Get the number of days between two timestamps.

This function calculates the number of days between two timestamps.

Template Parameters
TThe type of the return value, defaults to int.
Parameters
startThe timestamp of the start of the period.
stopThe timestamp of the end of the period.
Returns
The number of days between start and stop.

Definition at line 1028 of file time_conversions.hpp.

◆ days_in_month() [1/2]

template<class T1 = int, class T2 = year_t, class T3 = int>
const T1 time_shield::days_in_month ( T2 year,
T3 month )
constexprnoexcept

Alias for num_days_in_month function.

Get the number of days in a month.

This function calculates and returns the number of days in the specified month and year.

Parameters
yearYear as an integer.
monthMonth as an integer.
Returns
The number of days in the given month and year.

Definition at line 1776 of file time_conversions.hpp.

◆ days_in_month() [2/2]

template<class T1 = int>
const T1 time_shield::days_in_month ( ts_t ts = ts())
constexprnoexcept

Alias for num_days_in_month_ts function.

Get the number of days in the month of the given timestamp.

This function calculates and returns the number of days in the month of the specified timestamp.

Parameters
tsThe timestamp to extract month and year from.
Returns
The number of days in the month of the given timestamp.

Definition at line 1808 of file time_conversions.hpp.

◆ days_in_year()

template<class T1 = int, class T2 = year_t>
const T1 time_shield::days_in_year ( T2 year)
constexprnoexcept

Alias for num_days_in_year function.

Get the number of days in a given year.

This function calculates and returns the number of days in the specified year.

Parameters
yearYear.
Returns
Number of days in the given year.

Definition at line 1829 of file time_conversions.hpp.

◆ days_in_year_ts()

template<class T = int>
const T time_shield::days_in_year_ts ( ts_t ts = ts())
constexpr

Alias for num_days_in_year_ts function.

Get the number of days in the current year.

This function calculates and returns the number of days in the current year based on the provided timestamp.

Parameters
tsTimestamp.
Returns
Number of days in the current year.

Definition at line 1850 of file time_conversions.hpp.

◆ end_of_day()

const ts_t time_shield::end_of_day ( const ts_t & ts = ts())
constexprnoexcept

Get the timestamp at the end of the day.

This function sets the hour to 23, minute to 59, and second to 59.

Parameters
tsTimestamp.
Returns
Timestamp at the end of the day.

Definition at line 2010 of file time_conversions.hpp.

◆ end_of_day_from_unix_day()

template<class T = ts_t>
const T time_shield::end_of_day_from_unix_day ( uday_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the end of the day in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the end of the specified day (23:59:59).

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in seconds representing the end of the specified UNIX day.

Definition at line 1169 of file time_conversions.hpp.

◆ end_of_day_from_unix_day_ms()

template<class T = ts_ms_t>
const T time_shield::end_of_day_from_unix_day_ms ( uday_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the end of the day in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the end of the specified day (23:59:59.999).

Template Parameters
TThe return type of the function (default is ts_ms_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the end of the specified UNIX day.

Definition at line 1182 of file time_conversions.hpp.

◆ end_of_day_ms()

const ts_ms_t time_shield::end_of_day_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the timestamp at the end of the day in milliseconds.

This function sets the hour to 23, minute to 59, second to 59, and millisecond to 999.

Parameters
ts_msTimestamp in milliseconds.
Returns
Timestamp at the end of the day in milliseconds.

Definition at line 2046 of file time_conversions.hpp.

◆ end_of_day_sec()

const ts_t time_shield::end_of_day_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the timestamp at the end of the day in seconds.

This function sets the hour to 23, minute to 59, and second to 59.

Parameters
ts_msTimestamp in milliseconds.
Returns
Timestamp at the end of the day in seconds.

Definition at line 2028 of file time_conversions.hpp.

◆ end_of_hour()

const ts_t time_shield::end_of_hour ( ts_t ts = ts())
constexprnoexcept

Get the timestamp at the end of the hour. This function sets the minute and second to 59.

Parameters
tsTimestamp (default: current timestamp).
Returns
Timestamp at the end of the hour.

Definition at line 2289 of file time_conversions.hpp.

◆ end_of_hour_ms()

const ts_ms_t time_shield::end_of_hour_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the timestamp at the end of the hour.

This function sets the minute and second to 59.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the end of the hour in milliseconds.

Definition at line 2325 of file time_conversions.hpp.

◆ end_of_hour_sec()

const ts_t time_shield::end_of_hour_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the timestamp at the end of the hour.

This function sets the minute and second to 59.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the end of the hour in seconds.

Definition at line 2307 of file time_conversions.hpp.

◆ end_of_min()

const ts_t time_shield::end_of_min ( ts_t ts = ts())
constexprnoexcept

Get the timestamp of the end of the minute.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the end of the minute.

Definition at line 2432 of file time_conversions.hpp.

◆ end_of_month()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::end_of_month ( ts_t ts = ts())
inline

Get the last timestamp of the current month.

This function returns the last timestamp of the current month, setting the day to the last day of the month and the time to 23:59:59.

Parameters
tsTimestamp (default is current timestamp)
Returns
Last timestamp of the current month

Definition at line 2180 of file time_conversions.hpp.

◆ end_of_period()

template<class T = int>
const ts_t time_shield::end_of_period ( T p,
ts_t ts = ts() )
constexpr

Get the timestamp of the end of the period.

Parameters
pPeriod duration in seconds.
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the end of the period.

Definition at line 2482 of file time_conversions.hpp.

◆ end_of_week()

const ts_t time_shield::end_of_week ( ts_t ts = ts())
constexpr

Get the timestamp of the end of the week.

This function finds the timestamp of the end of the week, which corresponds to the end of Saturday.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the end of the week.

Definition at line 2383 of file time_conversions.hpp.

◆ end_of_year()

TIME_SHIELD_CONSTEXPR ts_t time_shield::end_of_year ( ts_t ts = ts())
inline

Get the end-of-year timestamp.

This function finds the last timestamp of the current year.

Parameters
tsTimestamp.
Returns
End-of-year timestamp.

Definition at line 1591 of file time_conversions.hpp.

◆ end_of_year_ms()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::end_of_year_ms ( ts_ms_t ts_ms = ts_ms())
inline

Get the timestamp in milliseconds of the end of the year.

This function finds the last timestamp of the current year in milliseconds.

Parameters
ts_msTimestamp in milliseconds.
Returns
End-of-year timestamp in milliseconds.

Definition at line 1665 of file time_conversions.hpp.

◆ final_sunday_month_day()

template<class T1 = int, class T2 = year_t, class T3 = int>
TIME_SHIELD_CONSTEXPR const T1 time_shield::final_sunday_month_day ( T2 year,
T3 month )
inline

Alias for last_sunday_month_day function.

Get the day of the last Sunday of the given month and year.

This function returns the day of the last Sunday of the specified month and year.

Parameters
yearYear
monthMonth (1 = January, 12 = December)
Returns
Day of the last Sunday of the given month and year

Definition at line 2227 of file time_conversions.hpp.

◆ final_sunday_of_month()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::final_sunday_of_month ( ts_t ts = ts())
inline

Alias for last_sunday_of_month function.

Get the timestamp of the last Sunday of the current month.

This function returns the timestamp of the last Sunday of the current month, setting the day to the last Sunday and the time to 00:00:00.

Parameters
tsTimestamp (default is current timestamp)
Returns
Timestamp of the last Sunday of the current month

Definition at line 2205 of file time_conversions.hpp.

◆ finish_of_hour()

const ts_t time_shield::finish_of_hour ( ts_t ts = ts())
constexprnoexcept

Alias for end_of_hour function.

Get the timestamp at the end of the hour. This function sets the minute and second to 59.

Parameters
tsTimestamp (default: current timestamp).
Returns
Timestamp at the end of the hour.

Definition at line 2295 of file time_conversions.hpp.

◆ finish_of_hour_ms()

const ts_ms_t time_shield::finish_of_hour_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for end_of_hour_ms function.

Get the timestamp at the end of the hour.

This function sets the minute and second to 59.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the end of the hour in milliseconds.

Definition at line 2331 of file time_conversions.hpp.

◆ finish_of_hour_sec()

const ts_t time_shield::finish_of_hour_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for end_of_hour_sec function.

Get the timestamp at the end of the hour.

This function sets the minute and second to 59.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the end of the hour in seconds.

Definition at line 2313 of file time_conversions.hpp.

◆ finish_of_min()

const ts_t time_shield::finish_of_min ( ts_t ts = ts())
constexprnoexcept

Alias for end_of_min function.

Get the timestamp of the end of the minute.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the end of the minute.

Definition at line 2438 of file time_conversions.hpp.

◆ finish_of_week()

const ts_t time_shield::finish_of_week ( ts_t ts = ts())
constexpr

Alias for end_of_week function.

Get the timestamp of the end of the week.

This function finds the timestamp of the end of the week, which corresponds to the end of Saturday.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the end of the week.

Definition at line 2389 of file time_conversions.hpp.

◆ fsec_to_ms()

const ts_ms_t time_shield::fsec_to_ms ( fts_t ts)
constexprnoexcept

Converts a floating-point timestamp from seconds to milliseconds.

Parameters
tsTimestamp in floating-point seconds.
Returns
ts_ms_t Timestamp in milliseconds.

Definition at line 127 of file time_conversions.hpp.

◆ ftimestamp() [1/2]

TIME_SHIELD_CONSTEXPR const fts_t time_shield::ftimestamp ( const std::tm * timeinfo)
inline

Alias for tm_to_ftimestamp function.

Converts a std::tm structure to a floating-point timestamp.

This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to the std::tm structure containing the date and time.
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 952 of file time_conversions.hpp.

◆ ftimestamp() [2/2]

template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::ftimestamp ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T3 ms = 0 )
inline

Alias for to_ftimestamp function.

Converts a date and time to a floating-point timestamp.

This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is year_t).
T2The type of the month, day, hour, minute, and second parameters (default is int).
T3The type of the millisecond parameter (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 846 of file time_conversions.hpp.

◆ fts() [1/2]

TIME_SHIELD_CONSTEXPR const fts_t time_shield::fts ( const std::tm * timeinfo)
inline

Alias for tm_to_ftimestamp function.

Converts a std::tm structure to a floating-point timestamp.

This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to the std::tm structure containing the date and time.
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 945 of file time_conversions.hpp.

◆ fts() [2/2]

template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::fts ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T3 ms = 0 )
inline

Alias for to_ftimestamp function.

Converts a date and time to a floating-point timestamp.

This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is year_t).
T2The type of the month, day, hour, minute, and second parameters (default is int).
T3The type of the millisecond parameter (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 832 of file time_conversions.hpp.

◆ get_days()

template<class T = int>
const T time_shield::get_days ( ts_t start,
ts_t stop )
constexprnoexcept

Alias for get_days_difference function.

Get the number of days between two timestamps.

This function calculates the number of days between two timestamps.

Template Parameters
TThe type of the return value, defaults to int.
Parameters
startThe timestamp of the start of the period.
stopThe timestamp of the end of the period.
Returns
The number of days between start and stop.

Definition at line 1021 of file time_conversions.hpp.

◆ get_days_difference()

template<class T = int>
const T time_shield::get_days_difference ( ts_t start,
ts_t stop )
constexprnoexcept

Get the number of days between two timestamps.

This function calculates the number of days between two timestamps.

Template Parameters
TThe type of the return value, defaults to int.
Parameters
startThe timestamp of the start of the period.
stopThe timestamp of the end of the period.
Returns
The number of days between start and stop.

Definition at line 1014 of file time_conversions.hpp.

◆ get_timestamp()

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::get_timestamp ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0 )
inline

Alias for to_timestamp function.

Converts a date and time to a timestamp.

This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 488 of file time_conversions.hpp.

◆ get_ts()

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::get_ts ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0 )
inline

Alias for to_timestamp function.

Converts a date and time to a timestamp.

This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 449 of file time_conversions.hpp.

◆ get_unix_day()

template<class T = uday_t>
const T time_shield::get_unix_day ( ts_t ts = ts())
constexprnoexcept

Get UNIX day.

This function returns the number of days elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of days since the UNIX epoch.

Definition at line 967 of file time_conversions.hpp.

◆ get_unix_day_ms()

template<class T = uday_t>
const T time_shield::get_unix_day_ms ( ts_ms_t t_ms = ts_ms())
constexprnoexcept

Get UNIX day from milliseconds timestamp.

This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
t_msTimestamp in milliseconds (default is current timestamp in milliseconds).
Returns
Number of days since the UNIX epoch.

Definition at line 1042 of file time_conversions.hpp.

◆ get_unix_min()

template<class T = int64_t>
const T time_shield::get_unix_min ( ts_t ts = ts())
constexpr

Get UNIX minute.

This function returns the number of minutes elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is int64_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of minutes since the UNIX epoch.

Definition at line 1264 of file time_conversions.hpp.

◆ get_unix_year()

template<class T = year_t>
const T time_shield::get_unix_year ( ts_t ts)
constexprnoexcept

Converts a UNIX timestamp to a year.

Template Parameters
TThe type of the year (default is year_t).
Parameters
tsUNIX timestamp.
Returns
T Year corresponding to the given timestamp.

Definition at line 157 of file time_conversions.hpp.

◆ get_unixday()

template<class T = uday_t>
const T time_shield::get_unixday ( ts_t ts = ts())
constexprnoexcept

Alias for get_unix_day function.

Get UNIX day.

This function returns the number of days elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of days since the UNIX epoch.

Definition at line 974 of file time_conversions.hpp.

◆ get_unixday_ms()

template<class T = uday_t>
const T time_shield::get_unixday_ms ( ts_ms_t t_ms = ts_ms())
constexprnoexcept

Alias for get_unix_day_ms function.

Get UNIX day from milliseconds timestamp.

This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
t_msTimestamp in milliseconds (default is current timestamp in milliseconds).
Returns
Number of days since the UNIX epoch.

Definition at line 1049 of file time_conversions.hpp.

◆ get_weekday()

template<class T1 = Weekday, class T2 = year_t, class T3 = int>
const T1 time_shield::get_weekday ( T2 year,
T3 month,
T3 day )
constexpr

Alias for day_of_week_date function.

Get the day of the week.

Parameters
yearYear.
monthMonth of the year.
dayDay of the month.
Returns
Day of the week (SUN = 0, MON = 1, ... SAT = 6).

Definition at line 2076 of file time_conversions.hpp.

◆ get_weekday_from_ts()

template<class T = Weekday>
const T time_shield::get_weekday_from_ts ( ts_t ts)
constexprnoexcept

Get the weekday from a timestamp.

Parameters
tsTimestamp.
Returns
Weekday (SUN = 0, MON = 1, ... SAT = 6).

Definition at line 2124 of file time_conversions.hpp.

◆ get_weekday_from_ts_ms()

template<class T = Weekday>
const T time_shield::get_weekday_from_ts_ms ( ts_ms_t ts_ms)
constexpr

Get the weekday from a timestamp in milliseconds.

Parameters
ts_msTimestamp in milliseconds.
Returns
Weekday (SUN = 0, MON = 1, ... SAT = 6).

Definition at line 2141 of file time_conversions.hpp.

◆ get_year()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::get_year ( ts_t ts = ts())
inline

Get the year from the timestamp.

This function returns the year of the specified timestamp in seconds since the Unix epoch.

Template Parameters
TThe return type of the function (default is year_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Year of the specified timestamp.

Definition at line 1367 of file time_conversions.hpp.

◆ get_year_ms()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::get_year_ms ( ts_ms_t ts_ms = ts_ms())
inline

Get the year from the timestamp in milliseconds.

This function returns the year of the specified timestamp in milliseconds since the Unix epoch.

Template Parameters
TThe return type of the function (default is year_t).
Parameters
ts_msTimestamp in milliseconds (default is current timestamp).
Returns
Year of the specified timestamp.

Definition at line 1395 of file time_conversions.hpp.

◆ h24_to_h12()

template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::h24_to_h12 ( T hour)
inlinenoexcept

Alias for hour24_to_12 function.

Converts a 24-hour format hour to a 12-hour format.

Template Parameters
TNumeric type of the hour (default is int).
Parameters
hourThe hour in 24-hour format to convert.
Returns
The hour in 12-hour format.

Definition at line 216 of file time_conversions.hpp.

◆ hour24_to_12()

template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::hour24_to_12 ( T hour)
inlinenoexcept

Converts a 24-hour format hour to a 12-hour format.

Template Parameters
TNumeric type of the hour (default is int).
Parameters
hourThe hour in 24-hour format to convert.
Returns
The hour in 12-hour format.

Definition at line 208 of file time_conversions.hpp.

◆ hour_begin()

const ts_t time_shield::hour_begin ( ts_t ts = ts())
constexprnoexcept

Alias for start_of_hour function.

Get the timestamp at the start of the hour.

This function sets the minute and second to zero.

Parameters
tsTimestamp (default: current timestamp).
Returns
Timestamp at the start of the hour.

Definition at line 2245 of file time_conversions.hpp.

◆ hour_begin_ms()

const ts_ms_t time_shield::hour_begin_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for start_of_hour_ms function.

Get the timestamp at the start of the hour. This function sets the minute and second to zero.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the start of the hour in milliseconds.

Definition at line 2279 of file time_conversions.hpp.

◆ hour_begin_sec()

const ts_t time_shield::hour_begin_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Alias for start_of_hour_sec function.

Get the timestamp at the start of the hour.

This function sets the minute and second to zero.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the start of the hour in seconds.

Definition at line 2263 of file time_conversions.hpp.

◆ hour_in_day()

template<class T = int>
const T time_shield::hour_in_day ( ts_t ts = ts())
constexprnoexcept

Alias for hour_of_day function.

Get the hour of the day.

This function returns a value between 0 to 23 representing the hour of the day.

Parameters
tsTimestamp (default: current timestamp).
Returns
Hour of the day.

Definition at line 2351 of file time_conversions.hpp.

◆ hour_of_day()

template<class T = int>
const T time_shield::hour_of_day ( ts_t ts = ts())
constexprnoexcept

Get the hour of the day.

This function returns a value between 0 to 23 representing the hour of the day.

Parameters
tsTimestamp (default: current timestamp).
Returns
Hour of the day.

Definition at line 2344 of file time_conversions.hpp.

◆ last_day_of_month()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::last_day_of_month ( ts_t ts = ts())
inline

Alias for end_of_month function.

Get the last timestamp of the current month.

This function returns the last timestamp of the current month, setting the day to the last day of the month and the time to 23:59:59.

Parameters
tsTimestamp (default is current timestamp)
Returns
Last timestamp of the current month

Definition at line 2186 of file time_conversions.hpp.

◆ last_sunday_month_day()

template<class T1 = int, class T2 = year_t, class T3 = int>
TIME_SHIELD_CONSTEXPR const T1 time_shield::last_sunday_month_day ( T2 year,
T3 month )
inline

Get the day of the last Sunday of the given month and year.

This function returns the day of the last Sunday of the specified month and year.

Parameters
yearYear
monthMonth (1 = January, 12 = December)
Returns
Day of the last Sunday of the given month and year

Definition at line 2219 of file time_conversions.hpp.

◆ last_sunday_of_month()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::last_sunday_of_month ( ts_t ts = ts())
inline

Get the timestamp of the last Sunday of the current month.

This function returns the timestamp of the last Sunday of the current month, setting the day to the last Sunday and the time to 00:00:00.

Parameters
tsTimestamp (default is current timestamp)
Returns
Timestamp of the last Sunday of the current month

Definition at line 2199 of file time_conversions.hpp.

◆ min_begin()

const ts_t time_shield::min_begin ( ts_t ts = ts())
constexprnoexcept

Alias for start_of_min function.

Get the timestamp of the beginning of the minute.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the beginning of the minute.

Definition at line 2423 of file time_conversions.hpp.

◆ min_of_day()

template<class T = int>
const T time_shield::min_of_day ( ts_t ts = ts())
constexprnoexcept

Get minute of day. This function returns a value between 0 to 1439 (minute of day).

Parameters
tsTimestamp in seconds (default: current timestamp).
Returns
Minute of day.

Definition at line 2449 of file time_conversions.hpp.

◆ min_of_hour()

template<class T = int>
const T time_shield::min_of_hour ( ts_t ts = ts())
constexprnoexcept

Get minute of hour. This function returns a value between 0 to 59.

Parameters
tsTimestamp in seconds (default: current timestamp).
Returns
Minute of hour.

Definition at line 2460 of file time_conversions.hpp.

◆ month_begin()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::month_begin ( ts_t ts = ts())
inline

Alias for start_of_month function.

Get the timestamp at the start of the current month.

This function returns the timestamp at the start of the current month, setting the day to the first day of the month and the time to 00:00:00.

Parameters
tsTimestamp (default is current timestamp)
Returns
Timestamp at the start of the current month

Definition at line 2167 of file time_conversions.hpp.

◆ month_of_year()

template<class T = Month>
TIME_SHIELD_CONSTEXPR const T time_shield::month_of_year ( ts_t ts)
inlinenoexcept

Get the month of the year.

This function returns the month of the year for the specified timestamp.

Parameters
tsTimestamp.
Returns
Month of the year.

Definition at line 1697 of file time_conversions.hpp.

◆ ms_of_sec()

template<class T = int>
const T time_shield::ms_of_sec ( fts_t ts)
constexprnoexcept

Get the millisecond part of the second from a floating-point timestamp.

Template Parameters
TType of the returned value (default is int).
Parameters
tsTimestamp in floating-point seconds.
Returns
T Millisecond part of the second.

Definition at line 77 of file time_conversions.hpp.

◆ ms_of_ts()

template<class T = int>
const T time_shield::ms_of_ts ( ts_ms_t ts)
constexprnoexcept

Get the millisecond part of the timestamp.

Template Parameters
TType of the returned value (default is int).
Parameters
tsTimestamp in milliseconds.
Returns
T Millisecond part of the timestamp.

Definition at line 87 of file time_conversions.hpp.

◆ ms_to_fsec()

template<class T = ts_ms_t>
const fts_t time_shield::ms_to_fsec ( T ts_ms)
constexprnoexcept

Converts a timestamp from milliseconds to floating-point seconds.

Template Parameters
TThe type of the input timestamp (default is ts_ms_t).
Parameters
ts_msTimestamp in milliseconds.
Returns
fts_t Timestamp in floating-point seconds.

Definition at line 146 of file time_conversions.hpp.

◆ ms_to_sec()

template<class T1 = ts_t, class T2 = ts_ms_t>
const T1 time_shield::ms_to_sec ( T2 ts_ms)
constexprnoexcept

Converts a timestamp from milliseconds to seconds.

Template Parameters
T1The type of the output timestamp (default is ts_t).
T2The type of the input timestamp (default is ts_ms_t).
Parameters
ts_msTimestamp in milliseconds.
Returns
T1 Timestamp in seconds.

Definition at line 137 of file time_conversions.hpp.

◆ next_day()

template<class T = int>
const ts_t time_shield::next_day ( ts_t ts,
T days = 1 )
constexprnoexcept

Calculate the timestamp for a specified number of days in the future.

Adds the given number of days to the provided timestamp, without adjusting to the start of the day.

Parameters
tsThe current timestamp in seconds.
daysThe number of days to add to the current timestamp (default is 1).
Returns
The timestamp in seconds after adding the specified number of days.

Definition at line 1986 of file time_conversions.hpp.

◆ next_day_from_unix_day()

template<class T = ts_t>
const T time_shield::next_day_from_unix_day ( uday_t unix_day)
constexprnoexcept

Alias for start_of_next_day_from_unix_day function.

Converts a UNIX day to a timestamp representing the start of the next day in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the next day (00:00:00).

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the next UNIX day.

Definition at line 1215 of file time_conversions.hpp.

◆ next_day_from_unix_day_ms()

template<class T = ts_ms_t>
const T time_shield::next_day_from_unix_day_ms ( uday_t unix_day)
constexprnoexcept

Alias for start_of_next_day_from_unix_day_ms function.

Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the next day (00:00:00.000).

Template Parameters
TThe return type of the function (default is ts_ms_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the next UNIX day.

Definition at line 1236 of file time_conversions.hpp.

◆ next_day_ms()

template<class T = int>
const ts_ms_t time_shield::next_day_ms ( ts_ms_t ts_ms,
T days = 1 )
constexprnoexcept

Calculate the timestamp for a specified number of days in the future (milliseconds).

Adds the given number of days to the provided timestamp, without adjusting to the start of the day.

Parameters
ts_msThe current timestamp in milliseconds.
daysThe number of days to add to the current timestamp (default is 1).
Returns
The timestamp in milliseconds after adding the specified number of days.

Definition at line 1998 of file time_conversions.hpp.

◆ next_day_start()

template<class T = int>
const ts_t time_shield::next_day_start ( ts_t ts,
T days = 1 )
constexprnoexcept

Alias for start_of_next_day function.

Get the timestamp of the start of the day after a specified number of days.

Calculates the timestamp for the beginning of the day after a specified number of days relative to the given timestamp.

Parameters
tsThe current timestamp in seconds.
daysThe number of days after the current day (default is 1).
Returns
The timestamp in seconds representing the beginning of the specified future day.

Definition at line 1950 of file time_conversions.hpp.

◆ next_day_start_ms()

template<class T = int>
const ts_ms_t time_shield::next_day_start_ms ( ts_ms_t ts_ms,
T days = 1 )
constexprnoexcept

Alias for start_of_next_day_ms function.

Get the timestamp of the start of the day after a specified number of days.

Calculates the timestamp for the beginning of the day after a specified number of days relative to the given timestamp in milliseconds.

Parameters
ts_msThe current timestamp in milliseconds.
daysThe number of days after the current day (default is 1).
Returns
The timestamp in milliseconds representing the beginning of the specified future day.

Definition at line 1972 of file time_conversions.hpp.

◆ next_day_unix_day()

template<class T = ts_t>
const T time_shield::next_day_unix_day ( uday_t unix_day)
constexprnoexcept

Alias for start_of_next_day_from_unix_day function.

Converts a UNIX day to a timestamp representing the start of the next day in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the next day (00:00:00).

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the next UNIX day.

Definition at line 1222 of file time_conversions.hpp.

◆ next_day_unix_day_ms()

template<class T = ts_ms_t>
const T time_shield::next_day_unix_day_ms ( uday_t unix_day)
constexprnoexcept

Alias for start_of_next_day_from_unix_day_ms function.

Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the next day (00:00:00.000).

Template Parameters
TThe return type of the function (default is ts_ms_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the next UNIX day.

Definition at line 1243 of file time_conversions.hpp.

◆ next_day_unixday()

template<class T = ts_t>
const T time_shield::next_day_unixday ( uday_t unix_day)
constexprnoexcept

Alias for start_of_next_day_from_unix_day function.

Converts a UNIX day to a timestamp representing the start of the next day in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the next day (00:00:00).

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the next UNIX day.

Definition at line 1229 of file time_conversions.hpp.

◆ next_day_unixday_ms()

template<class T = ts_ms_t>
const T time_shield::next_day_unixday_ms ( uday_t unix_day)
constexprnoexcept

Alias for start_of_next_day_from_unix_day_ms function.

Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the next day (00:00:00.000).

Template Parameters
TThe return type of the function (default is ts_ms_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the next UNIX day.

Definition at line 1250 of file time_conversions.hpp.

◆ ns_of_sec()

template<class T = int>
const T time_shield::ns_of_sec ( fts_t ts)
constexprnoexcept

Get the nanosecond part of the second from a floating-point timestamp.

Template Parameters
TType of the returned value (default is int).
Parameters
tsTimestamp in floating-point seconds.
Returns
T Nanosecond part of the second.

Definition at line 57 of file time_conversions.hpp.

◆ num_days_in_month() [1/2]

template<class T1 = int, class T2 = year_t, class T3 = int>
const T1 time_shield::num_days_in_month ( T2 year,
T3 month )
constexprnoexcept

Get the number of days in a month.

This function calculates and returns the number of days in the specified month and year.

Parameters
yearYear as an integer.
monthMonth as an integer.
Returns
The number of days in the given month and year.

Definition at line 1763 of file time_conversions.hpp.

◆ num_days_in_month() [2/2]

template<class T1 = int>
const T1 time_shield::num_days_in_month ( ts_t ts = ts())
constexprnoexcept

Alias for num_days_in_month_ts function.

Get the number of days in the month of the given timestamp.

This function calculates and returns the number of days in the month of the specified timestamp.

Parameters
tsThe timestamp to extract month and year from.
Returns
The number of days in the month of the given timestamp.

Definition at line 1801 of file time_conversions.hpp.

◆ num_days_in_month_ts()

template<class T1 = int>
TIME_SHIELD_CONSTEXPR const T1 time_shield::num_days_in_month_ts ( ts_t ts = ts())
noexcept

Get the number of days in the month of the given timestamp.

This function calculates and returns the number of days in the month of the specified timestamp.

Parameters
tsThe timestamp to extract month and year from.
Returns
The number of days in the month of the given timestamp.

Definition at line 1789 of file time_conversions.hpp.

◆ num_days_in_year()

template<class T1 = int, class T2 = year_t>
const T1 time_shield::num_days_in_year ( T2 year)
constexprnoexcept

Get the number of days in a given year.

This function calculates and returns the number of days in the specified year.

Parameters
yearYear.
Returns
Number of days in the given year.

Definition at line 1821 of file time_conversions.hpp.

◆ num_days_in_year_ts()

template<class T = int>
const T time_shield::num_days_in_year_ts ( ts_t ts = ts())
constexpr

Get the number of days in the current year.

This function calculates and returns the number of days in the current year based on the provided timestamp.

Parameters
tsTimestamp.
Returns
Number of days in the current year.

Definition at line 1842 of file time_conversions.hpp.

◆ previous_day_start()

template<class T = int>
const ts_t time_shield::previous_day_start ( ts_t ts = ts(),
T days = 1 )
constexprnoexcept

Alias for start_of_prev_day function.

Get timestamp of the start of the previous day.

This function returns the timestamp at the start of the previous day.

Parameters
tsTimestamp of the current day.
daysNumber of days to go back (default is 1).
Returns
Timestamp of the start of the previous day.

Definition at line 1890 of file time_conversions.hpp.

◆ saturday_begin()

const ts_t time_shield::saturday_begin ( ts_t ts = ts())
constexpr

Alias for start_of_saturday function.

Get the timestamp of the start of Saturday.

This function finds the timestamp of the beginning of the day on Saturday, which corresponds to the start of Saturday.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the start of Saturday.

Definition at line 2408 of file time_conversions.hpp.

◆ sec_of_day() [1/2]

template<class T1 = int, class T2 = int>
const T1 time_shield::sec_of_day ( T2 hour,
T2 min,
T2 sec )
constexprnoexcept

Get the second of the day.

This function returns a value between 0 and MAX_SEC_PER_DAY representing the second of the day, given the hour, minute, and second.

Template Parameters
T1The return type of the function (default is int).
T2The type of the hour, minute, and second parameters (default is int).
Parameters
hourHour of the day.
minMinute of the hour.
secSecond of the minute.
Returns
Second of the day.

Definition at line 1326 of file time_conversions.hpp.

◆ sec_of_day() [2/2]

template<class T = int>
const T time_shield::sec_of_day ( ts_t ts = ts())
constexprnoexcept

Get the second of the day.

This function returns a value from 0 to MAX_SEC_PER_DAY representing the second of the day.

Template Parameters
TThe return type of the function (default is int).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Second of the day.

Definition at line 1299 of file time_conversions.hpp.

◆ sec_of_day_ms()

template<class T = int>
const T time_shield::sec_of_day_ms ( ts_ms_t ts_ms)
constexprnoexcept

Get the second of the day from milliseconds timestamp.

This function returns a value from 0 to MAX_SEC_PER_DAY representing the second of the day, given a timestamp in milliseconds.

Template Parameters
TThe return type of the function (default is int).
Parameters
ts_msTimestamp in milliseconds.
Returns
Second of the day.

Definition at line 1311 of file time_conversions.hpp.

◆ sec_of_hour()

template<class T = int>
const T time_shield::sec_of_hour ( ts_t ts = ts())
constexpr

Get the second of the hour.

This function returns a value between 0 and 3599 representing the second of the hour.

Template Parameters
TThe return type of the function (default is int).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Second of the hour.

Definition at line 1353 of file time_conversions.hpp.

◆ sec_of_min()

template<class T = int>
const T time_shield::sec_of_min ( ts_t ts = ts())
constexpr

Get the second of the minute.

This function returns a value between 0 and 59 representing the second of the minute.

Template Parameters
TThe return type of the function (default is int).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Second of the minute.

Definition at line 1341 of file time_conversions.hpp.

◆ sec_to_ms()

template<class T1 = ts_ms_t, class T2 >
const T1 time_shield::sec_to_ms ( T2 ts)
constexprnoexcept

Converts a timestamp from seconds to milliseconds.

Template Parameters
T1The type of the output timestamp (default is ts_ms_t).
T2The type of the input timestamp.
Parameters
tsTimestamp in seconds.
Returns
T1 Timestamp in milliseconds.

Definition at line 109 of file time_conversions.hpp.

◆ sec_to_ms_impl() [1/2]

template<class T >
const ts_ms_t time_shield::sec_to_ms_impl ( T t,
std::false_type  )
constexprnoexcept

Definition at line 98 of file time_conversions.hpp.

◆ sec_to_ms_impl() [2/2]

template<class T >
const ts_ms_t time_shield::sec_to_ms_impl ( T t,
std::true_type  )
constexprnoexcept

Definition at line 93 of file time_conversions.hpp.

◆ start_of_day()

const ts_t time_shield::start_of_day ( ts_t ts = ts())
constexprnoexcept

Get the start of the day timestamp.

This function returns the timestamp at the start of the day. The function sets the hours, minutes, and seconds to zero.

Parameters
tsTimestamp.
Returns
Start of the day timestamp.

Definition at line 1863 of file time_conversions.hpp.

◆ start_of_day_from_unix_day()

template<class T = ts_t>
const T time_shield::start_of_day_from_unix_day ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp function.

Converts a UNIX day to a timestamp in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the specified UNIX day.

Definition at line 1113 of file time_conversions.hpp.

◆ start_of_day_from_unix_day_ms()

template<class T = ts_t>
const T time_shield::start_of_day_from_unix_day_ms ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp_ms function.

Converts a UNIX day to a timestamp in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the specified UNIX day.

Definition at line 1154 of file time_conversions.hpp.

◆ start_of_day_ms()

const ts_ms_t time_shield::start_of_day_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the start of the day timestamp in milliseconds.

This function returns the timestamp at the start of the day in milliseconds. The function sets the hours, minutes, seconds, and milliseconds to zero.

Parameters
ts_msTimestamp in milliseconds.
Returns
Start of the day timestamp in milliseconds.

Definition at line 1922 of file time_conversions.hpp.

◆ start_of_day_sec()

const ts_t time_shield::start_of_day_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the start of the day timestamp in seconds.

This function returns the timestamp at the start of the day in seconds. The function sets the hours, minutes, and seconds to zero.

Parameters
ts_msTimestamp in milliseconds.
Returns
Start of the day timestamp in seconds.

Definition at line 1903 of file time_conversions.hpp.

◆ start_of_hour()

const ts_t time_shield::start_of_hour ( ts_t ts = ts())
constexprnoexcept

Get the timestamp at the start of the hour.

This function sets the minute and second to zero.

Parameters
tsTimestamp (default: current timestamp).
Returns
Timestamp at the start of the hour.

Definition at line 2239 of file time_conversions.hpp.

◆ start_of_hour_ms()

const ts_ms_t time_shield::start_of_hour_ms ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the timestamp at the start of the hour. This function sets the minute and second to zero.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the start of the hour in milliseconds.

Definition at line 2273 of file time_conversions.hpp.

◆ start_of_hour_sec()

const ts_t time_shield::start_of_hour_sec ( ts_ms_t ts_ms = ts_ms())
constexprnoexcept

Get the timestamp at the start of the hour.

This function sets the minute and second to zero.

Parameters
ts_msTimestamp in milliseconds (default: current timestamp in milliseconds).
Returns
Timestamp at the start of the hour in seconds.

Definition at line 2257 of file time_conversions.hpp.

◆ start_of_min()

const ts_t time_shield::start_of_min ( ts_t ts = ts())
constexprnoexcept

Get the timestamp of the beginning of the minute.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the beginning of the minute.

Definition at line 2417 of file time_conversions.hpp.

◆ start_of_month()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::start_of_month ( ts_t ts = ts())
inline

Get the timestamp at the start of the current month.

This function returns the timestamp at the start of the current month, setting the day to the first day of the month and the time to 00:00:00.

Parameters
tsTimestamp (default is current timestamp)
Returns
Timestamp at the start of the current month

Definition at line 2161 of file time_conversions.hpp.

◆ start_of_next_day()

template<class T = int>
const ts_t time_shield::start_of_next_day ( ts_t ts,
T days = 1 )
constexprnoexcept

Get the timestamp of the start of the day after a specified number of days.

Calculates the timestamp for the beginning of the day after a specified number of days relative to the given timestamp.

Parameters
tsThe current timestamp in seconds.
daysThe number of days after the current day (default is 1).
Returns
The timestamp in seconds representing the beginning of the specified future day.

Definition at line 1943 of file time_conversions.hpp.

◆ start_of_next_day_from_unix_day()

template<class T = ts_ms_t>
const T time_shield::start_of_next_day_from_unix_day ( uday_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the start of the next day in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the next day (00:00:00).

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the next UNIX day.

Definition at line 1195 of file time_conversions.hpp.

◆ start_of_next_day_from_unix_day_ms()

template<class T = ts_ms_t>
const T time_shield::start_of_next_day_from_unix_day_ms ( uday_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the next day (00:00:00.000).

Template Parameters
TThe return type of the function (default is ts_ms_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the next UNIX day.

Definition at line 1208 of file time_conversions.hpp.

◆ start_of_next_day_ms()

template<class T = int>
const ts_ms_t time_shield::start_of_next_day_ms ( ts_ms_t ts_ms,
T days = 1 )
constexprnoexcept

Get the timestamp of the start of the day after a specified number of days.

Calculates the timestamp for the beginning of the day after a specified number of days relative to the given timestamp in milliseconds.

Parameters
ts_msThe current timestamp in milliseconds.
daysThe number of days after the current day (default is 1).
Returns
The timestamp in milliseconds representing the beginning of the specified future day.

Definition at line 1965 of file time_conversions.hpp.

◆ start_of_period()

template<class T = int>
const ts_t time_shield::start_of_period ( T p,
ts_t ts = ts() )
constexpr

Get the timestamp of the start of the period.

Parameters
pPeriod duration in seconds.
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the start of the period.

Definition at line 2471 of file time_conversions.hpp.

◆ start_of_prev_day()

template<class T = int>
const ts_t time_shield::start_of_prev_day ( ts_t ts = ts(),
T days = 1 )
constexprnoexcept

Get timestamp of the start of the previous day.

This function returns the timestamp at the start of the previous day.

Parameters
tsTimestamp of the current day.
daysNumber of days to go back (default is 1).
Returns
Timestamp of the start of the previous day.

Definition at line 1883 of file time_conversions.hpp.

◆ start_of_saturday()

const ts_t time_shield::start_of_saturday ( ts_t ts = ts())
constexpr

Get the timestamp of the start of Saturday.

This function finds the timestamp of the beginning of the day on Saturday, which corresponds to the start of Saturday.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the start of Saturday.

Definition at line 2402 of file time_conversions.hpp.

◆ start_of_week()

const ts_t time_shield::start_of_week ( ts_t ts = ts())
constexpr

Get the timestamp of the beginning of the week.

This function finds the timestamp of the beginning of the week, which corresponds to the start of Sunday.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the beginning of the week.

Definition at line 2364 of file time_conversions.hpp.

◆ start_of_year()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::start_of_year ( ts_t ts)
inlinenoexcept

Get the start of the year timestamp.

This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.

Parameters
tsTimestamp.
Returns
Start of the year timestamp.

Definition at line 1422 of file time_conversions.hpp.

◆ start_of_year_date()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::start_of_year_date ( T year)
inline

Get the timestamp of the start of the year.

This function returns the timestamp at the start of the specified year.

Parameters
yearYear.
Returns
Timestamp of the start of the year.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 1523 of file time_conversions.hpp.

◆ start_of_year_date_ms()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::start_of_year_date_ms ( T year)
inline

Get the timestamp in milliseconds of the start of the year.

This function returns the timestamp at the start of the specified year in milliseconds.

Parameters
yearYear.
Returns
Timestamp of the start of the year in milliseconds.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 1565 of file time_conversions.hpp.

◆ start_of_year_ms()

TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::start_of_year_ms ( ts_ms_t ts_ms = ts_ms())
inlinenoexcept

Get the start of the year timestamp in milliseconds.

This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.

Parameters
ts_msTimestamp in milliseconds.
Returns
Start of year timestamp in milliseconds.

Definition at line 1497 of file time_conversions.hpp.

◆ time_zone_struct_to_offset()

const tz_t time_shield::time_zone_struct_to_offset ( const TimeZoneStruct & tz)
inline

Converts a TimeZoneStruct to a single integer representation.

Parameters
tzThe TimeZoneStruct to convert.
Returns
An integer representing the TimeZoneStruct.

Definition at line 94 of file time_zone_struct.hpp.

◆ timestamp() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp function.

Converts a std::tm structure to a timestamp.

This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 602 of file time_conversions.hpp.

◆ timestamp() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0 )
inline

Alias for to_timestamp function.

Converts a date and time to a timestamp.

This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 475 of file time_conversions.hpp.

◆ timestamp_ms() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp_ms ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp_ms function.

Converts a std::tm structure to a timestamp in milliseconds.

This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp in milliseconds representing the given date and time.

Definition at line 777 of file time_conversions.hpp.

◆ timestamp_ms() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::timestamp_ms ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T2 ms = 0 )
inline

Alias for to_timestamp_ms function.

Converts a date and time to a timestamp in milliseconds.

This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Timestamp in milliseconds representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 675 of file time_conversions.hpp.

◆ tm_to_ftimestamp()

TIME_SHIELD_CONSTEXPR const fts_t time_shield::tm_to_ftimestamp ( const std::tm * timeinfo)
inline

Converts a std::tm structure to a floating-point timestamp.

This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to the std::tm structure containing the date and time.
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 924 of file time_conversions.hpp.

◆ tm_to_timestamp()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::tm_to_timestamp ( const std::tm * timeinfo)
inline

Converts a std::tm structure to a timestamp.

This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 568 of file time_conversions.hpp.

◆ tm_to_timestamp_ms()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::tm_to_timestamp_ms ( const std::tm * timeinfo)
inline

Converts a std::tm structure to a timestamp in milliseconds.

This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp in milliseconds representing the given date and time.

Definition at line 749 of file time_conversions.hpp.

◆ to_ftimestamp() [1/2]

TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_ftimestamp ( const std::tm * timeinfo)
inline

Alias for tm_to_ftimestamp function.

Converts a std::tm structure to a floating-point timestamp.

This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to the std::tm structure containing the date and time.
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 931 of file time_conversions.hpp.

◆ to_ftimestamp() [2/2]

template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_ftimestamp ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T3 ms = 0 )
inline

Converts a date and time to a floating-point timestamp.

This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is year_t).
T2The type of the month, day, hour, minute, and second parameters (default is int).
T3The type of the millisecond parameter (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 803 of file time_conversions.hpp.

◆ to_fts() [1/2]

TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_fts ( const std::tm * timeinfo)
inline

Alias for tm_to_ftimestamp function.

Converts a std::tm structure to a floating-point timestamp.

This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to the std::tm structure containing the date and time.
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 938 of file time_conversions.hpp.

◆ to_fts() [2/2]

template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_fts ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T3 ms = 0 )
inline

Alias for to_ftimestamp function.

Converts a date and time to a floating-point timestamp.

This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is year_t).
T2The type of the month, day, hour, minute, and second parameters (default is int).
T3The type of the millisecond parameter (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Floating-point timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 818 of file time_conversions.hpp.

◆ to_offset()

const tz_t time_shield::to_offset ( const TimeZoneStruct & tz)
inline

Alias for time_zone_struct_to_offset function.

Converts a TimeZoneStruct to a single integer representation.

Parameters
tzThe TimeZoneStruct to convert.
Returns
An integer representing the TimeZoneStruct.

Definition at line 108 of file time_zone_struct.hpp.

◆ to_time_zone()

template<class T = TimeZoneStruct>
const TimeZoneStruct time_shield::to_time_zone ( tz_t offset)
inline

Converts an integer to a time zone structure.

Template Parameters
TThe type of the time zone structure (default is TimeZoneStruct).
Parameters
offsetThe integer to convert.
Returns
A time zone structure of type T represented by the given integer.

The function assumes that the type T has members hour, min, and is_positive.

Definition at line 2494 of file time_conversions.hpp.

◆ to_time_zone_struct()

const TimeZoneStruct time_shield::to_time_zone_struct ( tz_t offset)
inline

Converts an integer to a TimeZoneStruct.

Parameters
offsetThe integer to convert.
Returns
A TimeZoneStruct represented by the given integer.

Definition at line 43 of file time_zone_struct.hpp.

◆ to_timestamp() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp function.

Converts a std::tm structure to a timestamp.

This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 581 of file time_conversions.hpp.

◆ to_timestamp() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0 )
inline

Converts a date and time to a timestamp.

This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 378 of file time_conversions.hpp.

◆ to_timestamp_ms() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp_ms ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp_ms function.

Converts a std::tm structure to a timestamp in milliseconds.

This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp in milliseconds representing the given date and time.

Definition at line 756 of file time_conversions.hpp.

◆ to_timestamp_ms() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::to_timestamp_ms ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T2 ms = 0 )
inline

Converts a date and time to a timestamp in milliseconds.

This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Timestamp in milliseconds representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 633 of file time_conversions.hpp.

◆ to_ts() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp function.

Converts a std::tm structure to a timestamp.

This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 588 of file time_conversions.hpp.

◆ to_ts() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0 )
inline

Alias for to_timestamp function.

Converts a date and time to a timestamp.

This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 436 of file time_conversions.hpp.

◆ to_ts_ms() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts_ms ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp_ms function.

Converts a std::tm structure to a timestamp in milliseconds.

This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp in milliseconds representing the given date and time.

Definition at line 763 of file time_conversions.hpp.

◆ to_ts_ms() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::to_ts_ms ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T2 ms = 0 )
inline

Alias for to_timestamp_ms function.

Converts a date and time to a timestamp in milliseconds.

This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Timestamp in milliseconds representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 647 of file time_conversions.hpp.

◆ to_tz()

const TimeZoneStruct time_shield::to_tz ( tz_t offset)
inline

Alias for to_time_zone_struct function.

Converts an integer to a TimeZoneStruct.

Parameters
offsetThe integer to convert.
Returns
A TimeZoneStruct represented by the given integer.

Definition at line 55 of file time_zone_struct.hpp.

◆ to_unix_min()

template<class T = int64_t>
const T time_shield::to_unix_min ( ts_t ts = ts())
constexpr

Alias for get_unix_min function.

Get UNIX minute.

This function returns the number of minutes elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is int64_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of minutes since the UNIX epoch.

Definition at line 1278 of file time_conversions.hpp.

◆ to_unix_year()

template<class T = year_t>
const T time_shield::to_unix_year ( ts_t ts)
constexprnoexcept

Alias for get_unix_year function.

Converts a UNIX timestamp to a year.

Template Parameters
TThe type of the year (default is year_t).
Parameters
tsUNIX timestamp.
Returns
T Year corresponding to the given timestamp.

Definition at line 197 of file time_conversions.hpp.

◆ to_year()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::to_year ( ts_t ts = ts())
inline

Alias for get_year function.

Get the year from the timestamp.

This function returns the year of the specified timestamp in seconds since the Unix epoch.

Template Parameters
TThe return type of the function (default is year_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Year of the specified timestamp.

Definition at line 1381 of file time_conversions.hpp.

◆ to_year_ms()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::to_year_ms ( ts_ms_t ts_ms = ts_ms())
inline

Alias for get_year_ms function.

Get the year from the timestamp in milliseconds.

This function returns the year of the specified timestamp in milliseconds since the Unix epoch.

Template Parameters
TThe return type of the function (default is year_t).
Parameters
ts_msTimestamp in milliseconds (default is current timestamp).
Returns
Year of the specified timestamp.

Definition at line 1409 of file time_conversions.hpp.

◆ ts() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp function.

Converts a std::tm structure to a timestamp.

This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 595 of file time_conversions.hpp.

◆ ts() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0 )
inline

Alias for to_timestamp function.

Converts a date and time to a timestamp.

This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 462 of file time_conversions.hpp.

◆ ts_from_tm()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts_from_tm ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp function.

Converts a std::tm structure to a timestamp.

This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 609 of file time_conversions.hpp.

◆ ts_ms() [1/2]

TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts_ms ( const std::tm * timeinfo)
inline

Alias for tm_to_timestamp_ms function.

Converts a std::tm structure to a timestamp in milliseconds.

This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Parameters
timeinfoPointer to a std::tm structure containing the date and time information.
Returns
Timestamp in milliseconds representing the given date and time.

Definition at line 770 of file time_conversions.hpp.

◆ ts_ms() [2/2]

template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::ts_ms ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T2 ms = 0 )
inline

Alias for to_timestamp_ms function.

Converts a date and time to a timestamp in milliseconds.

This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).

Template Parameters
T1The type of the year parameter (default is int64_t).
T2The type of the other date and time parameters (default is int).
Parameters
yearThe year value.
monthThe month value.
dayThe day value.
hourThe hour value (default is 0).
minThe minute value (default is 0).
secThe second value (default is 0).
msThe millisecond value (default is 0).
Returns
Timestamp in milliseconds representing the given date and time.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 661 of file time_conversions.hpp.

◆ tz_to_offset()

const tz_t time_shield::tz_to_offset ( const TimeZoneStruct & tz)
inline

Alias for time_zone_struct_to_offset function.

Converts a TimeZoneStruct to a single integer representation.

Parameters
tzThe TimeZoneStruct to convert.
Returns
An integer representing the TimeZoneStruct.

Definition at line 101 of file time_zone_struct.hpp.

◆ uday()

template<class T = uday_t>
const T time_shield::uday ( ts_t ts = ts())
constexprnoexcept

Alias for get_unix_day function.

Get UNIX day.

This function returns the number of days elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of days since the UNIX epoch.

Definition at line 995 of file time_conversions.hpp.

◆ uday_ms()

template<class T = uday_t>
const T time_shield::uday_ms ( ts_ms_t t_ms = ts_ms())
constexprnoexcept

Alias for get_unix_day_ms function.

Get UNIX day from milliseconds timestamp.

This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
t_msTimestamp in milliseconds (default is current timestamp in milliseconds).
Returns
Number of days since the UNIX epoch.

Definition at line 1070 of file time_conversions.hpp.

◆ uday_to_ts()

template<class T = ts_t>
const T time_shield::uday_to_ts ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp function.

Converts a UNIX day to a timestamp in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the specified UNIX day.

Definition at line 1106 of file time_conversions.hpp.

◆ uday_to_ts_ms()

template<class T = ts_t>
const T time_shield::uday_to_ts_ms ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp_ms function.

Converts a UNIX day to a timestamp in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the specified UNIX day.

Definition at line 1147 of file time_conversions.hpp.

◆ umin()

template<class T = int64_t>
const T time_shield::umin ( ts_t ts = ts())
constexpr

Alias for get_unix_min function.

Get UNIX minute.

This function returns the number of minutes elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is int64_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of minutes since the UNIX epoch.

Definition at line 1285 of file time_conversions.hpp.

◆ unix_day()

template<class T = uday_t>
const T time_shield::unix_day ( ts_t ts = ts())
constexprnoexcept

Alias for get_unix_day function.

Get UNIX day.

This function returns the number of days elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of days since the UNIX epoch.

Definition at line 981 of file time_conversions.hpp.

◆ unix_day_ms()

template<class T = uday_t>
const T time_shield::unix_day_ms ( ts_ms_t t_ms = ts_ms())
constexprnoexcept

Alias for get_unix_day_ms function.

Get UNIX day from milliseconds timestamp.

This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
t_msTimestamp in milliseconds (default is current timestamp in milliseconds).
Returns
Number of days since the UNIX epoch.

Definition at line 1056 of file time_conversions.hpp.

◆ unix_day_to_timestamp()

template<class T = ts_t>
const T time_shield::unix_day_to_timestamp ( uday_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the specified UNIX day.

Definition at line 1085 of file time_conversions.hpp.

◆ unix_day_to_timestamp_ms()

template<class T = ts_t>
const T time_shield::unix_day_to_timestamp_ms ( uday_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the specified UNIX day.

Definition at line 1126 of file time_conversions.hpp.

◆ unix_day_to_ts()

template<class T = ts_t>
const T time_shield::unix_day_to_ts ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp function.

Converts a UNIX day to a timestamp in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the specified UNIX day.

Definition at line 1092 of file time_conversions.hpp.

◆ unix_day_to_ts_ms()

template<class T = ts_t>
const T time_shield::unix_day_to_ts_ms ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp_ms function.

Converts a UNIX day to a timestamp in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the specified UNIX day.

Definition at line 1133 of file time_conversions.hpp.

◆ unix_min()

template<class T = int64_t>
const T time_shield::unix_min ( ts_t ts = ts())
constexpr

Alias for get_unix_min function.

Get UNIX minute.

This function returns the number of minutes elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is int64_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of minutes since the UNIX epoch.

Definition at line 1271 of file time_conversions.hpp.

◆ unix_year()

template<class T = year_t>
const T time_shield::unix_year ( ts_t ts)
constexprnoexcept

Alias for get_unix_year function.

Converts a UNIX timestamp to a year.

Template Parameters
TThe type of the year (default is year_t).
Parameters
tsUNIX timestamp.
Returns
T Year corresponding to the given timestamp.

Definition at line 190 of file time_conversions.hpp.

◆ unixday()

template<class T = uday_t>
const T time_shield::unixday ( ts_t ts = ts())
constexprnoexcept

Alias for get_unix_day function.

Get UNIX day.

This function returns the number of days elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of days since the UNIX epoch.

Definition at line 988 of file time_conversions.hpp.

◆ unixday_ms()

template<class T = uday_t>
const T time_shield::unixday_ms ( ts_ms_t t_ms = ts_ms())
constexprnoexcept

Alias for get_unix_day_ms function.

Get UNIX day from milliseconds timestamp.

This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
t_msTimestamp in milliseconds (default is current timestamp in milliseconds).
Returns
Number of days since the UNIX epoch.

Definition at line 1063 of file time_conversions.hpp.

◆ unixday_to_ts()

template<class T = ts_t>
const T time_shield::unixday_to_ts ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp function.

Converts a UNIX day to a timestamp in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the specified UNIX day.

Definition at line 1099 of file time_conversions.hpp.

◆ unixday_to_ts_ms()

template<class T = ts_t>
const T time_shield::unixday_to_ts_ms ( uday_t unix_day)
constexprnoexcept

Alias for unix_day_to_timestamp_ms function.

Converts a UNIX day to a timestamp in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the specified UNIX day.

Definition at line 1140 of file time_conversions.hpp.

◆ us_of_sec()

template<class T = int>
const T time_shield::us_of_sec ( fts_t ts)
constexprnoexcept

Get the microsecond part of the second from a floating-point timestamp.

Template Parameters
TType of the returned value (default is int).
Parameters
tsTimestamp in floating-point seconds.
Returns
T Microsecond part of the second.

Definition at line 67 of file time_conversions.hpp.

◆ week_begin()

const ts_t time_shield::week_begin ( ts_t ts = ts())
constexpr

Alias for start_of_week function.

Get the timestamp of the beginning of the week.

This function finds the timestamp of the beginning of the week, which corresponds to the start of Sunday.

Parameters
tsTimestamp (default: current timestamp).
Returns
Returns the timestamp of the beginning of the week.

Definition at line 2370 of file time_conversions.hpp.

◆ year()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::year ( ts_t ts = ts())
inline

Alias for get_year function.

Get the year from the timestamp.

This function returns the year of the specified timestamp in seconds since the Unix epoch.

Template Parameters
TThe return type of the function (default is year_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Year of the specified timestamp.

Definition at line 1374 of file time_conversions.hpp.

◆ year_begin()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin ( ts_t ts = ts())
inline

Alias for start_of_year function.

Get the start of the year timestamp.

This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.

Parameters
tsTimestamp.
Returns
Start of the year timestamp.

Definition at line 1484 of file time_conversions.hpp.

◆ year_begin_date()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin_date ( T year)
inline

Alias for start_of_year_date function.

Get the timestamp of the start of the year.

This function returns the timestamp at the start of the specified year.

Parameters
yearYear.
Returns
Timestamp of the start of the year.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 1551 of file time_conversions.hpp.

◆ year_begin_date_ms()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::year_begin_date_ms ( T year)
inline

Alias for start_of_year_date_ms function.

Get the timestamp in milliseconds of the start of the year.

This function returns the timestamp at the start of the specified year in milliseconds.

Parameters
yearYear.
Returns
Timestamp of the start of the year in milliseconds.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 1579 of file time_conversions.hpp.

◆ year_begin_ms()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin_ms ( ts_t ts_ms = ts_ms())
inline

Alias for start_of_year_ms function.

Get the start of the year timestamp in milliseconds.

This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.

Parameters
ts_msTimestamp in milliseconds.
Returns
Start of year timestamp in milliseconds.

Definition at line 1509 of file time_conversions.hpp.

◆ year_end()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_end ( ts_t ts = ts())
inline

Alias for end_of_year function.

Get the end-of-year timestamp.

This function finds the last timestamp of the current year.

Parameters
tsTimestamp.
Returns
End-of-year timestamp.

Definition at line 1652 of file time_conversions.hpp.

◆ year_end_ms()

TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::year_end_ms ( ts_ms_t ts_ms = ts_ms())
inline

Alias for end_of_year_ms function.

Get the timestamp in milliseconds of the end of the year.

This function finds the last timestamp of the current year in milliseconds.

Parameters
ts_msTimestamp in milliseconds.
Returns
End-of-year timestamp in milliseconds.

Definition at line 1671 of file time_conversions.hpp.

◆ year_ms()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::year_ms ( ts_ms_t ts_ms = ts_ms())
inline

Alias for get_year_ms function.

Get the year from the timestamp in milliseconds.

This function returns the year of the specified timestamp in milliseconds since the Unix epoch.

Template Parameters
TThe return type of the function (default is year_t).
Parameters
ts_msTimestamp in milliseconds (default is current timestamp).
Returns
Year of the specified timestamp.

Definition at line 1402 of file time_conversions.hpp.

◆ year_start()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_start ( ts_t ts = ts())
inline

Alias for start_of_year function.

Get the start of the year timestamp.

This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.

Parameters
tsTimestamp.
Returns
Start of the year timestamp.

Definition at line 1478 of file time_conversions.hpp.

◆ year_start_date()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_start_date ( T year)
inline

Alias for start_of_year_date function.

Get the timestamp of the start of the year.

This function returns the timestamp at the start of the specified year.

Parameters
yearYear.
Returns
Timestamp of the start of the year.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 1544 of file time_conversions.hpp.

◆ year_start_date_ms()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::year_start_date_ms ( T year)
inline

Alias for start_of_year_date_ms function.

Get the timestamp in milliseconds of the start of the year.

This function returns the timestamp at the start of the specified year in milliseconds.

Parameters
yearYear.
Returns
Timestamp of the start of the year in milliseconds.
Exceptions
std::invalid_argumentif the date-time combination is invalid.

Definition at line 1572 of file time_conversions.hpp.

◆ year_start_ms()

TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_start_ms ( ts_t ts_ms = ts_ms())
inline

Alias for start_of_year_ms function.

Get the start of the year timestamp in milliseconds.

This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.

Parameters
ts_msTimestamp in milliseconds.
Returns
Start of year timestamp in milliseconds.

Definition at line 1503 of file time_conversions.hpp.