How can I calculate pawn lifespan from server time spawned

Is it something like server time created - minus current time?

If by lifespan you mean from the time they spawned to the time they died then you need to capture their start time and death time. But to do this you need to track time. Unless I missed something (which is totally possible) UE4 doesn’t have a concept of overall time, it just has delta seconds on tick and world delta seconds. You could just add up delta seconds every tick in something like the game state bp and on spawn capture it from the game state and on despawn capture it again and subtract and then you have total seconds the character was alive.

Be careful here though, floats have a max value. I think it’s something like 3.40282347E+38 but i’m not 100% sure. To avoid the overflow you can convert seconds to minutes/hours/days or something. It really depends on the application.

What if I set a life span, then get remaining life span later, I only need like less than 60 seconds of time tracking. I’m filtering actors that are being counted before my auto destroy gets them

Oh, in that case set the auto destroy time and just subtract from it. It would work the same as adding, CurrentTime = CurrentTime - DeltaSeconds on each tick. When it hits <= 0 then you destroy it. The actors themselves could have the info on them and then destroy themselves or bind to a delegate that gets called when the count down hits <= 0.

Why not just use timers?

Start timer on BeginPlay, save up handler in varable, rea timer state any time

3.40282347E+38 is maximum value without losing any fraction precision, maximum intiger number is theoretically 2147483650, all depends on what resolution of fraction is, the bigger integer the less precise floating point becomes

Worth noting is that by default (when you use fractioned number, ofcorse in blueprint and reflection system you only have single) C++ use double precision which is bigger letting do bigger numbers and more precise fractions

Much better idea, didn’t know they had these. I have always implemented my own. Thanks for the tip.