Represents a specific point in time. Supports UTC/GMT time only.
More...
#include <ssgx_utils_t_time.h>
|
| | DateTime () noexcept |
| | Default constructor, initializes the time to epoch (1970-01-01 00:00:00).
|
| |
| | DateTime (time_t timestamp) noexcept |
| | Constructs a DateTime object from a UNIX timestamp.
|
| |
| | DateTime (int num_year, int num_month, int num_day, int num_hour, int num_min, int num_sec) |
| | Constructs a DateTime object from year, month, day, hour, minute, and second.
|
| |
| DateTime & | operator= (time_t timestamp) noexcept |
| |
| DateTime & | operator+= (TimeSpan span) noexcept |
| |
| DateTime & | operator-= (TimeSpan span) noexcept |
| |
| TimeSpan | operator- (DateTime time) const noexcept |
| |
| DateTime | operator- (TimeSpan span) const noexcept |
| |
| DateTime | operator+ (TimeSpan span) const noexcept |
| |
| bool | operator== (DateTime time) const noexcept |
| |
| bool | operator!= (DateTime time) const noexcept |
| |
| bool | operator< (DateTime time) const noexcept |
| |
| bool | operator> (DateTime time) const noexcept |
| |
| bool | operator<= (DateTime time) const noexcept |
| |
| bool | operator>= (DateTime time) const noexcept |
| |
| time_t | GetTimestamp () const noexcept |
| |
| int | GetYear () const noexcept |
| |
| int | GetMonth () const noexcept |
| |
| int | GetDay () const noexcept |
| |
| int | GetHour () const noexcept |
| |
| int | GetMinute () const noexcept |
| |
| int | GetSecond () const noexcept |
| |
| int | GetDayOfWeek () const noexcept |
| |
| std::string | ToFormatTime () const |
| | Returns the time as a formatted string in "YYYY-MM-DD HH:MM:SS" format.
|
| |
Represents a specific point in time. Supports UTC/GMT time only.
◆ DateTime() [1/3]
| ssgx::utils_t::DateTime::DateTime |
( |
| ) |
|
|
noexcept |
Default constructor, initializes the time to epoch (1970-01-01 00:00:00).
◆ DateTime() [2/3]
| ssgx::utils_t::DateTime::DateTime |
( |
time_t | timestamp | ) |
|
|
explicitnoexcept |
Constructs a DateTime object from a UNIX timestamp.
- Parameters
-
| timestamp | The UNIX timestamp. |
◆ DateTime() [3/3]
| ssgx::utils_t::DateTime::DateTime |
( |
int | num_year, |
|
|
int | num_month, |
|
|
int | num_day, |
|
|
int | num_hour, |
|
|
int | num_min, |
|
|
int | num_sec ) |
Constructs a DateTime object from year, month, day, hour, minute, and second.
- Parameters
-
| num_year | Year. |
| num_month | Month. |
| num_day | Day. |
| num_hour | Hour. |
| num_min | Minute. |
| num_sec | Second. |
◆ FromFormatTime()
| static DateTime ssgx::utils_t::DateTime::FromFormatTime |
( |
const std::string & | formattedTime | ) |
|
|
static |
Constructs a DateTime object from a formatted string. Supports the format "YYYY-MM-DD HH:MM:SS".
- Parameters
-
| formattedTime | A string representation of the time. |
- Returns
- A DateTime object representing the given time.
◆ GetDay()
| int ssgx::utils_t::DateTime::GetDay |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ GetDayOfWeek()
| int ssgx::utils_t::DateTime::GetDayOfWeek |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ GetHour()
| int ssgx::utils_t::DateTime::GetHour |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ GetMinute()
| int ssgx::utils_t::DateTime::GetMinute |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ GetMonth()
| int ssgx::utils_t::DateTime::GetMonth |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ GetSecond()
| int ssgx::utils_t::DateTime::GetSecond |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ GetTimestamp()
| time_t ssgx::utils_t::DateTime::GetTimestamp |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ GetYear()
| int ssgx::utils_t::DateTime::GetYear |
( |
| ) |
const |
|
nodiscardnoexcept |
◆ Now()
| static DateTime ssgx::utils_t::DateTime::Now |
( |
| ) |
|
|
static |
Returns the current system time as a DateTime object.
- Exceptions
-
| runtime_error | Throw the exception if the ssgx_ocall_time call fails or the time verification fails. |
- Returns
- The current time.
◆ operator!=()
| bool ssgx::utils_t::DateTime::operator!= |
( |
DateTime | time | ) |
const |
|
noexcept |
◆ operator+()
◆ operator+=()
◆ operator-() [1/2]
◆ operator-() [2/2]
◆ operator-=()
◆ operator<()
| bool ssgx::utils_t::DateTime::operator< |
( |
DateTime | time | ) |
const |
|
noexcept |
◆ operator<=()
| bool ssgx::utils_t::DateTime::operator<= |
( |
DateTime | time | ) |
const |
|
noexcept |
◆ operator=()
| DateTime & ssgx::utils_t::DateTime::operator= |
( |
time_t | timestamp | ) |
|
|
noexcept |
◆ operator==()
| bool ssgx::utils_t::DateTime::operator== |
( |
DateTime | time | ) |
const |
|
noexcept |
◆ operator>()
| bool ssgx::utils_t::DateTime::operator> |
( |
DateTime | time | ) |
const |
|
noexcept |
◆ operator>=()
| bool ssgx::utils_t::DateTime::operator>= |
( |
DateTime | time | ) |
const |
|
noexcept |
◆ ToFormatTime()
| std::string ssgx::utils_t::DateTime::ToFormatTime |
( |
| ) |
const |
|
nodiscard |
Returns the time as a formatted string in "YYYY-MM-DD HH:MM:SS" format.
- Returns
- A formatted string representation of the time.
- Exceptions
-
| std::invalid_argument("Unexpected | exception: int ret = __secs_to_tm(timestamp_, &t);") |
The documentation for this class was generated from the following file: