How to display timer when Player is detected by enemy and have timer start and end to know when enemy stops looking for Player?

I need help, there must be a function within my game so that, if the Player Character remains ‘‘out of sight’’ for enough time, the guard will stop chasing and return to patrol.

Czesc i need help whit this as well it’s really hard coz i live in Poland and i don’t english so you help me plez??