# Obtaining 'time\_spec' from Out-of-tree C++ Module

**URL:** <https://www.ruby-forum.com/t/obtaining-time-spec-from-out-of-tree-c-module/240789>\
**Category:** GNU Radio\
**Created:** [April 30, 2014, 2:28pm UTC](https://www.ruby-forum.com/t/obtaining-time-spec-from-out-of-tree-c-module/240789 "2014-04-30T14:28:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [April 30, 2014, 2:28pm UTC](https://www.ruby-forum.com/t/obtaining-time-spec-from-out-of-tree-c-module/240789/1 "2014-04-30T14:28:07Z")

</div>

Dear All,

I would like to have knowledge of the USRP time in my transmitter flow  
graph. In the receiver flow graph this is straight forward because  
‘rx\_time’ tag is propagated from a USRP source as a tag.

How can I obtain the time\_spec from a c++ block in my transmitter flow  
graph?

“usrp\_sink\_impl.cc” has the function

```
::uhd::time_spec_t
usrp_sink_impl::get_time_now(size_t mboard)
{
  return _dev->get_time_now(mboard);
}

```

But how can I call this from outside the usrp\_sink block?

Many thanks!

David

* * *

NOTE: The information in this email and any attachments may be  
confidential and/or legally privileged. This message may be read, copied  
and used only by the intended recipient. If you are not the intended  
recipient, please destroy this message, delete any copies held on your  
system and notify the sender immediately.

Toshiba Research Europe Limited, registered in England and Wales  
(2519556). Registered Office 208 Cambridge Science Park, Milton Road,  
Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [April 30, 2014, 3:38pm UTC](https://www.ruby-forum.com/t/obtaining-time-spec-from-out-of-tree-c-module/240789/2 "2014-04-30T15:38:21Z")

</div>

Hello David,

as get\_time\_now is a public function of usrp\_sink, it is accessible from  
everywhere 🙂  
You’ll need a (shared) pointer to that usrp\_sink;using that, you can do  
something like  
uhd::time\_spec\_t now = my\_usrp\_sink-\>get\_time\_now();  
You could, for example, take an usrp\_sink::sptr as an argument for your  
block’s constructor and store that reference to use it later in your  
work()  
function.

Greetings,  
Marcus

On Wed, Apr 30, 2014 at 2:26 PM, David Halls

---

<div class="post-metadata">

**Author:** ![divotdave](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bbe5ce/32.png) [@divotdave](https://www.ruby-forum.com/u/divotdave)\
**Post date:** [April 30, 2014, 4:07pm UTC](https://www.ruby-forum.com/t/obtaining-time-spec-from-out-of-tree-c-module/240789/3 "2014-04-30T16:07:06Z")

</div>

Hi Marcus!

> > get\_time\_now is a public function of usrp\_sink, it is accessible from  
> > everywhere 🙂

Great, I thought it was a public function, just wasn’t sure how to get a  
pointer to it.

> > uhd::time\_spec\_t now = my\_usrp\_sink-\>get\_time\_now();

Sure thing.

> > You’ll need a (shared) pointer to that usrp\_sink

I am not clear how I obtain that (to then I pass it to my C++ module as  
a constructor?)

Regards,

David

* * *

From: Marcus Müller [removed\_email\_address@domain.invalid]  
Sent: 30 April 2014 14:37  
To: David Halls  
Cc: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: [Discuss-gnuradio] Obtaining ‘time\_spec’ from Out-of-tree  
C++ Module

Hello David,

as get\_time\_now is a public function of usrp\_sink, it is accessible from  
everywhere 🙂  
You’ll need a (shared) pointer to that usrp\_sink;using that, you can do  
something like  
uhd::time\_spec\_t now = my\_usrp\_sink-\>get\_time\_now();  
You could, for example, take an usrp\_sink::sptr as an argument for your  
block’s constructor and store that reference to use it later in your  
work() function.

Greetings,  
Marcus

On Wed, Apr 30, 2014 at 2:26 PM, David Halls  
\<[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\>  
wrote:  
Dear All,

I would like to have knowledge of the USRP time in my transmitter flow  
graph. In the receiver flow graph this is straight forward because  
‘rx\_time’ tag is propagated from a USRP source as a tag.

How can I obtain the time\_spec from a c++ block in my transmitter flow  
graph?

“usrp\_sink\_impl.cc” has the function

::uhd::time\_spec\_t  
usrp\_sink\_impl::get\_time\_now(size\_t mboard)  
{  
return \_dev-\>get\_time\_now(mboard);  
}

But how can I call this from outside the usrp\_sink block?

Many thanks!

David

* * *

NOTE: The information in this email and any attachments may be  
confidential and/or legally privileged. This message may be read, copied  
and used only by the intended recipient. If you are not the intended  
recipient, please destroy this message, delete any copies held on your  
system and notify the sender immediately.

Toshiba Research Europe Limited, registered in England and Wales  
(2519556). Registered Office 208 Cambridge Science Park, Milton Road,  
Cambridge CB4 0GZ, England. Web:  
www.toshiba.eu/research/trl[http://www.toshiba.eu/research/trl](http://www.toshiba.eu/research/trl)

* * *

This email has been scanned for email related threats and delivered  
safely by Mimecast.  
For more information please visit [http://www.mimecast.com](http://www.mimecast.com)

* * *

* * *

Discuss-gnuradio mailing list  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[Discuss-gnuradio Info Page](https://lists.gnu.org/mailman/listinfo/discuss-gnuradio)

* * *

NOTE: The information in this email and any attachments may be  
confidential and/or legally privileged. This message may be read, copied  
and used only by the intended recipient. If you are not the intended  
recipient, please destroy this message, delete any copies held on your  
system and notify the sender immediately.

Toshiba Research Europe Limited, registered in England and Wales  
(2519556). Registered Office 208 Cambridge Science Park, Milton Road,  
Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl
