How to get high-resolution time stamp? (For timing of packets)

Hey guys,

I’m trying to time-stamp my multiplayer physics info when sending it client<->server, so every PC involved knows when the information they receive was originally calculated.

How do I get this time? I presume UE4 has its own way / wrapper?

Thanks.

Is nobody trying to do any timing stuff? Unreal likes to have its own way of doing things, so how can I get the high-resolution timer in UE4?

Hmm, so I’ve been searching through the documentation, and there is no mention of timers in this regard. I don’t mean to pester / bump, but this is pretty vital. Surely it’s been used?

I’m not sure if it is appropriate for use with networking, but I’m using this code to get the current system time in seconds (I assume it has millisecond accuracy but I am uncertain):

double now = FPlatformTime::Seconds();

There isn’t currently a global standardized timestamp that is synced between the client and server, but the CharacterMovementComponent does something like this to sync movement between the client and server. Look at some of the code that calls UCharacterMovementComponent::VerifyClientTimeStamp for some examples of usage.

Yes, I have just confirmed that this gives better than second resolution time.

Example:

double start = FPlatformTime::Seconds();
...do something...
double end = FPlatformTime::Seconds();
UE_LOG(LogActor, Warning, TEXT("Tick Timer: %.6f Start: %.6f"), end - start, start);