# Saving time of first mouse movement

**URL:** <https://discourse.psychopy.org/t/saving-time-of-first-mouse-movement/27925>\
**Category:** Builder\
**Tags:** timing\
**Created:** [March 11, 2022, 1:11pm UTC](https://discourse.psychopy.org/t/saving-time-of-first-mouse-movement/27925 "2022-03-11T13:11:22Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [March 12, 2022, 10:51pm UTC](https://discourse.psychopy.org/t/saving-time-of-first-mouse-movement/27925/3 "2022-03-12T22:51:45Z")

</div>

Begin Routine

```auto
mouserec = mouse.getPos()
moved = False

```

Each Frame

```auto
if moved == False:
     mouseloc = mouse.getPos()
     if mouseloc[0] != mouserec[0] or mouseloc[1] != mouserec[1]:
          moved = True
          thisExp.addData('Moved',round(t*1000))

```

---

_[View the full topic](https://discourse.psychopy.org/t/saving-time-of-first-mouse-movement/27925)._
