Saving time of first mouse movement

Begin Routine

mouserec = mouse.getPos()
moved = False

Each Frame

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