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).
These are test programs for the SDL library:
checkkeys Watch the key events to check the keyboard
loopwave Audio test -- loop playing a WAV file
testsurround Audio test -- play test tone on each audio channel
testaudioinfo Lists audio device capabilities
testerror Tests multi-threaded error handling
testfile Tests SDL_IOStream layer
testgl A very simple example of using OpenGL with SDL
testiconv Tests international string conversion
testkeys List the available keyboard keys
testloadso Tests the loadable library layer
testlocale Test Locale API
testlock Hacked up test of multi-threading and locking
testmouse Tests mouse coordinates
testmultiaudio Tests using several audio devices
testoverlay Tests the overlay flickering/scaling during playback.
testplatform Tests types, endianness and cpu capabilities
testsem Tests SDL's semaphore implementation
testshape Tests shaped windows
testsprite Example of fast sprite movement on the screen
testthread Hacked up test of multi-threading
testtimer Test the timer facilities
testver Check the version and dynamic loading and endianness
testwm Test window manager -- title, icon, events
torturethread Simple test for thread creation/destruction
gamepadmap Useful to generate Game Controller API compatible maps
This directory contains sample.wav, which is a sample from Will Provost's
song, The Living Proof:
From the album The Living Proof
Publisher: 5 Guys Named Will
Copyright 1996 Will Provost
You can get a copy of the full song (and album!) from iTunes...
https://itunes.apple.com/us/album/the-living-proof/id4153978
or Amazon...
http://www.amazon.com/The-Living-Proof-Will-Provost/dp/B00004R8RH
Thanks to Will for permitting us to distribute this sample with SDL!