# Inconsistent timing between keyboard.getKeys and keyboard.clock.getTime

**URL:** <https://discourse.psychopy.org/t/inconsistent-timing-between-keyboard-getkeys-and-keyboard-clock-gettime/29505>\
**Category:** Coding\
**Tags:** timing\
**Created:** [June 8, 2022, 3:41pm UTC](https://discourse.psychopy.org/t/inconsistent-timing-between-keyboard-getkeys-and-keyboard-clock-gettime/29505 "2022-06-08T15:41:37Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![Philine](https://avatars.discourse-cdn.com/v4/letter/p/b487fb/32.png) [@Philine](https://discourse.psychopy.org/u/Philine)\
**Post date:** [July 12, 2022, 2:36pm UTC](https://discourse.psychopy.org/t/inconsistent-timing-between-keyboard-getkeys-and-keyboard-clock-gettime/29505/6 "2022-07-12T14:36:13Z")

</div>

My PI found a solution to the mysterious time lag 🙂

The default of `kb.getKeys()` is `waitRelease = True` and setting it to `False` eliminates the problem.  
To me the documentation of this argument is not totally clear, but it seems that with `waitRelease = True` the RT is the starting time of the key press. time1 and time2, measured with `kb.clock.getTime()` is about the sum of the RT and the duration saved with `kb.getKeys()`. The execution of the `kb.clock.getTime()` seems to wait until the key is released.

With `waitRelease = False` the RT of `kb.getKeys()` seems to be the starting time of the key press.

[Here](https://discourse.psychopy.org/t/cant-use-the-new-keyboard-component-from-psychtoolbox/7634/4) Jon explains the meaning of `waitRelease` and I think it is more comprehensible than the documentation.

Thank you all for the discussion and help!!

---

_[View the full topic](https://discourse.psychopy.org/t/inconsistent-timing-between-keyboard-getkeys-and-keyboard-clock-gettime/29505)._
