How to get time spent until spesific animation frame?

I am trying to get time spent until an animation frame.

I have this function; but: When i get lenght of the animation clip (which has 3 frames) with
animationClip.length, it says 0.4, which is correct. But when i use this function and enter frame as 3(which it should give me lenght of the animation), it gives me something like 0.05.

How can i solve this issue?

public float FindFrameTime(AnimationClip animationClip, int frame)
{
int totalFrames = Mathf.FloorToInt(animationClip.frameRate * animationClip.length);

float timeForFrame = frame / animationClip.frameRate;

return frame;

}

3 frames is 0.4 seconds? What is your animation frame rate and what does Debug.Log(animationClip.frameRate) return?

My sample rate is 60,

animationClip.frameRate is 60

Then how is 3 frames 0.4 seconds?

24 frames is 0.4 seconds at 60

you can just debug each variable and see where your math is going wrong, anyway, why do you have

return frame;

this will just return the parameter you put in