Skip to content

Commit

Permalink
sdl/timer: add GetTicks64() and deprecated GetTicks()
Browse files Browse the repository at this point in the history
Signed-off-by: Lilis Iskandar <[email protected]>
  • Loading branch information
veeableful committed Mar 2, 2022
1 parent a665e57 commit 06f44fa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sdl/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,24 @@ package sdl
import "C"

// GetTicks returns the number of milliseconds since the SDL library initialization.
//
// Deprecated: This function is not recommended as of SDL 2.0.18; use GetTicks64()
// instead, where the value doesn't wrap every ~49 days. There are places in
// SDL where we provide a 32-bit timestamp that can not change without
// breaking binary compatibility, though, so this function isn't officially
// deprecated.
//
// (https://wiki.libsdl.org/SDL_GetTicks)
func GetTicks() uint32 {
return uint32(C.SDL_GetTicks())
}

// GetTicks64 returns the number of milliseconds since the SDL library initialization.
// (https://wiki.libsdl.org/SDL_GetTicks64)
func GetTicks64() uint64 {
return uint64(C.SDL_GetTicks64())
}

// GetPerformanceCounter returns the current value of the high resolution counter.
// (https://wiki.libsdl.org/SDL_GetPerformanceCounter)
func GetPerformanceCounter() uint64 {
Expand Down

0 comments on commit 06f44fa

Please sign in to comment.