SDL_time.h: Renaming enums SDL_DATE_FORMAT and SDL_TIME_FORMAT to SDL_DateFormat and SDL_TimeFormat

This commit is contained in:
Petar Popovic 2024-04-08 01:58:26 +02:00 committed by Ryan C. Gordon
parent f08c31060a
commit 764fe72449
10 changed files with 18 additions and 18 deletions

View File

@ -58,30 +58,30 @@ typedef struct SDL_DateTime
*
* \sa SDL_PROP_GLOBAL_SYSTEM_DATE_FORMAT_NUMBER
*/
typedef enum SDL_DATE_FORMAT
typedef enum SDL_DateFormat
{
SDL_DATE_FORMAT_YYYYMMDD = 0, /**< Year/Month/Day */
SDL_DATE_FORMAT_DDMMYYYY = 1, /**< Day/Month/Year */
SDL_DATE_FORMAT_MMDDYYYY = 2, /**< Month/Day/Year */
} SDL_DATE_FORMAT;
} SDL_DateFormat;
/**
* The preferred time format of the current system locale.
*
* \sa SDL_PROP_GLOBAL_SYSTEM_TIME_FORMAT_NUMBER
*/
typedef enum SDL_TIME_FORMAT
typedef enum SDL_TimeFormat
{
SDL_TIME_FORMAT_24HR = 0, /**< 24 hour time */
SDL_TIME_FORMAT_12HR = 1, /**< 12 hour time */
} SDL_TIME_FORMAT;
} SDL_TimeFormat;
/**
* Global date/time properties
*
* - `SDL_PROP_GLOBAL_SYSTEM_DATE_FORMAT_NUMBER`: the SDL_DATE_FORMAT to use as the preferred date display format
* - `SDL_PROP_GLOBAL_SYSTEM_DATE_FORMAT_NUMBER`: the SDL_DateFormat to use as the preferred date display format
* for the current system locale.
* - `SDL_PROP_GLOBAL_SYSTEM_TIME_FORMAT_NUMBER`: the SDL_TIME_FORMAT to use as the preferred time display format
* - `SDL_PROP_GLOBAL_SYSTEM_TIME_FORMAT_NUMBER`: the SDL_TimeFormat to use as the preferred time display format
* for the current system locale.
*/
#define SDL_PROP_GLOBAL_SYSTEM_DATE_FORMAT_NUMBER "SDL.time.date_format"

View File

@ -66,8 +66,8 @@ void SDL_InitTime()
}
/* Default to ISO 8061 date format, as it is unambiguous, and 24 hour time. */
SDL_DATE_FORMAT dateFormat = SDL_DATE_FORMAT_YYYYMMDD;
SDL_TIME_FORMAT timeFormat = SDL_TIME_FORMAT_24HR;
SDL_DateFormat dateFormat = SDL_DATE_FORMAT_YYYYMMDD;
SDL_TimeFormat timeFormat = SDL_TIME_FORMAT_24HR;
SDL_PropertiesID props = SDL_GetGlobalProperties();
SDL_GetSystemTimeLocalePreferences(&dateFormat, &timeFormat);

View File

@ -34,6 +34,6 @@ extern void SDL_QuitTime(void);
*/
extern Sint64 SDL_CivilToDays(int year, int month, int day, int *day_of_week, int *day_of_year);
extern void SDL_GetSystemTimeLocalePreferences(SDL_DATE_FORMAT *df, SDL_TIME_FORMAT *tf);
extern void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf);
#endif /* SDL_time_c_h_ */

View File

@ -56,10 +56,10 @@ static void civil_from_days(int days, int *year, int *month, int *day)
*day = (int)d;
}
void SDL_GetSystemTimeLocalePreferences(SDL_DATE_FORMAT *df, SDL_TIME_FORMAT *tf)
void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
/* The 3DS only has 12 supported languages, so take the standard for each */
static const SDL_DATE_FORMAT LANG_TO_DATE_FORMAT[] = {
static const SDL_DateFormat LANG_TO_DATE_FORMAT[] = {
SDL_DATE_FORMAT_YYYYMMDD, /* JP */
SDL_DATE_FORMAT_DDMMYYYY, /* EN, assume non-american format */
SDL_DATE_FORMAT_DDMMYYYY, /* FR */

View File

@ -28,7 +28,7 @@
#define UNIX_EPOCH_OFFSET_SEC 946717200
/* TODO: Implement this... */
void SDL_GetSystemTimeLocalePreferences(SDL_DATE_FORMAT *df, SDL_TIME_FORMAT *tf)
void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
}

View File

@ -30,7 +30,7 @@
/* Sony seems to use 0001-01-01T00:00:00 as an epoch. */
#define DELTA_EPOCH_0001_OFFSET 62135596800ULL
void SDL_GetSystemTimeLocalePreferences(SDL_DATE_FORMAT *df, SDL_TIME_FORMAT *tf)
void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
int val;

View File

@ -34,7 +34,7 @@
#include <mach/mach_time.h>
#endif
void SDL_GetSystemTimeLocalePreferences(SDL_DATE_FORMAT *df, SDL_TIME_FORMAT *tf)
void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
/* This *should* be well-supported aside from very old legacy systems, but apparently
* Android didn't add this until SDK version 26, so a check is needed...

View File

@ -30,7 +30,7 @@
/* Sony seems to use 0001-01-01T00:00:00 as an epoch. */
#define DELTA_EPOCH_0001_OFFSET 62135596800ULL
void SDL_GetSystemTimeLocalePreferences(SDL_DATE_FORMAT *df, SDL_TIME_FORMAT *tf)
void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
int val;
SceAppUtilInitParam initParam;

View File

@ -34,7 +34,7 @@
typedef void(WINAPI *pfnGetSystemTimePreciseAsFileTime)(FILETIME *);
void SDL_GetSystemTimeLocalePreferences(SDL_DATE_FORMAT *df, SDL_TIME_FORMAT *tf)
void SDL_GetSystemTimeLocalePreferences(SDL_DateFormat *df, SDL_TimeFormat *tf)
{
WCHAR str[80]; /* Per the docs, the time and short date format strings can be a max of 80 characters. */

View File

@ -22,8 +22,8 @@
static int cal_year;
static int cal_month;
static SDL_TIME_FORMAT time_format;
static SDL_DATE_FORMAT date_format;
static SDL_TimeFormat time_format;
static SDL_DateFormat date_format;
static void RenderDateTime(SDL_Renderer *r)
{