|
Time Shield Library
C++ library for working with time
|
Functions | |
| template<class T1 = DateTimeStruct, class T2 = ts_t> | |
| T1 | to_date_time (T2 ts) |
| Converts a timestamp to a date-time structure. | |
| template<class T1 = year_t, class T2 = int> | |
| 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. | |
| template<class T1 = year_t, class T2 = int> | |
| TIME_SHIELD_CONSTEXPR ts_t | to_timestamp_unchecked (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0) noexcept |
| Converts a date and time to a timestamp without validation. | |
| template<class T = year_t> | |
| TIME_SHIELD_CONSTEXPR T | years_since_epoch (ts_t ts) noexcept |
| Converts a UNIX timestamp to a year. | |
| template<class Year, class Month, class Day> | |
| TIME_SHIELD_CONSTEXPR dse_t | date_to_unix_day (Year year, Month month, Day day) noexcept |
| Convert a calendar date to UNIX day count. | |
|
inlinenoexcept |
Convert a calendar date to UNIX day count.
Calculates the number of days since the UNIX epoch (January 1, 1970) for the provided calendar date components.
| Year | Type of the year component. |
| Month | Type of the month component. |
| Day | Type of the day component. |
| year | Year component of the date. |
| month | Month component of the date. |
| day | Day component of the date. |
Definition at line 89 of file unix_time_conversions.hpp.
|
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).
If the day is ≥ 1970 and year ≤ 31, parameters are assumed to be in DD-MM-YYYY order and are automatically reordered.
| T1 | The type of the year parameter (default is int64_t). |
| T2 | The type of the other date and time parameters (default is int). |
| year | The year value. |
| month | The month value. |
| day | The day value. |
| hour | The hour value (default is 0). |
| min | The minute value (default is 0). |
| sec | The second value (default is 0). |
| std::invalid_argument | if the date-time combination is invalid. |
These aliases are macro-generated and behave identically to to_timestamp.
Definition at line 233 of file date_time_conversions.hpp.
|
inlinenoexcept |
Converts a date and time to a timestamp without validation.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
If the day is ≥ 1970 and year ≤ 31, parameters are assumed to be in DD-MM-YYYY order and are automatically reordered.
| T1 | The type of the year parameter (default is int64_t). |
| T2 | The type of the other date and time parameters (default is int). |
| year | The year value. |
| month | The month value. |
| day | The day value. |
| hour | The hour value (default is 0). |
| min | The minute value (default is 0). |
| sec | The second value (default is 0). |
Definition at line 306 of file date_time_conversions.hpp.
|
noexcept |
Converts a UNIX timestamp to a year.
| T | The type of the year (default is year_t). |
| ts | UNIX timestamp. |
Definition at line 28 of file unix_time_conversions.hpp.