Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
time_conversions.hpp File Reference

Header file for time conversion functions. More...

#include "enums.hpp"
#include "validation.hpp"
#include "time_utils.hpp"
#include "time_zone_struct.hpp"
#include <cmath>
#include <ctime>

Go to the source code of this file.

Namespaces

namespace  time_shield
 Main namespace for the Time Shield library.
 

Macros

#define _TIME_SHIELD_TIME_CONVERSIONS_HPP_INCLUDED
 

Functions

template<class T = int>
constexpr const T time_shield::ns_of_sec (const 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 (const 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 (const 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 (const 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 (const T &t, std::true_type) noexcept
 
template<class T >
constexpr const ts_ms_t time_shield::sec_to_ms_impl (const T &t, std::false_type) noexcept
 
template<class T1 = ts_ms_t, class T2 >
constexpr const T1 time_shield::sec_to_ms (const T2 &ts) noexcept
 Converts a timestamp from seconds to milliseconds.
 
constexpr const ts_ms_t time_shield::fsec_to_ms (const 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 (const 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 (const 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 (const ts_t &ts) noexcept
 Converts a UNIX timestamp to a year.
 
template<class T = year_t>
constexpr const T time_shield::unix_year (const ts_t &ts) noexcept
 Alias for get_unix_year function.
 
template<class T = year_t>
constexpr const T time_shield::to_unix_year (const ts_t &ts) noexcept
 Alias for get_unix_year function.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::hour24_to_12 (const 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 (const T &hour) noexcept
 Alias for hour24_to_12 function.
 
template<class T1 , class T2 = ts_t>
T1 time_shield::to_date_time (const T2 &ts)
 Converts a timestamp to a date-time structure.
 
template<class T1 , class T2 = ts_t>
T1 time_shield::to_dt (const T2 &ts)
 Alias for to_date_time function.
 
template<class T >
time_shield::to_date_time_ms (const ts_ms_t &ts)
 Converts a timestamp in milliseconds to a date-time structure with milliseconds.
 
template<class T >
time_shield::to_dt_ms (const ts_ms_t &ts)
 Alias for to_date_time_ms function.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0)
 Alias for to_timestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::dt_to_timestamp (const T &date_time)
 Converts a date-time structure to a timestamp.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp (const T &date_time)
 Alias for dt_to_timestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts (const T &date_time)
 Alias for dt_to_timestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts (const T &date_time)
 Alias for dt_to_timestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp (const T &date_time)
 Alias for dt_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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T2 &ms=0)
 Alias for to_timestamp_ms function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::dt_to_timestamp_ms (const T &date_time)
 Converts a date-time structure to a timestamp in milliseconds.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_timestamp_ms (const T &date_time)
 Alias for dt_to_timestamp_ms function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::to_ts_ms (const T &date_time)
 Alias for dt_to_timestamp_ms function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::ts_ms (const T &date_time)
 Alias for dt_to_timestamp_ms function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const ts_t time_shield::timestamp_ms (const T &date_time)
 Alias for dt_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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const 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 (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T3 &ms=0)
 Alias for to_ftimestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const fts_t time_shield::dt_to_ftimestamp (const T &date_time)
 Converts a date-time structure to a floating-point timestamp.
 
template<class T >
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_ftimestamp (const T &date_time)
 Alias for dt_to_ftimestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const fts_t time_shield::to_fts (const T &date_time)
 Alias for dt_to_ftimestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const fts_t time_shield::fts (const T &date_time)
 Alias for dt_to_ftimestamp function.
 
template<class T >
TIME_SHIELD_CONSTEXPR const fts_t time_shield::ftimestamp (const T &date_time)
 Alias for dt_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 (const ts_t &ts=ts()) noexcept
 Get UNIX day.
 
template<class T = uday_t>
constexpr const T time_shield::unix_day (const ts_t &ts=ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr const T time_shield::uday (const ts_t &ts=ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = int>
constexpr const T time_shield::get_days_difference (const ts_t &start, const ts_t &stop) noexcept
 Get the number of days between two timestamps.
 
template<class T = int>
constexpr const T time_shield::get_days (const ts_t &start, const ts_t &stop) noexcept
 Alias for get_days_difference function.
 
template<class T = int>
constexpr const T time_shield::days (const ts_t &start, const ts_t &stop) noexcept
 Alias for get_days_difference function.
 
template<class T = uday_t>
constexpr const T time_shield::get_unix_day_ms (const ts_ms_t &t_ms=ts_ms()) noexcept
 Get UNIX day from milliseconds timestamp.
 
template<class T = uday_t>
constexpr const T time_shield::unix_day_ms (const 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 (const 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 (const uday_t &unix_day) noexcept
 Convert a UNIX day to a timestamp.
 
template<class T = ts_t>
constexpr const T time_shield::unix_day_to_ts (const 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 (const uday_t &unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = int64_t>
constexpr const T time_shield::get_unix_min (const ts_t &ts=ts())
 Get UNIX minute.
 
template<class T = int64_t>
constexpr const T time_shield::unix_min (const ts_t &ts=ts())
 Alias for get_unix_min function.
 
template<class T = int64_t>
constexpr const T time_shield::to_unix_min (const ts_t &ts=ts())
 Alias for get_unix_min function.
 
template<class T = int64_t>
constexpr const T time_shield::umin (const ts_t &ts=ts())
 Alias for get_unix_min function.
 
template<class T = int>
constexpr const T time_shield::sec_of_day (const ts_t &ts=ts())
 Get the second of the day.
 
template<class T = int>
constexpr const T time_shield::sec_of_day_ms (const 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 (const T2 &hour, const T2 &min, const T2 &sec) noexcept
 Get the second of the day.
 
template<class T = int>
constexpr const T time_shield::sec_of_min (const ts_t &ts=ts())
 Get the second of the minute.
 
template<class T = int>
constexpr const T time_shield::sec_of_hour (const ts_t &ts=ts())
 Get the second of the hour.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::get_year (const ts_t &ts=ts())
 Get the year from the timestamp.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::year (const ts_t &ts=ts())
 Alias for get_year function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::to_year (const ts_t &ts=ts())
 Alias for get_year function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T time_shield::get_year_ms (const 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 (const 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 (const ts_ms_t &ts_ms=ts_ms())
 Alias for get_year_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::start_of_year (const ts_t &ts) noexcept
 Get the start of the year timestamp.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_start (const ts_t &ts=ts())
 Alias for start_of_year function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin (const ts_t &ts=ts())
 Alias for start_of_year function.
 
TIME_SHIELD_CONSTEXPR const ts_ms_t time_shield::start_of_year_ms (const 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 (const ts_t &ts_ms=ts_ms())
 Alias for start_of_year_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_begin_ms (const 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 (const 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 (const 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 (const 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 (const 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 (const 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 (const T &year)
 Alias for start_of_year_date_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t time_shield::end_of_year (const ts_t &ts=ts())
 Get the end-of-year timestamp.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::year_end (const 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 (const 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 (const 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 (const ts_t &ts=ts())
 Get the day of the year.
 
template<class T = Month>
TIME_SHIELD_CONSTEXPR const T time_shield::month_of_year (const ts_t &ts) noexcept
 Get the month of the year.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T time_shield::day_of_month (const 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 (const T2 &year, const 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 (const T2 &year, const 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 (const 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 (const 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 (const 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 (const 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 (const T2 &year) noexcept
 Alias for num_days_in_year function.
 
template<class T = int>
constexpr const T time_shield::num_days_in_year_ts (const 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 (const ts_t &ts=ts())
 Alias for num_days_in_year_ts function.
 
constexpr const ts_t time_shield::start_of_day (const ts_t &ts=ts()) noexcept
 Get the start of the day timestamp.
 
constexpr const ts_t time_shield::day_start (const 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 (const ts_t &ts=ts(), const T &days=1)
 Get timestamp of the start of the previous day.
 
template<class T = int>
constexpr const ts_t time_shield::previous_day_start (const ts_t &ts=ts(), const T &days=1)
 Alias for start_of_prev_day function.
 
constexpr const ts_t time_shield::start_of_day_sec (const ts_ms_t &ts_ms=ts_ms())
 Get the start of the day timestamp in seconds.
 
constexpr const ts_t time_shield::day_start_sec (const ts_ms_t &ts_ms=ts_ms())
 Alias for start_of_day_sec function.
 
constexpr const ts_ms_t time_shield::start_of_day_ms (const ts_ms_t &ts_ms=ts_ms())
 Get the start of the day timestamp in milliseconds.
 
constexpr const ts_ms_t time_shield::day_start_ms (const ts_ms_t &ts_ms=ts_ms())
 Alias for start_of_day_ms function.
 
template<class T = int>
constexpr const ts_t time_shield::start_of_next_day (const ts_t &ts, const T &days=1)
 Get timestamp of the first day after a specified number of days.
 
template<class T = int>
constexpr const ts_t time_shield::next_day_start (const ts_t &ts, const T &days=1)
 Alias for start_of_next_day function.
 
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 (const 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 (const 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 (const 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 (const 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 (const T2 &year, const T3 &month, const 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 (const T2 &year, const T3 &month, const 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 (const T2 &year, const T3 &month, const T3 &day)
 Alias for day_of_week_date function.
 
template<class T1 = Weekday, class T2 >
constexpr const T1 time_shield::get_weekday_from_date (const T2 &date)
 Get the day of the week from a date structure.
 
template<class T1 = int, class T2 >
constexpr const T1 time_shield::day_of_week_dt (const T2 &date)
 Alias for get_weekday_from_date function that accepts a date structure.
 
template<class T1 = int, class T2 >
constexpr const T1 time_shield::day_of_week (const T2 &date)
 Alias for get_weekday_from_date function that accepts a date structure.
 
template<class T = Weekday>
constexpr const T time_shield::get_weekday_from_ts (const ts_t &ts) noexcept
 Get the weekday from a timestamp.
 
template<class T = Weekday>
constexpr const T time_shield::day_of_week (const 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 (const 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 (const ts_t &ts=ts())
 Get the timestamp at the start of the current month.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::month_begin (const ts_t &ts=ts())
 Alias for start_of_month function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::end_of_month (const ts_t &ts=ts())
 Get the last timestamp of the current month.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::last_day_of_month (const ts_t &ts=ts())
 Alias for end_of_month function.
 
TIME_SHIELD_CONSTEXPR const ts_t time_shield::last_sunday_of_month (const 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 (const 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 (const T2 &year, const 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 (const T2 &year, const T3 &month)
 Alias for last_sunday_month_day function.
 
constexpr const ts_t time_shield::start_of_hour (const ts_t &ts=ts()) noexcept
 Get the timestamp at the start of the hour.
 
constexpr const ts_t time_shield::hour_begin (const ts_t &ts=ts()) noexcept
 Alias for start_of_hour function.
 
constexpr const ts_t time_shield::start_of_hour_sec (const 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 (const 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 (const 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 (const ts_ms_t &ts_ms=ts_ms()) noexcept
 Alias for start_of_hour_ms function.
 
constexpr const ts_t time_shield::end_of_hour (const 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 (const ts_t &ts=ts()) noexcept
 Alias for end_of_hour function.
 
constexpr const ts_t time_shield::end_of_hour_sec (const 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 (const 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 (const 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 (const 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 (const ts_t &ts=ts()) noexcept
 Get the hour of the day.
 
template<class T = int>
constexpr const T time_shield::hour_in_day (const ts_t &ts=ts()) noexcept
 Alias for hour_of_day function.
 
constexpr const ts_t time_shield::start_of_week (const ts_t &ts=ts())
 Get the timestamp of the beginning of the week.
 
constexpr const ts_t time_shield::week_begin (const ts_t &ts=ts())
 Alias for start_of_week function.
 
constexpr const ts_t time_shield::end_of_week (const ts_t &ts=ts())
 Get the timestamp of the end of the week.
 
constexpr const ts_t time_shield::finish_of_week (const ts_t &ts=ts())
 Alias for end_of_week function.
 
constexpr const ts_t time_shield::start_of_saturday (const ts_t &ts=ts())
 Get the timestamp of the start of Saturday.
 
constexpr const ts_t time_shield::saturday_begin (const ts_t &ts=ts())
 Alias for start_of_saturday function.
 
constexpr const ts_t time_shield::start_of_min (const ts_t &ts=ts()) noexcept
 Get the timestamp of the beginning of the minute.
 
constexpr const ts_t time_shield::min_begin (const ts_t &ts=ts()) noexcept
 Alias for start_of_min function.
 
constexpr const ts_t time_shield::end_of_min (const ts_t &ts=ts()) noexcept
 Get the timestamp of the end of the minute.
 
constexpr const ts_t time_shield::finish_of_min (const ts_t &ts=ts()) noexcept
 Alias for end_of_min function.
 
template<class T = int>
constexpr const T time_shield::min_of_day (const 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 (const 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 (const T &p, const 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 (const T &p, const ts_t &ts=ts())
 Get the timestamp of the end of the period.
 
template<class T = TimeZoneStruct>
const TimeZoneStruct time_shield::to_time_zone (const tz_t &offset)
 Converts an integer to a time zone structure.
 

Detailed Description

Header file for time conversion functions.

This file contains functions for converting between different time representations and performing various time-related calculations.

Definition in file time_conversions.hpp.

Macro Definition Documentation

◆ _TIME_SHIELD_TIME_CONVERSIONS_HPP_INCLUDED

#define _TIME_SHIELD_TIME_CONVERSIONS_HPP_INCLUDED

Definition at line 8 of file time_conversions.hpp.