Module time

Available on crate feature dep_sdl3 only.
Expand description

SDL realtime clock and date/time routines.

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.

Structs§

SDL_DateFormat
The preferred date format of the current system locale.
SDL_DateTime
A structure holding a calendar date and time broken down into its components.
SDL_TimeFormat
The preferred time format of the current system locale.

Constants§

SDL_DATE_FORMAT_DDMMYYYY
Day/Month/Year
SDL_DATE_FORMAT_MMDDYYYY
Month/Day/Year
SDL_DATE_FORMAT_YYYYMMDD
Year/Month/Day
SDL_TIME_FORMAT_12HR
12 hour time
SDL_TIME_FORMAT_24HR
24 hour time

Functions§

SDL_DateTimeToTime
Converts a calendar time to an SDL_Time in nanoseconds since the epoch.
SDL_GetCurrentTime
Gets the current value of the system realtime clock in nanoseconds since Jan 1, 1970 in Universal Coordinated Time (UTC).
SDL_GetDateTimeLocalePreferences
Gets the current preferred date and time format for the system locale.
SDL_GetDayOfWeek
Get the day of week for a calendar date.
SDL_GetDayOfYear
Get the day of year for a calendar date.
SDL_GetDaysInMonth
Get the number of days in a month for a given year.
SDL_TimeFromWindows
Converts a Windows FILETIME (100-nanosecond intervals since January 1, 1601) to an SDL time.
SDL_TimeToDateTime
Converts an SDL_Time in nanoseconds since the epoch to a calendar time in the SDL_DateTime format.
SDL_TimeToWindows
Converts an SDL time into a Windows FILETIME (100-nanosecond intervals since January 1, 1601).