Check if bit correction happened before bailing out due to a bad CRC.
Prefer to use global CPR decoding where possible.

There is a danger in always using relative decoding where possible.
If there is an undetected error in the first pair of messages received,
then global CPR decoding will give a bad position, and subsequent
relative decoding will just walk around near that bad position even
though many error-free pairs of odd/even messages may have been received.

The first pair of position messages also tends to be the most error-prone, as
they are usually received at the extreme edge of receiver range.

(I see this happen at least once a day in practice)

So, instead, prefer to use global decoding when we have sufficiently recent data.
With recent data this should always be as good as relative decoding, and it
avoids getting stuck with bad data for long periods of time. If we don't have
enough recent data for a global solution, fall back to relative decoding.
Add --stats-every <secs> option.

Periodically displays and resets stats.
Useful for unattended operation.
Add stats for number of sample blocks processed and dropped.
Move the stats reset strictly after stats display, so the total message count is shown correctly.
Detect client EOF properly. Handle EWOULDBLOCK.

Client disconnection appears as a read of 0 bytes.
Without a test for this, dump1090 continues to poll that client forever.

Also, read() may return EWOULDBLOCK as well as EAGAIN
for "no data right now", so handle that.

I don't know if there is an equivalent Win32 bug here as the Win32
interfaces seem subtly different to vanilla POSIX.

The following test/break can probably be removed if Win32 needs
the same fix.
Use the anet-reported error string when reporting bind errors.

errno may have been modified by the time you see it.
B"H adapt degree character display code to escaped text
Always emit a message reception time, as otherwise the FR24 uploader is unhappy.

When we don't have a time available (e.g. remote message) use the system time.
Merge pull request #47 from mutability/flightradar-compat-fix

Always emit a message reception time, as otherwise the FR24 uploader is unhappy.
Merge remote-tracking branch 'origin/pr/46'
Merge pull request #43 from mutability/more-stats

Add --stats-every option, add sample block counters
Merge pull request #42 from mutability/prefer-global-cpr

Prefer to use global CPR decoding where possible.
Make Pull # compatible with Pull #42
Merge pull request #35 from mutability/use-repaired-checksums

Check if bit correction happened before bailing out due to a bad CRC.
Merge pull request #45 from mutability/net-client-eof-handling

Detect client EOF properly. Handle EWOULDBLOCK.
Merge branch 'master' of https://www.github.com/MalcolmRobb/dump1090 into web_update