SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members

SDL times are signed, 64-bit integers representing nanoseconds since the Unix epoch (Jan 1, 1970). More...

Public Member Functions

constexpr Time (std::chrono::nanoseconds time)
 Constructs from a nanoseconds period.
 
constexpr Time (SDL_Time time)
 Constructs from SDL_Time.
 
constexpr operator bool () const
 True if not zero.
 
constexpr operator std::chrono::nanoseconds () const
 Converts to nanoseconds period.
 
constexpr Sint64 ToNS () const
 Converts to nanoseconds Sint64.
 
constexpr Sint64 ToPosix () const
 Convert nanoseconds to seconds.
 
void ToWindows (Uint32 *dwLowDateTime, Uint32 *dwHighDateTime) const
 Converts an SDL time into a Windows FILETIME (100-nanosecond intervals since January 1, 1601).
 
constexpr float ToSeconds () const
 Converts a time to seconds (float) since epoch.
 
constexpr Timeoperator+= (std::chrono::nanoseconds interval)
 Increment time.
 
constexpr Timeoperator-= (std::chrono::nanoseconds interval)
 Decrement.
 

Static Public Member Functions

static Time Current ()
 Gets the current value of the system realtime clock in nanoseconds since Jan 1, 1970 in Universal Coordinated Time (UTC).
 
static constexpr Time FromNS (Sint64 time)
 Create from a nanoseconds Sint64.
 
static constexpr Time FromPosix (Sint64 time)
 Convert seconds to nanoseconds.
 
static Time FromWindows (Uint32 dwLowDateTime, Uint32 dwHighDateTime)
 Converts a Windows FILETIME (100-nanosecond intervals since January 1, 1601) to an SDL time.
 
static constexpr Time FromSeconds (float interval)
 Converts a time to seconds (float) since epoch.
 

Detailed Description

They can be converted between POSIX time_t values with Time.ToPosix() and Time.FromPosix(), and between Windows FILETIME values with Time.ToWindows() and Time.FromWindows().

Since
This type is available since SDL 3.2.0.
See also
MAX_SINT64
MIN_SINT64

The documentation for this class was generated from the following files: