Timespan between new frame and execution of code

I don’t know there even point for it since because UE4 operate on frame basis not time, things are time aligned by scaling things via DeltaTime. Objects will apper on same time. But here you got most procise time functions in disposal:

But use FPlatformTime, insted of FGenericPlatfromTime. Take Cycles and use ToMilliseconds or 64 to convert it to time. behavior of this function may different between platforms and hardware

Hey there,
I have a question for a university project.
In my project I let objects appear and I need a precise time-stamp of the particular time point when the object appeared. Let me try to explain:
Let’s assume I have a frame rate ob 60 FPS. That means that I can execute my code 60 times per second and that there is a gap of 16.6 ms between every execution. Now I want to find out when during this 16.6 ms I actually take the time stamp.

See the following tick function. Relative to the new frame, when do I exactly take my time stamp? Is it somehow possible to measure how much time it takes between the onset of a new frame and the execution of my GetTime() function?

// Called every frame
void ATrialClass::Tick(float DeltaTime)
	{
	
		Super::Tick(DeltaTime);
		GetTime();
		//Do something
		…
	}

Any ideas?

“Now I want to find out when during this 16.6 ms I actually take the time stamp.”

IMHO, you will not be able to get it from your actor, as your actor is just one of many that were called in whatever order. And you do not know the exact time stamp with nanoseconds when this frame started (but you do know delta time, useless for you though). You will need to dig into the engine source code to see if you can extract that info, or may be alter it to get it yourself when a new frame starts. In any case it will be just very few milliseconds. If your computer is fast enough, and scene is not complicated, most of the time the engine will sleep.

Hey, thanks for your answers!

You are absolutely right about the uncertainty in what order the actors are called. So I looked into the source code, if I could at least get some control over ticking order. But I should mention here that I don’t have any kind IT background (I’m a biologist with focus on neuroscience), so bear with me if I got to much of this wrong :).
In the source I found out about TickingGroups. Do I understand this correctly, that if I put my actor into TG_PrePhysics and set bHighPriority to 1, that my actor‘s tick function will tick first?
If so, this would give me at least some control over the uncertainty when my function ticks.
Another idea might be to create another TickingGroup that comes prior to PrePhysics with just my actor in that group.

When I looked further into the source code I found the FD3D11Viewport::PresentChecked() function, which gets called, as far as I understand, directly before the present() gets called. My idea would be to take the time stamp directly here. I’ve testet this by logging the QueryPerformanceCounter in that function in the console. This worked pretty well and if PresentChecked() is really called directly prior to the present(), this would give me the perfect time stamp I’m looking for.
But now I have to find a way to take this kind of time stamp for this particular first frame with my object. I always thought that this would be the very next rendered frame after calling the function to let the object appear. But in the UE4 documentation I’ve read that the renderer operates “one or two” frames behind the game thread. Does that mean that it takes up to two frames from calling the function in my actor class until the present() of the corresponding frame gets called?
Is there a way to find out, how many frames are between my function and the present() call? Is the delay between both threads constant or does it change during runtime?