Clock time of stimulus onset

I want to record the clock time when a stimulus is displayed.
I wasn’t sure whether I should record the time in ‘Prepare to start Routine’

 # ------Prepare to start Routine "trial"-------
    continueRoutine = True
    routineTimer.add(1.000000)

or ‘Run Routine’

# -------Run Routine "trial"-------
    while continueRoutine and routineTimer.getTime() > 0:
        # get current time
        t = trialClock.getTime()
        tThisFlip = win.getFutureFlipTime(clock=trialClock)
        tThisFlipGlobal = win.getFutureFlipTime(clock=None)
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame

or somewhere else.
Can someone guide me where should I place getTime() to get the precise clock time of the stimulus onset?