Hi, I have an experiment on which I need to measure the total experiment time.
I’ve tried to use these other forum codes :
"Psychopy has an internal clock which starts when the experiment starts. You can read the time using core.monotonicClock.getTime(). The timing of this clock starts almost immediately as you hit “run”, i.e. before the dialogue box, so it doesn’t read the time since the first routine started. However, you can get that duration by first recording the time of the clock in a code component when you want time zero to be defined:
time_zero = core.monotonicClock.getTime()
… and then record the time elapsed doing
thisExp.addData(‘cumulative_duration’, core.monotonicClock.getTime() - time_zero)
Note that if you want to do this only for particular loops (e.g. define time_zero in the first loop and record cumulative_duration in the last loop) require the condition to be satisfied:
If this is the first iteration of the loop (no matter the name of the loop)
if currentLoop.thisN == 0:
time_zero = core.monotonicClock.getTime() "
I’ve written it in the “Begin Eperiment” and in the “End Eperiment”, but it’s not working…
I’m a beginner , so I would really appreciate your help!