3#ifndef TIME_SHIELD_HEADER_CONVERSIONS_TIME_CONVERSION_ALIASES_HPP_INCLUDED
4#define TIME_SHIELD_HEADER_CONVERSIONS_TIME_CONVERSION_ALIASES_HPP_INCLUDED
22 template<
class T = year_t>
29 template<
class T = year_t>
40 template<
class T = dse_t>
49 template<
class T = dse_t>
58 template<
class T = dse_t>
67 template<
class T = dse_t>
76 template<
class T = dse_t>
87 template<
class T = dse_t>
96 template<
class T = dse_t>
105 template<
class T = dse_t>
114 template<
class T = dse_t>
123 template<
class T = dse_t>
132 template<
class T = ts_t>
139 template<
class T = ts_t>
146 template<
class T = ts_t>
153 template<
class T = ts_t>
162 template<
class T = ts_t>
169 template<
class T = ts_ms_t>
176 template<
class T = ts_t>
183 template<
class T = ts_t>
192 template<
class T = ts_t>
201 template<
class T = ts_ms_t>
210 template<
class T =
int64_t>
217 template<
class T =
int64_t>
224 template<
class T =
int64_t>
231 template<
class T =
int64_t>
242 TIME_SHIELD_CONSTEXPR
inline auto dt_to_ts(
const T& date_time)
250 TIME_SHIELD_CONSTEXPR
inline auto tm_to_ts(
const std::tm* timeinfo)
259 template<
class T =
int>
269 template<
class T1,
class T2 = ts_t>
277 template<
class T1,
class T2 = ts_t>
399 TIME_SHIELD_CONSTEXPR
inline ts_t ts(
year_t year,
int month,
int day,
int hour,
int min,
int sec) {
738 const T& date_time) {
747 const T& date_time) {
756 const T& date_time) {
765 const T& date_time) {
773 TIME_SHIELD_CONSTEXPR
inline ts_t ts(
const std::tm* timeinfo) {
779 TIME_SHIELD_CONSTEXPR
inline ts_t get_ts(
const std::tm* timeinfo) {
797 TIME_SHIELD_CONSTEXPR
inline ts_t to_ts(
const std::tm* timeinfo) {
1297 const T& date_time) {
1315 const T& date_time) {
1324 const T& date_time) {
1333 const T& date_time) {
1342 const std::tm *timeinfo) {
1348 TIME_SHIELD_CONSTEXPR
inline auto tm_to_ts_ms(
const std::tm *timeinfo)
1356 const std::tm *timeinfo) {
1363 const std::tm *timeinfo) {
1370 const std::tm *timeinfo) {
1395 template<
class T1 = year_t,
class T2 =
int,
class T3 =
int>
1396 TIME_SHIELD_CONSTEXPR
fts_t to_fts(T1
year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1419 template<
class T1 = year_t,
class T2 =
int,
class T3 =
int>
1420 TIME_SHIELD_CONSTEXPR
fts_t fts(T1
year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1443 template<
class T1 = year_t,
class T2 =
int,
class T3 =
int>
1444 TIME_SHIELD_CONSTEXPR
fts_t ftimestamp(T1
year, T2 month, T2 day, T2 hour = 0, T2 min = 0, T2 sec = 0, T3 ms = 0) {
1503 TIME_SHIELD_CONSTEXPR
inline auto tm_to_fts(
const std::tm* timeinfo)
1518 TIME_SHIELD_CONSTEXPR
inline fts_t fts(
const std::tm* timeinfo) {
1533 template<
class T =
int>
1540 template<
class T =
int>
1547 template<
class T =
int>
1554 template<
class T =
int>
1563 template<
class T = year_t>
1570 template<
class T = year_t>
1579 template<
class T = year_t>
1586 template<
class T = year_t>
1623 template<
class T = year_t>
1630 template<
class T = year_t>
1639 template<
class T = year_t>
1646 template<
class T = year_t>
1673 template<
class T1 =
int,
class T2 = year_t,
class T3 =
int>
1682 template<
class T1 =
int>
1689 template<
class T1 =
int>
1698 template<
class T1 =
int,
class T2 = year_t>
1707 template<
class T =
int>
1724 template<
class T =
int>
1755 template<
class T =
int>
1764 template<
class T =
int>
1797 template<
class T1 = Weekday>
1804 template<
class T1 = Weekday>
1811 template<
class T1 = Weekday>
1818 template<
class T1 = Weekday>
1825 template<
class T1 = Weekday>
1832 template<
class T1 = Weekday>
1839 template<
class T1 = Weekday>
1846 template<
class T1 = Weekday>
1856 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value,
int>::type = 0>
1857 TIME_SHIELD_CONSTEXPR T1
get_dow(
const T2& date) {
1864 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value,
int>::type = 0>
1872 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value,
int>::type = 0>
1880 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value,
int>::type = 0>
1888 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value,
int>::type = 0>
1896 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value,
int>::type = 0>
1897 TIME_SHIELD_CONSTEXPR T1
dow(
const T2& date) {
1904 template<class T1 = Weekday, class T2, typename std::enable_if<std::is_class<T2>::value,
int>::type = 0>
1905 TIME_SHIELD_CONSTEXPR T1
wd(
const T2& date) {
1914 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value,
int>::type = 0>
1921 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value,
int>::type = 0>
1928 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value,
int>::type = 0>
1937 template<class T = Weekday, class U, typename std::enable_if<std::is_integral<U>::value,
int>::type = 0>
1946 template<
class T = Weekday>
1953 template<
class T = Weekday>
1986 template<
class T1 =
int,
class T2 = year_t,
class T3 =
int>
2043 template<
class T =
int>
TIME_SHIELD_CONSTEXPR T diff_in_days(ts_t start, ts_t stop) noexcept
Alias for days_between function.
TIME_SHIELD_CONSTEXPR ts_t day_end_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_day_sec function.
TIME_SHIELD_CONSTEXPR T start_of_day_from_unix_day_ms(dse_t unix_day) noexcept
Alias for unix_day_to_ts_ms function.
TIME_SHIELD_CONSTEXPR T1 ms_to_sec(T2 ts_ms) noexcept
Converts a timestamp from milliseconds to seconds.
TIME_SHIELD_CONSTEXPR T unix_day(ts_t ts=time_shield::ts()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR T start_of_day_from_unix_day(dse_t unix_day) noexcept
Alias for unix_day_to_ts function.
TIME_SHIELD_CONSTEXPR T to_unix_year(ts_t ts) noexcept
Alias for years_since_epoch function.
TIME_SHIELD_CONSTEXPR ts_ms_t finish_of_hour_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_hour_ms function.
TIME_SHIELD_CONSTEXPR ts_t start_day_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_sec function.
TIME_SHIELD_CONSTEXPR T dse_to_ts(dse_t unix_day) noexcept
Short alias for unix_day_to_ts.
TIME_SHIELD_CONSTEXPR ts_ms_t year_begin_date_ms(T year)
Alias for start_of_year_date_ms function.
ts_ms_t year_start_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for start_of_year_ms function.
TIME_SHIELD_CONSTEXPR ts_ms_t get_ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
TIME_SHIELD_CONSTEXPR T unixday_to_ts_ms(dse_t unix_day) noexcept
Alias for unix_day_to_ts_ms function.
TIME_SHIELD_CONSTEXPR ts_t finish_of_hour(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_hour function.
TIME_SHIELD_CONSTEXPR bool workday(ts_t ts) noexcept
Alias for is_workday(ts_t).
TIME_SHIELD_CONSTEXPR ts_t day_start_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_sec function.
TIME_SHIELD_CONSTEXPR T unix_year(ts_t ts) noexcept
Alias for years_since_epoch function.
TIME_SHIELD_CONSTEXPR T days_in_year_ts(ts_t ts=time_shield::ts())
Alias for num_days_in_year_ts function.
TIME_SHIELD_CONSTEXPR T1 get_weekday(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR ts_t day_start(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_day function.
TIME_SHIELD_CONSTEXPR T get_unixday(ts_t ts=time_shield::ts()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR ts_t min_begin(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_min function.
TIME_SHIELD_CONSTEXPR bool is_valid_tz_offset(tz_t off) noexcept
Check if a numeric offset is within supported bounds.
TIME_SHIELD_CONSTEXPR T1 day_of_week_dt(const T2 &date)
Alias for weekday_of_date.
TIME_SHIELD_CONSTEXPR T day_of_week_ms(ts_ms_t ts_ms)
Alias for weekday_of_ts_ms function.
TIME_SHIELD_CONSTEXPR ts_t year_begin_date(T year)
Alias for start_of_year_date function.
TIME_SHIELD_CONSTEXPR T uday(ts_t ts=time_shield::ts()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR ts_t saturday_begin(ts_t ts=time_shield::ts())
Alias for start_of_saturday function.
TIME_SHIELD_CONSTEXPR fts_t to_fts(T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
Alias for to_ftimestamp.
TIME_SHIELD_CONSTEXPR T1 num_days_in_year(T2 year) noexcept
Get the number of days in a year.
TIME_SHIELD_CONSTEXPR T1 day_of_week_date(T2 year, T3 month, T4 day)
Get the day of the week.
TIME_SHIELD_CONSTEXPR ts_ms_t year_start_date_ms(T year)
Alias for start_of_year_date_ms function.
TIME_SHIELD_CONSTEXPR T to_year(ts_t ts=time_shield::ts())
Alias for year_of function.
TIME_SHIELD_CONSTEXPR T wd_ms(ts_ms_t ts_ms)
Alias for weekday_of_ts_ms function.
TIME_SHIELD_CONSTEXPR T hour24_to_12(T hour) noexcept
Converts a 24-hour format hour to a 12-hour format.
TIME_SHIELD_CONSTEXPR tz_t offset_hm(int hour, int min=0) noexcept
Alias for tz_offset_hm.
TIME_SHIELD_CONSTEXPR ts_t year_begin(ts_t ts=time_shield::ts())
Alias for start_of_year function.
TIME_SHIELD_CONSTEXPR ts_ms_t day_start_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_day_ms function.
TIME_SHIELD_CONSTEXPR auto tm_to_ts_ms(const std::tm *timeinfo) -> decltype(tm_to_timestamp_ms(timeinfo))
Alias for tm_to_timestamp_ms function.
TIME_SHIELD_CONSTEXPR T1 weekday_of_date(const T2 &date)
Get the day of the week from a date structure.
TIME_SHIELD_CONSTEXPR ts_t to_ts(year_t year, int month, int day)
Alias for to_timestamp.
TIME_SHIELD_CONSTEXPR auto dt_to_ts_ms(const T &date_time) -> decltype(dt_to_timestamp_ms(date_time))
Alias for dt_to_timestamp_ms function.
T to_dt_struct_ms(ts_ms_t ts)
Alias for to_date_time_ms function.
TIME_SHIELD_CONSTEXPR ts_t hour_begin(ts_t ts=time_shield::ts()) noexcept
Alias for start_of_hour function.
TIME_SHIELD_CONSTEXPR ts_t final_sunday_of_month(ts_t ts=time_shield::ts())
Alias for last_sunday_of_month function.
TIME_SHIELD_CONSTEXPR T days(ts_t start, ts_t stop) noexcept
Alias for days_between function.
TIME_SHIELD_CONSTEXPR T uday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR ts_ms_t hour_begin_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_hour_ms function.
TIME_SHIELD_CONSTEXPR T unixday_to_ts(dse_t unix_day) noexcept
Alias for unix_day_to_ts function.
TIME_SHIELD_CONSTEXPR T1 days_in_year(T2 year) noexcept
Alias for num_days_in_year function.
TIME_SHIELD_CONSTEXPR ts_t next_day_start(ts_t ts, T days=1) noexcept
Alias for start_of_next_day function.
TIME_SHIELD_CONSTEXPR bool valid_tz_offset(tz_t off) noexcept
Alias for is_valid_tz_offset.
TIME_SHIELD_CONSTEXPR T umin(ts_t ts=time_shield::ts())
Alias for min_since_epoch function.
TIME_SHIELD_CONSTEXPR T get_days_difference(ts_t start, ts_t stop) noexcept
Alias for days_between function.
T1 to_dt_struct(T2 ts)
Alias for to_date_time function.
TIME_SHIELD_CONSTEXPR ts_t year_start_date(T year)
Alias for start_of_year_date function.
TIME_SHIELD_CONSTEXPR ts_t get_ts(year_t year, int month, int day)
Alias for to_timestamp.
TIME_SHIELD_CONSTEXPR T1 weekday(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR ts_t last_day_of_month(ts_t ts=time_shield::ts())
Alias for end_of_month function.
TIME_SHIELD_CONSTEXPR ts_t year_start(ts_t ts=time_shield::ts())
Alias for start_of_year function.
TIME_SHIELD_CONSTEXPR T hour_in_day(ts_t ts=time_shield::ts()) noexcept
Alias for hour_of_day function.
TIME_SHIELD_CONSTEXPR ts_t hour_begin_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for start_of_hour_sec function.
TIME_SHIELD_CONSTEXPR auto tm_to_fts(const std::tm *timeinfo) -> decltype(tm_to_ftimestamp(timeinfo))
Alias for tm_to_ftimestamp.
TIME_SHIELD_CONSTEXPR T get_dow_from_ts(U ts) noexcept
Alias for weekday_of_ts.
TIME_SHIELD_CONSTEXPR ts_t previous_day_start(ts_t ts=time_shield::ts(), T days=1) noexcept
Alias for start_of_prev_day function.
TIME_SHIELD_CONSTEXPR ts_t get_timestamp(year_t year, int month, int day)
Alias for to_timestamp.
T to_dt_ms(ts_ms_t ts)
Alias for to_date_time_ms function.
TIME_SHIELD_CONSTEXPR ts_ms_t year_end_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for end_of_year_ms function.
TIME_SHIELD_CONSTEXPR ts_t finish_of_hour_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_hour_sec function.
TIME_SHIELD_CONSTEXPR tz_t tz_offset_hm(int hour, int min=0) noexcept
Build offset in seconds from hours/minutes.
TIME_SHIELD_CONSTEXPR T1 dow_from_date(const T2 &date)
Alias for weekday_of_date.
TIME_SHIELD_CONSTEXPR T1 dow(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR ts_t finish_of_min(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_min function.
TIME_SHIELD_CONSTEXPR ts_ms_t day_end_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Alias for end_of_day_ms function.
TIME_SHIELD_CONSTEXPR T minutes_since_epoch(ts_t ts=time_shield::ts())
Alias for min_since_epoch function.
TIME_SHIELD_CONSTEXPR tz_t tz_offset(const T &tz) noexcept
Alias for to_tz_offset.
TIME_SHIELD_CONSTEXPR T dse(ts_t ts=time_shield::ts()) noexcept
Short alias for days_since_epoch.
TIME_SHIELD_CONSTEXPR T unixday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR T unixday(ts_t ts=time_shield::ts()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR T1 final_sunday_month_day(T2 year, T3 month)
Alias for last_sunday_month_day function.
TIME_SHIELD_CONSTEXPR ts_t ts_from_tm(const std::tm *timeinfo)
Alias for tm_to_timestamp.
TIME_SHIELD_CONSTEXPR T1 weekday_of(const T2 &date)
Alias for weekday_of_date.
TIME_SHIELD_CONSTEXPR T get_days(ts_t start, ts_t stop) noexcept
Alias for days_between function.
TIME_SHIELD_CONSTEXPR T num_days_in_year_ts(ts_t ts=time_shield::ts())
Get the number of days in the current year.
TIME_SHIELD_CONSTEXPR T year_of_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Get the year from the timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR ts_ms_t to_ts_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
TIME_SHIELD_CONSTEXPR T dow_ts(U ts) noexcept
Alias for weekday_of_ts.
TIME_SHIELD_CONSTEXPR T next_day_from_unix_day_ms(dse_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day_ms function.
TIME_SHIELD_CONSTEXPR ts_ms_t next_day_start_ms(ts_ms_t ts_ms, T days=1) noexcept
Alias for start_of_next_day_ms function.
TIME_SHIELD_CONSTEXPR T dse_to_ts_ms(dse_t unix_day) noexcept
Short alias for unix_day_to_ts_ms.
TIME_SHIELD_CONSTEXPR bool workday_ms(ts_ms_t ts_ms) noexcept
Alias for is_workday(ts_ms_t).
TIME_SHIELD_CONSTEXPR T uday_to_ts_ms(dse_t unix_day) noexcept
Alias for unix_day_to_ts_ms function.
TIME_SHIELD_CONSTEXPR T1 day_of_week(year_t year, int month, int day)
Alias for day_of_week_date.
TIME_SHIELD_CONSTEXPR ts_t week_begin(ts_t ts=time_shield::ts())
Alias for start_of_week function.
TIME_SHIELD_CONSTEXPR ts_t finish_of_week(ts_t ts=time_shield::ts())
Alias for end_of_week function.
TIME_SHIELD_CONSTEXPR T1 days_in_month(T2 year, T3 month) noexcept
Alias for num_days_in_month function.
TIME_SHIELD_CONSTEXPR T1 get_dow(const T2 &date)
Alias for weekday_of_date.
constexpr auto dt_to_fts(const T &date_time) -> decltype(dt_to_ftimestamp(date_time))
Alias for dt_to_ftimestamp.
ts_ms_t year_begin_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for start_of_year_ms function.
TIME_SHIELD_CONSTEXPR ts_t year_end(ts_t ts=time_shield::ts())
Alias for end_of_year function.
TIME_SHIELD_CONSTEXPR T unix_day_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR auto dt_to_ts(const T &date_time) -> decltype(dt_to_timestamp(date_time))
Alias for dt_to_timestamp.
TIME_SHIELD_CONSTEXPR T year(ts_t ts=time_shield::ts())
Alias for year_of function.
TIME_SHIELD_CONSTEXPR T1 wd(const T2 &date)
Alias for weekday_of_date.
TIME_SHIELD_CONSTEXPR T to_unix_min(ts_t ts=time_shield::ts())
Alias for min_since_epoch function.
TIME_SHIELD_CONSTEXPR ts_t day_end(ts_t ts=time_shield::ts()) noexcept
Alias for end_of_day function.
TIME_SHIELD_CONSTEXPR T unix_min(ts_t ts=time_shield::ts())
Alias for min_since_epoch function.
TIME_SHIELD_CONSTEXPR T dse_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Short alias for days_since_epoch_ms.
T1 to_dt(T2 ts)
Alias for to_date_time function.
TIME_SHIELD_CONSTEXPR T wd_ts(U ts) noexcept
Alias for weekday_of_ts.
TIME_SHIELD_CONSTEXPR ts_t month_begin(ts_t ts=time_shield::ts())
Alias for start_of_month function.
TIME_SHIELD_CONSTEXPR T year_of(ts_t ts=time_shield::ts())
Get the year from the timestamp.
TIME_SHIELD_CONSTEXPR T h24_to_h12(T hour) noexcept
Alias for hour24_to_12 function.
TIME_SHIELD_CONSTEXPR tz_t to_tz_offset(const T &tz) noexcept
Convert time zone struct to offset in seconds.
TIME_SHIELD_CONSTEXPR T uday_to_ts(dse_t unix_day) noexcept
Alias for unix_day_to_ts function.
TIME_SHIELD_CONSTEXPR T next_day_from_unix_day(dse_t unix_day) noexcept
Alias for start_of_next_day_from_unix_day function.
TIME_SHIELD_CONSTEXPR auto tm_to_ts(const std::tm *timeinfo) -> decltype(tm_to_timestamp(timeinfo))
Alias for tm_to_timestamp.
TIME_SHIELD_CONSTEXPR ts_ms_t get_timestamp_ms(year_t year, int month, int day)
Alias for to_timestamp_ms.
TIME_SHIELD_CONSTEXPR T to_year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for year_of_ms function.
TIME_SHIELD_CONSTEXPR T get_unixday_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Alias for days_since_epoch function.
TIME_SHIELD_CONSTEXPR T year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Alias for year_of_ms function.
TIME_SHIELD_CONSTEXPR ts_t tm_to_timestamp(const std::tm *timeinfo)
Converts a std::tm structure to a timestamp.
TIME_SHIELD_CONSTEXPR ts_ms_t 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.
TIME_SHIELD_CONSTEXPR fts_t dt_to_ftimestamp(const T &date_time)
Converts a date-time structure to a floating-point timestamp.
TIME_SHIELD_CONSTEXPR ts_t 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.
TIME_SHIELD_CONSTEXPR fts_t tm_to_ftimestamp(const std::tm *timeinfo)
Converts a std::tm structure to a floating-point timestamp.
TIME_SHIELD_CONSTEXPR ts_t end_of_hour(ts_t ts=time_shield::ts()) noexcept
Get the timestamp at the end of the hour.
TIME_SHIELD_CONSTEXPR T weekday_of_ts(ts_t ts) noexcept
Get the second of the week day from a timestamp.
TIME_SHIELD_CONSTEXPR ts_t start_of_min(ts_t ts=time_shield::ts()) noexcept
Get the timestamp of the beginning of the minute.
TIME_SHIELD_CONSTEXPR T hour_of_day(ts_t ts=time_shield::ts()) noexcept
Get hour of day. This function returns a value between 0 to 23.
TIME_SHIELD_CONSTEXPR ts_t start_of_hour(ts_t ts=time_shield::ts()) noexcept
Get the timestamp at the start of the hour.
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Get the timestamp in milliseconds of the end of the year.
T to_date_time_ms(ts_ms_t ts)
Converts a timestamp in milliseconds to a date-time structure with milliseconds.
TIME_SHIELD_CONSTEXPR ts_t end_of_min(ts_t ts=time_shield::ts()) noexcept
Get the timestamp of the end of the minute.
TIME_SHIELD_CONSTEXPR T1 last_sunday_month_day(T2 year, T3 month)
Get the day of the last Sunday of the given month and year.
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_hour_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the start of the hour. This function sets the minute and second to zero.
TIME_SHIELD_CONSTEXPR ts_t end_of_year(ts_t ts=time_shield::ts())
Get the end-of-year timestamp.
TIME_SHIELD_CONSTEXPR ts_t end_of_hour_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the hour in seconds.
TIME_SHIELD_CONSTEXPR ts_t start_of_year(ts_t ts) noexcept
Get the start of the year timestamp.
TIME_SHIELD_CONSTEXPR ts_t start_of_day(ts_t ts=time_shield::ts()) noexcept
Get the start of the day timestamp.
TIME_SHIELD_CONSTEXPR ts_t tm_to_timestamp_ms(const std::tm *timeinfo)
Converts a std::tm structure to a timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR ts_t start_of_month(ts_t ts=time_shield::ts())
Get the timestamp at the start of the current month.
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_hour_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the hour in milliseconds.
TIME_SHIELD_CONSTEXPR ts_ms_t dt_to_timestamp_ms(const T &date_time)
Converts a date-time structure to a timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR ts_t dt_to_timestamp(const T &date_time)
Converts a date-time structure to a timestamp.
TIME_SHIELD_CONSTEXPR T1 num_days_in_month_ts(ts_t ts=time_shield::ts()) noexcept
Get the number of days in the month of the given timestamp.
TIME_SHIELD_CONSTEXPR ts_t end_of_day_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the day in seconds.
TIME_SHIELD_CONSTEXPR fts_t 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.
TIME_SHIELD_CONSTEXPR ts_t start_of_hour_sec(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the start of the hour.
TIME_SHIELD_CONSTEXPR ts_t end_of_month(ts_t ts=time_shield::ts())
Get the last timestamp of the current month.
TIME_SHIELD_CONSTEXPR ts_t start_of_week(ts_t ts=time_shield::ts())
Get the timestamp of the beginning of the week.
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_year_ms(ts_ms_t ts_ms=time_shield::ts_ms())
Get the timestamp at the start of the year in milliseconds.
TIME_SHIELD_CONSTEXPR ts_t start_of_saturday(ts_t ts=time_shield::ts())
Get the timestamp of the start of Saturday.
TIME_SHIELD_CONSTEXPR ts_t 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.
TIME_SHIELD_CONSTEXPR ts_t last_sunday_of_month(ts_t ts=time_shield::ts())
Get the timestamp of the last Sunday of the current month.
TIME_SHIELD_CONSTEXPR ts_t start_of_year_date(T year)
Get the timestamp of the start of the year.
T1 to_date_time(T2 ts)
Converts a timestamp to a date-time structure.
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_day_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the timestamp at the end of the day in milliseconds.
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_day_ms(ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
Get the start of the day timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR T1 num_days_in_month(T2 year, T3 month) noexcept
Get the number of days in a month.
TIME_SHIELD_CONSTEXPR ts_t end_of_week(ts_t ts=time_shield::ts())
Get the timestamp of the end of the week.
TIME_SHIELD_CONSTEXPR ts_t start_of_prev_day(ts_t ts=time_shield::ts(), T days=1) noexcept
Get timestamp of the start of the previous day.
TIME_SHIELD_CONSTEXPR ts_t end_of_day(ts_t ts=time_shield::ts()) noexcept
Get the timestamp at the end of the day.
TIME_SHIELD_CONSTEXPR T weekday_of_ts_ms(ts_ms_t ts_ms)
Get the weekday from a timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_year_date_ms(T year)
Get the timestamp in milliseconds of the start of the year.
TIME_SHIELD_CONSTEXPR ts_ms_t to_timestamp_ms(T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T2 ms=0)
Converts a date-time structure to a timestamp in milliseconds.
int64_t ts_t
Unix timestamp in seconds since 1970‑01‑01T00:00:00Z.
int64_t dse_t
Unix day count since 1970‑01‑01 (days since epoch).
int32_t tz_t
Time zone offset in minutes from UTC (e.g., +180 = UTC+3).
int64_t ts_ms_t
Unix timestamp in milliseconds since epoch.
double fts_t
Floating-point timestamp (fractional seconds since epoch).
int64_t year_t
Year as an integer (e.g., 2024).
ts_t ts() noexcept
Get the current UTC timestamp in seconds.
ts_t timestamp() noexcept
Get the current UTC timestamp in seconds.
fts_t ftimestamp() noexcept
Get the current UTC timestamp in floating-point seconds.
ts_ms_t ts_ms() noexcept
Get the current UTC timestamp in milliseconds.
ts_ms_t timestamp_ms() noexcept
Get the current UTC timestamp in milliseconds.
fts_t fts() noexcept
Get the current UTC timestamp in floating-point seconds.
TIME_SHIELD_CONSTEXPR bool is_workday(ts_t ts) noexcept
Check if a given timestamp corresponds to a workday (Monday to Friday).
TIME_SHIELD_CONSTEXPR bool is_workday_ms(ts_ms_t ts_ms) noexcept
Check if a given timestamp in milliseconds corresponds to a workday (Monday to Friday).
Main namespace for the Time Shield library.
TIME_SHIELD_CONSTEXPR T unix_day_to_ts_ms(dse_t unix_day) noexcept
Converts a UNIX day to a timestamp in milliseconds.
TIME_SHIELD_CONSTEXPR T years_since_epoch(ts_t ts) noexcept
Converts a UNIX timestamp to a year.
TIME_SHIELD_CONSTEXPR T unix_day_to_ts(dse_t unix_day) noexcept
Converts a UNIX day to a timestamp in seconds.
TIME_SHIELD_CONSTEXPR T days_since_epoch_ms(ts_ms_t t_ms=time_shield::ts_ms()) noexcept
Get UNIX day from milliseconds timestamp.
TIME_SHIELD_CONSTEXPR T start_of_next_day_from_unix_day(dse_t unix_day) noexcept
Converts a UNIX day to a timestamp representing the start of the next day in seconds.
TIME_SHIELD_CONSTEXPR T days_since_epoch(ts_t ts=time_shield::ts()) noexcept
Get UNIX day.
TIME_SHIELD_CONSTEXPR T min_since_epoch(ts_t ts=time_shield::ts())
Get UNIX minute.
TIME_SHIELD_CONSTEXPR T start_of_next_day_from_unix_day_ms(dse_t unix_day) noexcept
Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.
TIME_SHIELD_CONSTEXPR T days_between(ts_t start, ts_t stop) noexcept
Get the number of days between two timestamps.