Store computed reception time in the message struct so we don't rely on

the message being emitted immediately.

Fix computation of reception time so it's more sensible (the block timestamp
is some time after reception of the _end_ of the block, not the start) - this
means that message-emission times are always later than message-reception
times in SBS output, which is a bit more sensible.

Use clock_gettime in preference to ftime.
This commit is contained in:
Oliver Jowett 2015-02-08 17:46:01 +00:00
parent 1584955080
commit 4e177c2d64
7 changed files with 76 additions and 31 deletions

View file

@ -425,6 +425,12 @@ void demodulate2400(uint16_t *m, uint32_t mlen) {
// Set initial mm structure details
mm.timestampMsg = Modes.timestampBlk + (j*5) + bestphase;
// compute message receive time as block-start-time + difference in the 12MHz clock
mm.sysTimestampMsg = Modes.stSystemTimeBlk; // end of block time
mm.sysTimestampMsg.tv_nsec -= receiveclock_ns_elapsed(mm.timestampMsg, Modes.timestampBlk + MODES_ASYNC_BUF_SAMPLES * 5); // time until end of block
normalize_timespec(&mm.sysTimestampMsg);
mm.score = bestscore;
mm.bFlags = mm.correctedbits = 0;