SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::DateTime Struct Reference

A structure holding a calendar date and time broken down into its components. More...

Inheritance diagram for SDL::DateTime:
[legend]

Public Member Functions

constexpr DateTime (const DateTimeRaw &dateTime={}) noexcept
 Wraps DateTime.
constexpr DateTime (int year, int month, int day, int hour, int minute, int second, int nanosecond, int day_of_week, int utc_offset) noexcept
 Constructs from its fields.
 DateTime (Time ticks, bool localTime=true)
 Converts an Time in nanoseconds since the epoch to a calendar time in the DateTime format.
constexpr operator bool () const noexcept
 Check if valid.
constexpr int GetYear () const noexcept
 Get the year.
constexpr DateTimeSetYear (int newYear) noexcept
 Set the year.
constexpr int GetMonth () const noexcept
 Get the month.
constexpr DateTimeSetMonth (int newMonth) noexcept
 Set the month.
constexpr int GetDay () const noexcept
 Get the day.
constexpr DateTimeSetDay (int newDay) noexcept
 Set the day.
constexpr int GetHour () const noexcept
 Get the hour.
constexpr DateTimeSetHour (int newHour) noexcept
 Set the hour.
constexpr int GetMinute () const noexcept
 Get the minute.
constexpr DateTimeSetMinute (int newMinute) noexcept
 Set the minute.
constexpr int GetSecond () const noexcept
 Get the second.
constexpr DateTimeSetSecond (int newSecond) noexcept
 Set the second.
constexpr int GetNanosecond () const noexcept
 Get the nanosecond.
constexpr DateTimeSetNanosecond (int newNanosecond) noexcept
 Set the nanosecond.
constexpr int GetDay_of_week () const noexcept
 Get the day_of_week.
constexpr DateTimeSetDay_of_week (int newDay_of_week) noexcept
 Set the day_of_week.
constexpr int GetUtc_offset () const noexcept
 Get the utc_offset.
constexpr DateTimeSetUtc_offset (int newUtc_offset) noexcept
 Set the utc_offset.
 operator Time () const
 Converts a calendar time to an Time in nanoseconds since the epoch.

Detailed Description

A structure holding a calendar date and time broken down into its components.

Since
This struct is available since SDL 3.2.0.

Constructor & Destructor Documentation

◆ DateTime() [1/2]

SDL::DateTime::DateTime ( const DateTimeRaw & dateTime = {})
inlineconstexprnoexcept

Wraps DateTime.

Parameters
dateTimethe value to be wrapped

◆ DateTime() [2/2]

SDL::DateTime::DateTime ( int year,
int month,
int day,
int hour,
int minute,
int second,
int nanosecond,
int day_of_week,
int utc_offset )
inlineconstexprnoexcept

Constructs from its fields.

Parameters
yearthe value for year.
monththe value for month.
daythe value for day.
hourthe value for hour.
minutethe value for minute.
secondthe value for second.
nanosecondthe value for nanosecond.
day_of_weekthe value for day_of_week.
utc_offsetthe value for utc_offset.

Member Function Documentation

◆ GetDay()

int SDL::DateTime::GetDay ( ) const
inlineconstexprnoexcept

Get the day.

Returns
current day value.

◆ GetDay_of_week()

int SDL::DateTime::GetDay_of_week ( ) const
inlineconstexprnoexcept

Get the day_of_week.

Returns
current day_of_week value.

◆ GetHour()

int SDL::DateTime::GetHour ( ) const
inlineconstexprnoexcept

Get the hour.

Returns
current hour value.

◆ GetMinute()

int SDL::DateTime::GetMinute ( ) const
inlineconstexprnoexcept

Get the minute.

Returns
current minute value.

◆ GetMonth()

int SDL::DateTime::GetMonth ( ) const
inlineconstexprnoexcept

Get the month.

Returns
current month value.

◆ GetNanosecond()

int SDL::DateTime::GetNanosecond ( ) const
inlineconstexprnoexcept

Get the nanosecond.

Returns
current nanosecond value.

◆ GetSecond()

int SDL::DateTime::GetSecond ( ) const
inlineconstexprnoexcept

Get the second.

Returns
current second value.

◆ GetUtc_offset()

int SDL::DateTime::GetUtc_offset ( ) const
inlineconstexprnoexcept

Get the utc_offset.

Returns
current utc_offset value.

◆ GetYear()

int SDL::DateTime::GetYear ( ) const
inlineconstexprnoexcept

Get the year.

Returns
current year value.

◆ operator bool()

SDL::DateTime::operator bool ( ) const
inlineexplicitconstexprnoexcept

Check if valid.

Returns
True if valid state, false otherwise.

◆ SetDay()

DateTime & SDL::DateTime::SetDay ( int newDay)
inlineconstexprnoexcept

Set the day.

Parameters
newDaythe new day value.
Returns
Reference to self.

◆ SetDay_of_week()

DateTime & SDL::DateTime::SetDay_of_week ( int newDay_of_week)
inlineconstexprnoexcept

Set the day_of_week.

Parameters
newDay_of_weekthe new day_of_week value.
Returns
Reference to self.

◆ SetHour()

DateTime & SDL::DateTime::SetHour ( int newHour)
inlineconstexprnoexcept

Set the hour.

Parameters
newHourthe new hour value.
Returns
Reference to self.

◆ SetMinute()

DateTime & SDL::DateTime::SetMinute ( int newMinute)
inlineconstexprnoexcept

Set the minute.

Parameters
newMinutethe new minute value.
Returns
Reference to self.

◆ SetMonth()

DateTime & SDL::DateTime::SetMonth ( int newMonth)
inlineconstexprnoexcept

Set the month.

Parameters
newMonththe new month value.
Returns
Reference to self.

◆ SetNanosecond()

DateTime & SDL::DateTime::SetNanosecond ( int newNanosecond)
inlineconstexprnoexcept

Set the nanosecond.

Parameters
newNanosecondthe new nanosecond value.
Returns
Reference to self.

◆ SetSecond()

DateTime & SDL::DateTime::SetSecond ( int newSecond)
inlineconstexprnoexcept

Set the second.

Parameters
newSecondthe new second value.
Returns
Reference to self.

◆ SetUtc_offset()

DateTime & SDL::DateTime::SetUtc_offset ( int newUtc_offset)
inlineconstexprnoexcept

Set the utc_offset.

Parameters
newUtc_offsetthe new utc_offset value.
Returns
Reference to self.

◆ SetYear()

DateTime & SDL::DateTime::SetYear ( int newYear)
inlineconstexprnoexcept

Set the year.

Parameters
newYearthe new year value.
Returns
Reference to self.

The documentation for this struct was generated from the following file: