time.go (1299B)
1 package glfw 2 3 //#define GLFW_INCLUDE_NONE 4 //#include "glfw/include/GLFW/glfw3.h" 5 import "C" 6 7 // GetTime returns the value of the GLFW timer. Unless the timer has been set 8 // using SetTime, the timer measures time elapsed since GLFW was initialized. 9 // 10 // The resolution of the timer is system dependent, but is usually on the order 11 // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 12 // source on each supported platform. 13 func GetTime() float64 { 14 ret := float64(C.glfwGetTime()) 15 panicError() 16 return ret 17 } 18 19 // SetTime sets the value of the GLFW timer. It then continues to count up from 20 // that value. 21 // 22 // The resolution of the timer is system dependent, but is usually on the order 23 // of a few micro- or nanoseconds. It uses the highest-resolution monotonic time 24 // source on each supported platform. 25 func SetTime(time float64) { 26 C.glfwSetTime(C.double(time)) 27 panicError() 28 } 29 30 // GetTimerFrequency returns frequency of the timer, in Hz, or zero if an error occurred. 31 func GetTimerFrequency() uint64 { 32 ret := uint64(C.glfwGetTimerFrequency()) 33 panicError() 34 return ret 35 } 36 37 // GetTimerValue returns the current value of the raw timer, measured in 1 / frequency seconds. 38 func GetTimerValue() uint64 { 39 ret := uint64(C.glfwGetTimerValue()) 40 panicError() 41 return ret 42 }