Onset/offset times of a trial

The goal is to know approximately how much time each participant spent on one trial. I have attached a picture showing the components of this trial (it’s in a loop).

The ending condition is: The Mouse object enabled “End Routine on Press: valid click”. When they click on tone_report_button, this trial ends.

You can see from this timeline, the tone_report_button and the Mouse object will not appear 1.3s into the trial (after stimuli being played, controlled by code component).

Weirdly, the duration of the trial (calculated by trial.end - trial.start) is sometimes smaller than 1.3s. Theoretically, participants can only click on the button after it appears (after 1.3s)?

I also have tried setting up a similar duration measure in code component:
in Begin routine: I have trial_start_time = psychoJS.monotonicClock.getTime();

Then in End routine: I have response_time = psychoJS.monotonicClock.getTime() - trial_start_time;

This value is sometimes lower than 1.3s too.

Could anyone help explain what might have gone wrong here? I’m happy to provide more information. Thank you very much!

OS (e.g. Win10): MacOS
PsychoPy version (e.g. 2024.2.4 Py 3.8): v2025.2.4
Standard Standalone Installation? (y/n) If not then what?: Yes

Check the values of t (routine time) and tone_mouse.time.

I did not record tone_mouse.time.
Could I ask how to interpret the tone_trial.started and tone_trial.stopped then?

Both tone_trial.stopped -tone_trial.started and response_time (defined above) are sometimes smaller than 1.3s, during which the tone_mouse did not appear and ideally would not trigger end trial condition?