In order for a person to be killed by Beis Din via a capital punishment, there needs to be:
- a) 2 witnesses (Deuteronomy 19:15) that saw him transgress a sin that is liable to death.
- b) a warning ("hasra'ah") that the action the person is about to commit is liable to death (Sanhedrin 40a-b).
Within this requirement of warning, in order for a person to eligible for capital punishment the warning must be immediately followed by the action within the amount of time of "toch k'dei dibbur" (see Sanhedrin 40b)-- ie several seconds of time.
As the Rambam in Hilchos Sanhedrin 12:2 writes:
וְצָרִיךְ שֶׁיַּעֲבֹר וְיַעֲשֶׂה תֵּכֶף לַהַתְרָאָה בְּתוֹךְ כְּדֵי דִּבּוּר
He must commit the transgression immediately after receiving the warning, within the time to offer a salutation.
Being as this is literally a life or death matter:
where do we learn the source for this toch k'dei dibbur requirement by capital punishment?