How to save time in .txt file when the object is Detected in Video using YoloV5

Hello, I hope you are doing well. The code you share saves only timestamp current time not the time of the video when the object is detected Using Yolov5
I am able to detect object in video using But i cannot get the time when the object appear in video. I have scenario like this :

I have 5 seconds video .
in the 3rd second, the object appears on the video. Then that time will be save in text file Like the following

14 0.0183594 0.0378338 0.0367187 0.0667656, 00:00:02

Linking here to connect back to the original thread where this is actively being addressed/resolved.

I’m doing this so that others that find each post realize these are connected threads, rather than separate inquiries: