Using get_time_now in python

Hello everyone,

A simple problem for you guys which is giving me tough time though :slight_smile:

I have a custom gnuradio block which requires the current time in usrp
FPGA. So, I do the following in my python flow-graph file:

self.uhd_usrp_sink_0 = uhd.usrp_sink(
device_addr="",
io_type=uhd.io_type.COMPLEX_FLOAT32,
num_channels=1,
)
secs = self.uhd_usrp_sink_0.get_time_now().get_full_secs().to_int()+1
fracs = self.uhd_usrp_sink_0.get_time_now().get_frac_secs()

I then pass secs and fracs to my custom block as parameters. Now the
issue is that I get following error message when I run the python file:

swig/python detected a memory leak of type ‘time_t *’, no destructor
found.
Traceback (most recent call last):
File “./top_block.py”, line 75, in
tb = top_block()
File “./top_block.py”, line 43, in init
secs = self.uhd_usrp_sink_0.get_time_now().get_full_secs().to_int()+1
AttributeError: ‘SwigPyObject’ object has no attribute ‘to_int’

Could someone suggest how to fix it. Thanks in advance for the help.

Yu

swig/python detected a memory leak of type ‘time_t *’, no destructor found.
Traceback (most recent call last):
File “./top_block.py”, line 75, in
tb = top_block()
File “./top_block.py”, line 43, in init
secs = self.uhd_usrp_sink_0.get_time_now().get_full_secs().to_int()+1
AttributeError: ‘SwigPyObject’ object has no attribute ‘to_int’

See the API for time_spec:
http://files.ettus.com/uhd_docs/doxygen/html/classuhd_1_1time__spec__t.html

-josh