Skip to content

Time and timestamps

Oona Räisänen edited this page Aug 20, 2024 · 2 revisions

Clock time and date

Some stations transmit a clock time and date signal in group 4A. According to the standard, it will be transmitted once every minute, so that the UTC minute edge accurately coincides with the end of the 4A group +/- 0.1 seconds. The number of seconds are not transmitted and redsea assumes :00 seconds as per the standard:

"clock_time":"2008-03-19T09:37:00+01:00"

However, not all stations follow this standard! There are stations that update the clock almost every second (example: Radio Capital in Italy). This becomes a problem if 4A is then used to update some kind of onboard clock, because clock_time can only ever express :00 seconds. This should be taken into consideration.

Some stations might have their clock set wrong, or it might even be in the wrong year. In this case, you will receive the wrong time. One solution could be to keep a list in the receiver of trusted stations that are known to keep their clock in correct time.

Also, since RDS is prone to errors in noisy conditions, this can cause incorrect interpretations of the date code.

Rx timestamps

Using the option -t it's possible to timestamp every JSON line up to the precision of 0.01 seconds. The time format is normal C strftime but an %f character can be used to insert hundredths of seconds: -t %H:%M:%S.%f gives 12:34:56.78.

The time is system clock time and refers to the moment that the end of the last bit of the group was received. This is the same convention that's used in transmitter timestamps in group 4A, to make these comparable. An effort is made to compensate for buffer delays (internal to redsea) when decoding live MPX, so it should refer to the moment the bit was actually read in.

Note that it takes about 0.09 seconds to transmit one group. By specification, 4A groups are only accurate up to 0.1 seconds.

If there are large buffers between the radio and redsea, these cannot be compensated for, and the timestamp will lag behind.