|
| 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.
|
| |
template<class T1 = year_t, class T2 = int>
| TIME_SHIELD_CONSTEXPR ts_t time_shield::legacy::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).
If the day is ≥ 1970 and year ≤ 31, parameters are assumed to be in DD-MM-YYYY order and are automatically reordered.
- Template Parameters
-
| T1 | The type of the year parameter (default is int64_t). |
| T2 | The type of the other date and time parameters (default is int). |
- Parameters
-
| 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). |
- Returns
- Timestamp representing the given date and time.
- Exceptions
-
| std::invalid_argument | if the date-time combination is invalid. |
- Aliases:
- The following function names are provided as aliases:
ts(...)
get_ts(...)
get_timestamp(...)
timestamp(...)
to_ts(...)
These aliases are macro-generated and behave identically to to_timestamp.
- See also
- ts()
-
get_ts()
-
get_timestamp()
-
timestamp()
-
to_ts()
Definition at line 233 of file date_time_conversions.hpp.
template<class T1 = year_t, class T2 = int>
| TIME_SHIELD_CONSTEXPR ts_t time_shield::legacy::to_timestamp_unchecked |
( |
T1 | year, |
|
|
T2 | month, |
|
|
T2 | day, |
|
|
T2 | hour = 0, |
|
|
T2 | min = 0, |
|
|
T2 | sec = 0 ) |
|
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.
- Template Parameters
-
| T1 | The type of the year parameter (default is int64_t). |
| T2 | The type of the other date and time parameters (default is int). |
- Parameters
-
| 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). |
- Returns
- Timestamp representing the given date and time.
Definition at line 306 of file date_time_conversions.hpp.