How to display Source_Timestamps format like 'yyyy-dd-mm hh:mm:ss.fff' at dotnet

2 posts / 0 new
Last post
Last seen: 8 months 3 weeks ago
Joined: 09/29/2019
Posts: 1
How to display Source_Timestamps format like 'yyyy-dd-mm hh:mm:ss.fff' at dotnet

I am currently working on a project that deals with the Publisher and Subscriber.

Using dotnet(exactly c#) as the coding language, I want to see how long it takes for a Publisher to deliver a message to a Subscriber,

and then again to deliver the message to the original Publisher. In other words, I want to know how long it takes for the message to return.


I know there are Source_timestamp and reception_timestamp fields.

However, the subscriber receives a message from the publisher and the value of the Source_timestamp field of the message consist of seconds and nanoseconds.

I would like to know how can convert that seconds and nanoseconds to 'yyyy-mdd-dd hh:mm:ss.fff" format at dotnet.


Also, I would like to know if there is only one way to check how long it takes for a message to return. (Publisher → Subsciber → Publihser)

1) Publisher publish message by topic 'A'

2) Subscriber get mesaage by topic 'A'

3) Subscriber store source_timestamp filed value to message value.

4) Subscriber publish message by topic 'B'

5) Publisher get message by topic 'B'

6) Publisher obtains the duration between the reception_timestamp filed value and the message value(original source_timestamp)

7) that duration is message return time??

Last seen: 4 days 13 hours ago
Joined: 06/17/2019
Posts: 12

Have you looked at using our perftest tool? It looks like it can accomplish what you're after without a lot of work. 

Most people use it to test throughput, but by default it will periodically measure round trip latency with echo request and reply messages. However if all you're interested in is round trip measurements you can change a few command line parameters to adapt the tool to your latency testing needs. The list of command line arguements is available here, and you may want to read this 'additional information' section about latency testing. 

Seperate from perftest, there are a few other things you may want to know about timestamping in DDS. When you write samples DDS will normally use its own clock source it has available. However if your application would like to provide its own timestamp you can do that with write_w_timestamp()
And if you'd like to enable timestampping when using logging you can call set_print_format() to change that.

I'm not entirely clear on your timestamp conversion question, but I'll provide an example timestamp I pulled from admin console to show you how it can be broken up:
example: 2019-10-04 09:30:45.754990281

year: 2019
month: 10
day: 04
hour: 09
minute: 30
second: 45
millisecond: 754
microsecond: 990
nanosecond: 281