SDL realtime clock and date/time routines.
More...
|
struct | SDL::DateTime |
| A structure holding a calendar date and time broken down into its components. More...
|
|
|
using | SDL::DateFormat = SDL_DateFormat |
| The preferred date format of the current system locale.
|
|
using | SDL::TimeFormat = SDL_TimeFormat |
| The preferred time format of the current system locale.
|
|
|
void | SDL::GetDateTimeLocalePreferences (DateFormat *dateFormat, TimeFormat *timeFormat) |
| Gets the current preferred date and time format for the system locale.
|
|
int | SDL::GetDaysInMonth (int year, int month) |
| Get the number of days in a month for a given year.
|
|
int | SDL::GetDayOfYear (int year, int month, int day) |
| Get the day of year for a calendar date.
|
|
int | SDL::GetDayOfWeek (int year, int month, int day) |
| Get the day of week for a calendar date.
|
|
static Time | SDL::Time::Current () |
| Gets the current value of the system realtime clock in nanoseconds since Jan 1, 1970 in Universal Coordinated Time (UTC).
|
|
void | SDL::Time::ToWindows (Uint32 *dwLowDateTime, Uint32 *dwHighDateTime) const |
| Converts an SDL time into a Windows FILETIME (100-nanosecond intervals since January 1, 1601).
|
|
static Time | SDL::Time::FromWindows (Uint32 dwLowDateTime, Uint32 dwHighDateTime) |
| Converts a Windows FILETIME (100-nanosecond intervals since January 1, 1601) to an SDL time.
|
|
There are two data types that are used in this category: SDL_Time, which represents the nanoseconds since a specific moment (an "epoch"), and SDL_DateTime, which breaks time down into human-understandable components: years, months, days, hours, etc.
Much of the functionality is involved in converting those two types to other useful forms.
◆ DateFormat
◆ TimeFormat
◆ Current()
Time SDL::Time::Current |
( |
| ) |
|
|
inlinestatic |
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
◆ FromWindows()
Time SDL::Time::FromWindows |
( |
Uint32 |
dwLowDateTime, |
|
|
Uint32 |
dwHighDateTime |
|
) |
| |
|
inlinestatic |
This function takes the two 32-bit values of the FILETIME structure as parameters.
- Parameters
-
dwLowDateTime | the low portion of the Windows FILETIME value. |
dwHighDateTime | the high portion of the Windows FILETIME value. |
- Returns
- the converted SDL time.
- Since
- This function is available since SDL 3.2.0.
◆ GetDateTimeLocalePreferences()
This might be a "slow" call that has to query the operating system. It's best to ask for this once and save the results. However, the preferred formats can change, usually because the user has changed a system preference outside of your program.
- Parameters
-
dateFormat | a pointer to the DateFormat to hold the returned date format, may be nullptr. |
timeFormat | a pointer to the TimeFormat to hold the returned time format, may be nullptr. |
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
◆ GetDayOfWeek()
int SDL::GetDayOfWeek |
( |
int |
year, |
|
|
int |
month, |
|
|
int |
day |
|
) |
| |
|
inline |
- Parameters
-
year | the year component of the date. |
month | the month component of the date. |
day | the day component of the date. |
- Returns
- a value between 0 and 6 (0 being Sunday) if the date is valid.
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
◆ GetDayOfYear()
int SDL::GetDayOfYear |
( |
int |
year, |
|
|
int |
month, |
|
|
int |
day |
|
) |
| |
|
inline |
- Parameters
-
year | the year component of the date. |
month | the month component of the date. |
day | the day component of the date. |
- Returns
- the day of year [0-365] if the date is valid.
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
◆ GetDaysInMonth()
int SDL::GetDaysInMonth |
( |
int |
year, |
|
|
int |
month |
|
) |
| |
|
inline |
- Parameters
-
year | the year. |
month | the month [1-12]. |
- Returns
- the number of days in the requested month.
- Exceptions
-
- Since
- This function is available since SDL 3.2.0.
◆ ToWindows()
void SDL::Time::ToWindows |
( |
Uint32 * |
dwLowDateTime, |
|
|
Uint32 * |
dwHighDateTime |
|
) |
| const |
|
inline |
This function fills in the two 32-bit values of the FILETIME structure.
- Parameters
-
dwLowDateTime | a pointer filled in with the low portion of the Windows FILETIME value. |
dwHighDateTime | a pointer filled in with the high portion of the Windows FILETIME value. |
- Since
- This function is available since SDL 3.2.0.
◆ DATE_FORMAT_DDMMYYYY
Initial value:=
SDL_DATE_FORMAT_DDMMYYYY
◆ DATE_FORMAT_MMDDYYYY
Initial value:=
SDL_DATE_FORMAT_MMDDYYYY
◆ DATE_FORMAT_YYYYMMDD
Initial value:=
SDL_DATE_FORMAT_YYYYMMDD