PsychExpAPIs.startTimer
— MethodstartTimer(win::Window)
Starts a timer. Only one timer can run at a time. If you need more than tha one timer, use Julia's time() function.
Inputs:
- win::Window
- waitTime::Float64 default is milliseconds
Outputs: nothing
PsychExpAPIs.stopTimer
— MethodstopTimer(win::Window)
Stops the global timer and returns the time taken. If you need more than one timer, use Julia's time() function.
Inputs:
- win::Window
Outputs: The time in [default] milliseconds.
Alternative approach
An alterntiave to calling these functions is to use Julia's built-in time()
function, which returns the current time in seconds.
Example:
...
draw(myStim) # draw stimulus
flip(win) # flip the window onto the screen
startTime = time() # get the current time
keypressed = getKey(win) # wait for a keypress
stopTime = time() # get the current time
timeTaken = stopTime - startTime
println("It took ", timeTaken * 1000," milliseconds for a keypress.")
"""