SDL/include/SDL3
Frank Praznik a6fbf0488c Add time and realtime clock functions
Adds functions to query the system's realtime clock, convert time intervals to/from a calendar date and time in either UTC or the local time, and perform time related calculations.

An SDL_Time type (a time interval represented in nanoseconds), and SDL_DateTime struct (broken down calendar date and time) were added to facilitate this functionality.

Querying the system time results in a value expressed in nanoseconds since the Unix epoch (Jan 1, 1970) in UTC +0000. Conversions to and from the various platform epochs and units are performed when required.

Any direct handling of timezones and DST were intentionally avoided. The offset from UTC is provided when converting from UTC to a local time by calculating the difference between the original UTC and the resulting local time, but no other timezone or DST information is used.

The preferred date formatting and 12/24 hour time for the system locale can be retrieved via global preferences.

Helper functions for obtaining the day of week or day or year for calendar date, and getting the number of days in a month in a given year are provided for convenience. These are simple, but useful for performing various time related calculations.

An automated test for time conversion is included, as is a simple standalone test to display the current system date and time onscreen along with a calendar, the rendering of which demonstrates the use of the utility functions (press up/down to increment or decrement the current month, and keys 1-5 to change the date and time formats).
2024-03-19 10:57:36 -07:00
..
SDL.h Add time and realtime clock functions 2024-03-19 10:57:36 -07:00
SDL_assert.h Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
SDL_atomic.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_audio.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_begin_code.h Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
SDL_bits.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_blendmode.h blendmode: Corrected docs for `SDL_BLENDOPERATION_[REV_]SUBTRACT`. 2024-01-25 17:48:12 -05:00
SDL_camera.h Cleaned up various type conversion issues 2024-03-07 06:58:43 -08:00
SDL_clipboard.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_close_code.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_copying.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_cpuinfo.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_dialog.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_egl.h Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
SDL_endian.h Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
SDL_error.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_events.h Added a note for the SDL_CommonEvent type 2024-03-14 09:00:47 -07:00
SDL_filesystem.h Add time and realtime clock functions 2024-03-19 10:57:36 -07:00
SDL_gamepad.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_guid.h Named typedef-ed structs Gave name to structs that were defined like anonymous struct with name given by typedef. Example 'typedef struct {...} Foo;' -> 'typedef struct Foo {...} Foo;' 2024-03-10 09:04:18 -07:00
SDL_haptic.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_hidapi.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_hints.h Renamed SDL_LogGetOutputFunction() and SDL_LogSetOutputFunction() to match SDL 3.0 naming convention 2024-03-17 12:28:11 -07:00
SDL_init.h Adding comments to init-flags SDL_INIT_AUDIO and SDL_INIT_SENSOR that they imply SDL_INIT_EVENTS 2024-03-15 13:10:49 -07:00
SDL_intrin.h SDL_intrin.h: adjust for new SDL_PLATFORM_WINDOWS meaning. 2024-01-24 21:20:50 +03:00
SDL_iostream.h Sync SDL3 wiki -> header 2024-03-19 04:57:27 +00:00
SDL_joystick.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_keyboard.h document that text input is on by default 2024-01-27 15:18:05 -08:00
SDL_keycode.h Revert "Change `SDL_Keycode` type to an enum" 2024-03-07 06:58:43 -08:00
SDL_loadso.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_locale.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_log.h Renamed SDL_LogGetOutputFunction() and SDL_LogSetOutputFunction() to match SDL 3.0 naming convention 2024-03-17 12:28:11 -07:00
SDL_main.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_main_impl.h main: Indented SDL_main headers for readability, removed SDL2 compat macros. 2024-01-25 17:39:38 -05:00
SDL_messagebox.h Updated structure and field names for consistency 2024-02-11 08:27:56 -08:00
SDL_metal.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_misc.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_mouse.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_mutex.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_oldnames.h Renamed SDL_SizeIO() SDL_GetIOSize() 2024-03-18 00:27:18 -04:00
SDL_opengl.h Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
SDL_opengl_glext.h replaced line comments in public header. 2023-02-04 10:02:10 +03:00
SDL_opengles.h Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
SDL_opengles2.h Define SDL_PLATFORM_* macros instead of underscored ones (#8875) 2024-01-24 01:40:51 +00:00
SDL_opengles2_gl2.h Switch header convention from `#include "SDL.h"` to `#include <SDL3/SDLh>` 2022-11-26 22:15:18 -08:00
SDL_opengles2_gl2ext.h Switch header convention from `#include "SDL.h"` to `#include <SDL3/SDLh>` 2022-11-26 22:15:18 -08:00
SDL_opengles2_gl2platform.h Switch header convention from `#include "SDL.h"` to `#include <SDL3/SDLh>` 2022-11-26 22:15:18 -08:00
SDL_opengles2_khrplatform.h Switch header convention from `#include "SDL.h"` to `#include <SDL3/SDLh>` 2022-11-26 22:15:18 -08:00
SDL_pen.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_pixels.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_platform.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_platform_defines.h Added VisionOS as a supported target to the Xcode project 2024-01-27 11:07:21 -08:00
SDL_power.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_properties.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_quit.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_rect.h Removed unused headers from SDL_rect.h 2024-03-03 11:33:59 -08:00
SDL_render.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_revision.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_scancode.h Clarified that SDL scancodes are unaffected by keyboard layout 2024-02-07 09:33:27 -08:00
SDL_sensor.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_stdinc.h Add time and realtime clock functions 2024-03-19 10:57:36 -07:00
SDL_storage.h Sync SDL3 wiki -> header 2024-03-18 15:57:23 +00:00
SDL_surface.h Sync SDL3 wiki -> header 2024-03-17 19:29:22 +00:00
SDL_system.h Sync SDL3 wiki -> header 2024-02-13 17:07:23 +00:00
SDL_test.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_test_assert.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_test_common.h Use `SDL_WindowFlags` in public headers 2024-03-06 15:08:12 -08:00
SDL_test_compare.h Made SDL_ReadSurfacePixel a public function 2024-01-18 07:00:10 -08:00
SDL_test_crc32.h Named typedef-ed structs Gave name to structs that were defined like anonymous struct with name given by typedef. Example 'typedef struct {...} Foo;' -> 'typedef struct Foo {...} Foo;' 2024-03-10 09:04:18 -07:00
SDL_test_font.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_test_fuzzer.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_test_harness.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_test_log.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_test_md5.h Named typedef-ed structs Gave name to structs that were defined like anonymous struct with name given by typedef. Example 'typedef struct {...} Foo;' -> 'typedef struct Foo {...} Foo;' 2024-03-10 09:04:18 -07:00
SDL_test_memory.h Updated copyright for 2024 2024-01-01 13:15:26 -08:00
SDL_test_random.h Named typedef-ed structs Gave name to structs that were defined like anonymous struct with name given by typedef. Example 'typedef struct {...} Foo;' -> 'typedef struct Foo {...} Foo;' 2024-03-10 09:04:18 -07:00
SDL_thread.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_time.h Add time and realtime clock functions 2024-03-19 10:57:36 -07:00
SDL_timer.h SDL file times are 64-bit integers representing nanoseconds since the Unix epoch 2024-03-17 13:21:04 -07:00
SDL_touch.h Updated "see also" references to be more consistent 2024-03-17 12:28:11 -07:00
SDL_version.h Updated structure and field names for consistency 2024-02-11 08:27:56 -08:00
SDL_video.h video: Prepend global video property with "SDL" 2024-03-18 21:52:39 -04:00
SDL_vulkan.h Reverted SDL_Vulkan_GetInstanceExtensions() API change 2024-03-05 13:39:42 -08:00