Currently I generate chunks in a fixed radius of the player.
Some of the chunks are empty (air), some require more or less procedural mesh calculations.
I am trying to keep each logic tic under X millisec regardless of how many chunks I have generated.
A simple time check would do the trick.
The problem is I am not yet comfortable with c++ and ue4 as implied by my post count :).
Basically I am asking how can I get system time with millisec precision with the built in api or if it is possible normal c++ libraries (<time>?).
The function use case and includes.
I tried “UGameplayStatics::GetRealTimeSeconds(GetWorld())”, but it seemed only be updated after every logic tic.
This seems to be it, but…
CurrentDateAndTime.GetMillisecond() seems to be from 0 to 999;
So when my start is at 990 and my end time at 6, it would report -884 instead of 16 ms.
I am used to have time in this format: 1438627036.337626.
EDIT: unix time + millisecs, that what this was…
For measuring time for profiling I suggest using FPlatformTime::Seconds();
Internally it uses the highest resolution timer available to whatever platform you’re running on. (e.g. for Windows that’s QueryHighPerformanceCounter())
here’s an example of how i use it.
double start = FPlatformTime::Seconds();
// put code you want to time here.
double end = FPlatformTime::Seconds();
UE_LOG(LogTemp, Warning, TEXT("code executed in %f seconds."), end-start);