Time my experiment

I want to be able to time my experiment and save that time, from the beginning of the first routine to the beginning of the last routine.

I would need this to work online on pavlovia too.

Begin Experiment

myClock = core.Clock()

Begin Routine (first routine)


End Routine (last routine)

thisExp.addData('Elapsed Time',myClock.getTime())


Ah it worked offline but I had this pop up when I tried to run the experiment on Pavlovia online.

Sorry – you may have a version which doesn’t translate core.Clock() correctly. You might need to put that one into a Both component and change the JS side to myClock = new util.Clock();

I did that and it worked offline again but didn’t work online in Pavlovia. The actual experiment ran but the “Elapsed Time” did not show up in the datafile.

You have put the code in End Experiment not End Routine of the last routine

Thanks so much, it finally worked.