Easy question on write_w_timestamp_untyped

6 posts / 0 new
Last post
Offline
Last seen: 8 years 6 months ago
Joined: 12/14/2015
Posts: 23
Easy question on write_w_timestamp_untyped

At this web page:  http://community.rti.com/rti-doc/45f/ndds.4.5f/doc/html/api_java/interfacecom_1_1rti_1_1dds_1_1publication_1_1DataWriter.html#908102c9730fb19be447ed4af01da75e

I found documentation for the write_w_timestamp_untyped.  The documenation says, "Publish a data sample using the given time instead of the current time".

I am not sure about this documentation.  To me there are 2 possibilities.

 1) The instance data WILL be published right away (current time), but the timestamp will indicate the Time_t value passed to the method.

 2) The instance data WILL NOT be published right away (current time), but the data will be published at the Time_t value passed to the method.

It seems it should be definition 2).  If so, does that mean RTI DDS will wait to publish the data at the time passed in the Time_t parameter?  Does RTI DDS set a timer and allow the thread to continue, or does RTI DDS perform a sleep causing the thread to wait?  What if the Time_t parameter is set to some time that has already occurred?

Thanks,

Herb Miller

 

 

 

Organization:
Gerardo Pardo's picture
Offline
Last seen: 1 week 1 day ago
Joined: 06/02/2010
Posts: 602

Hello Herb,

It is the possibility (1) from the two you mentioned. The data will be published "immediately" (some DDS configuration like FlowControl the actual sending of the data). But the "source timestamp" will be the time passed to the method.

As you guessed there are some constraints on the Time_t you pass.  It has to be greater or equal to the previous values of the 'source timestamp' written by that DataWriter, otherwise, the wrote operation will fail.

There is a more general version of this function that has additional documentation. It is called write_w_param

Gerardo

Offline
Last seen: 8 years 6 months ago
Joined: 12/14/2015
Posts: 23

Thanks Gerardo.

Is there any way that RTI DDS will publish data for me at a future time, or do I need to provide my own timer or wait logic and then publish the data immediately?

 

Gerardo Pardo's picture
Offline
Last seen: 1 week 1 day ago
Joined: 06/02/2010
Posts: 602

The "write" into the DataWriter cache happens as part of the write call and the source_timestamp gets set then (unless it is passed as part of the write call).

There are mechanisms to defer the sending of the message on the wire to another thread so that it may happen at a different time. This is what the DataWriter PUBLISH_MODE QosPolicy does.  However, these mechanisms are for prioritizing the data or shaping the bandwidth used. They are not thought to provide the means to "schedule a future time" to send the data.

So to answer your question, yes, I think that you would need to provide your own "timer and wait" logic to do it...

Gerardo

 

Offline
Last seen: 6 years 3 weeks ago
Joined: 10/12/2018
Posts: 7

Hi Gerardo

Can you please tell which function is used to timestamp data with the current clock time. I don't want to send my own generated time.

Is it possible If yes, then how?

sara's picture
Offline
Last seen: 1 year 11 months ago
Joined: 01/16/2013
Posts: 128

Hi,

There's a chapter in our documentation regarding selecting clocks. From our API doc you can read:

The middleware uses two clocks, an internal clock and an external clock. The internal clock is used to measure time and handles all timing in the middleware. The external clock is used solely to generate timestamps, such as the source timestamp and the reception timestamp, in addition to providing the time given by DDSDomainParticipant::get_current_time.

So there's no need for you to get your own timestamp unless you want to. The best way is follow Gerardo's advice: use write_w_param and let the system handle their own clock by setting the correct clock in the configuration.

Is there any specific reason why you want to provide your own time?

Thanks,
Sara