glidernet / ogn-python

A gateway with built-in database for the Open Glider Network (OGN)
http://glidernet.org
GNU Affero General Public License v3.0
17 stars 4 forks source link

Packets with bad timestamps are with no exception 3742s back. #31

Closed Meisterschueler closed 8 years ago

Meisterschueler commented 8 years ago

(venv) KonstantinsiMac:ogn konstantin$ python manage.py gateway.run Start ogn gateway 2016-01-12 23:28:27,778 - INFO - ogn.gateway.client - Connect to OGN as anon-dev with filter 'full-feed' 2016-01-12 23:29:26,994 - ERRO - ogn.gateway.client - Drop packet, 3742s from past. 2016-01-12 23:32:29,178 - INFO - ogn.gateway.client - Send keepalive 2016-01-12 23:34:26,954 - ERRO - ogn.gateway.client - Drop packet, 3742s from past. 2016-01-12 23:36:29,291 - INFO - ogn.gateway.client - Send keepalive 2016-01-12 23:39:26,960 - ERRO - ogn.gateway.client - Drop packet, 3742s from past. 2016-01-12 23:40:29,385 - INFO - ogn.gateway.client - Send keepalive 2016-01-12 23:44:27,097 - ERRO - ogn.gateway.client - Drop packet, 3742s from past. 2016-01-12 23:44:29,808 - INFO - ogn.gateway.client - Send keepalive 2016-01-12 23:48:31,223 - INFO - ogn.gateway.client - Send keepalive 2016-01-12 23:49:27,131 - ERRO - ogn.gateway.client - Drop packet, 3742s from past. 2016-01-12 23:52:31,353 - INFO - ogn.gateway.client - Send keepalive 2016-01-12 23:54:27,091 - ERRO - ogn.gateway.client - Drop packet, 3742s from past. 2016-01-12 23:56:33,227 - INFO - ogn.gateway.client - Send keepalive 2016-01-12 23:59:26,854 - ERRO - ogn.gateway.client - Drop packet, 3742s from past. 2016-01-13 00:00:33,267 - INFO - ogn.gateway.client - Send keepalive

kerel-fs commented 8 years ago

The interval is 5 minutes, so I would guess it's a receiver beacon with a bad timestamp.

kerel-fs commented 8 years ago
2016-01-13 00:19:26,752 - ERRO - ogn.gateway.client - Drop packet, -82658s from past.
2016-01-13 00:19:26,753 - ERRO - ogn.gateway.client - Dropped packet: Moosburg>APRS,TCPIP*,qAC,GLIDERN1:/231705h...

It is Moosburg sending beacons with a wrong timestamp. 23:17 at 00:19 UTC 23:22 at 00:24 UTC Unfortunately there is no contact data in the wiki or any related email-address on their website (EDPI).

Our simple date correction algorithm fails under this condition and thus produces such great intervals (3742s).

snip commented 8 years ago

It is possible that a receiver send very old data when there is internet access issue. We already seen 6 or more hours late.

Meisterschueler commented 8 years ago

Should we change the checker, so it fails only if packets are delayed > 12 hours?

kerel-fs commented 8 years ago

I propose the following (reference):

def createTimestamp(hhmmss, reference):
    packet_time = datetime.strptime(hhmmss, '%H%M%S').time()
    timestamp = datetime.combine(reference, packet_time)
    delta = timestamp - reference

    if abs(delta) < timedelta(hours=12):
        return timestamp
    else:
        if delta > timedelta(0):
            # Packet from previous day
            return createTimestamp(hhmmss, reference+timedelta(hours=-12))
        else:
            # Packet from the next day
            return createTimestamp(hhmmss, reference+timedelta(hours=+12))

We could add the case 6h < delta < 12h and drop these packets which were more than 6h delayed, but I think it's not necessary.

Meisterschueler commented 8 years ago

Wont work for delayed reference time...

Meisterschueler commented 8 years ago

Sorry... I was wrong. Works!