open-dis-cpp icon indicating copy to clipboard operation
open-dis-cpp copied to clipboard

setTimestamp on EntityStatePdu

Open AJPerriello opened this issue 11 months ago • 2 comments

I've done reading and haven't found a good code example. But from what I read in the standard is that DIS servers may reject EntityStatePdu is the timestamp is not 0 (relative) or valid. So using this open-dis library I'm not sure how this would work properly. I've seen other dis implementations that manage more code and logic to handle timestamps and updating them for persistent entities. In other words, if timestamps are not relevant or too latent then it could be perceived that the entity is no longer existing. Unix time in milliseconds since epoch fits in 64 bit long, but not 32 bit int, furthermore, it seems timestamps need to be DIS compliant by setting the least significant bit too 0 or 1. (relative or absolute) and then the next 31 bits could hold at most (2^31) - 1 values. This will not work for epoch time without significant loss, so I think it means that time values are how many ticks since the top of the hour. I can't see how this would be used with the current library APIs on Pdu::setTimestamp(). An example would help. But I can't find one. For now, I'll just keep trying different techniques to see what works. If you have more info or a good example in C++ thank you.

AJPerriello avatar Feb 29 '24 13:02 AJPerriello

@AJPerriello there's a class in the Java library named disTime that may help answer your questions

https://github.com/open-dis/open-dis-java/blob/master/src%2Fmain%2Fjava%2Fedu%2Fnps%2Fmoves%2Fdisutil%2FDisTime.java

leif81 avatar Jul 01 '24 13:07 leif81

@AJPerriello 's a class in the Java library named disTime may help answer your questions

https://github.com/open-dis/open-dis-java/blob/master/src%2Fmain%2Fjava%2Fedu%2Fnps%2Fmoves%2Fdisutil%2FDisTime.java

Many simulations, especially the in-house kind, ignore timestamp and handle packets the order they are received.

leif81 avatar Jul 01 '24 13:07 leif81