Strict Extern "win32" Function QueryPerformanceFrequency(LARGE_INTEGER:Long Var) Function QueryPerformanceCounter(LARGE_INTEGER:Long Var) EndExtern ' ---------------------------------------------------------------------------------------------- Local Timer:TPerformanceTime = New TPerformanceTime Timer.Start() Delay 1000 Print Timer.Stop() ' should print 1 (or so) Graphics 640,480,32,85 Repeat Cls DrawText(Timer.Time(),10,10) Flip Until KeyDown(KEY_ESCAPE) ' ---------------------------------------------------------------------------------------------- Type TPerformanceTime Global Frequency:Long Field StartTime:Long Field StopTime:Long Method New() If Not Frequency Then QueryPerformanceFrequency(Frequency) EndMethod ' returns the current system time Method Time:Double() Local Time:Long QueryPerformanceCounter(Time) Return Double(Time)/Frequency EndMethod ' start the stopwatch Method Start() QueryPerformanceCounter(StartTime) EndMethod ' will return the stopwatch result, can be called more than once! Method Stop:Double() QueryPerformanceCounter(StopTime) Return Double(StopTime-StartTime)/Frequency EndMethod EndType