openskynetwork / java-adsb

Mode S and ADS-B decoding library for Java
GNU General Public License v3.0
103 stars 41 forks source link

Add timestamp to AirbornePositionMsg #2

Closed bkhall closed 9 years ago

bkhall commented 9 years ago

The time delta between a given pair of these messages for a given aircraft should not exceed 10 seconds.

Add a field to capture the time the message was created so instances of this class can be tested against each other for proper pairing.

Recommend setting the value in the constructor from a monotomic source.

openskynetwork commented 9 years ago

The class is supposed to implement the bare decoding of position messages. It's the user's responsibility to enter correct parameters. Therefore, checking timestamps should be done elsewhere.

bkhall commented 9 years ago

I wasn't proposing that this class do any checking. However, if you should capture the time when the object was created so users of this class can do the comparison themselves, just as you suggest.

Simply add 1 line to the constructor method: time_stamp = SystemClock.uptimeMillis();

And add an appropriate getter on the field, will allow comparison to be implemented elsewhere.

Anyway, I modified my local copy this some time ago and do the comparison in my own classes. It cuts down on invalid positions, which is what we all really want.

Just thought I'd pass along a simple improvement.