Jump to content
OpenSplice DDS Forum

How to tell the difference between historical samples and new samples?

Recommended Posts

When my domain participant and readers start up I call wait_for_historical_data (which takes 6.5 seconds on my machine for the first reader, alas) but writers may be producing new data during that time. I'd like to be able to tell the difference between historical samples and new samples (where the latter might be defined as "written since I called wait_for_historical_data", unless some other similar definition is easier).

I was hoping for a flag in the dds.SampleInfo that told me if this was historical or new, and/or a read condition that would only return historical data, but I have not found either.

There are timestamps in the dds.SampleInfo associated with each sample that might help, but the obvious choice is source_timestamp and I would have to know the clock offset to use that reliably. reception_timestamp seems to use the local clock, but there is no obvious break between historical data and new data.

Any suggestions?

Share this post

Link to post
Share on other sites

There's indeed no such 'break' .. and (thus) you'd have to revert to the (source) timestamp of the received samples.

It's still not that easy as historical samples might be produced by different (potentially past-)writers that exploit perhaps-not-sufficiently-aligned clocks ..

Note however that (also after wait_for_historical_data()), the datareader's history (of each instance) will be ordered, something that should prevent checking each/every sample .. 

Anyhow, my advice would be not to rely on such a distinction and if time-validity is an issue, model that validity explicitly in your data(-model)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...