Bladeren bron

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

Petar Popovic 1 jaar geleden
bovenliggende
commit
764fe72449

+ 6 - 6
include/SDL3/SDL_time.h

@@ -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"

+ 2 - 2
src/time/SDL_time.c

@@ -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);

+ 1 - 1
src/time/SDL_time_c.h

@@ -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_ */

+ 2 - 2
src/time/n3ds/SDL_systime.c

@@ -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 */

+ 1 - 1
src/time/ps2/SDL_systime.c

@@ -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)
 {
 }
 

+ 1 - 1
src/time/psp/SDL_systime.c

@@ -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;
 

+ 1 - 1
src/time/unix/SDL_systime.c

@@ -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...

+ 1 - 1
src/time/vita/SDL_systime.c

@@ -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;

+ 1 - 1
src/time/windows/SDL_systime.c

@@ -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. */
 

+ 2 - 2
test/testtime.c

@@ -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)
 {