psychopy/psychopy — pull request #566 by isolver (2014-04-18 20:10:56+00:00)
Title: ENH: getKeys timeStamped arg can now be a float

If a user wants the times returned by getkeys() to be relative to another fixed time,
timeStamped can be passed with a float or int as the
object type. In this case, the timeStamped value is simply subtracted
from key times.

This allows for functionality like when using a clock and resetting it
when the flip occurs. However I find this simpler, and with less
overhead than using Clocks in many cases. It is also likely more accurate, as
the time right after the flip blocking code returns is used, so the flip
time is immune to the time it takes to run and code in win.flip()
following the actual flip time.
Depending on the time it takes to run any functions have been set to run
after the flip, this time difference could be biog enough to care about.

Ex:

flip_time=win.flip()
# do stuff
# ...
# get keys relative to the flip time
keyevents=event.getKeys(timeStamped=flip_time)