[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] How to create uhd's time_spec_t from Python
From: |
Piotr Krysik |
Subject: |
[Discuss-gnuradio] How to create uhd's time_spec_t from Python |
Date: |
Wed, 13 Sep 2017 19:08:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
Hi All,
time_spec_t is a class representing time in UHD. It uses time_t (long
int) for representing full seconds and double for parts of a second.
This format of time is usable to tell USRPs when to do certain tasks. It
is also very usable for operations on time without loosing precision.
In c++ time_spec_t can be constructed from time represented by a double
(not precise if number of full seconds is large) or from time_t and
double. Both constructors are exposed by SWIG in Python.
When I construct time_spec from double everything is fine:
>>> from gnuradio import uhd
>>> uhd.time_spec(10)
But when I construct from int and float I get an error:
>>> uhd.time_spec(10,0.1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/gnuradio/uhd/uhd_swig.py", line
1576, in __init__
this = _uhd_swig.new_time_spec_t(*args)
NotImplementedError: Wrong number or type of arguments for overloaded
function 'new_time_spec_t'.
Possible C/C++ prototypes are:
uhd::time_spec_t::time_spec_t(double)
uhd::time_spec_t::time_spec_t(time_t,double)
uhd::time_spec_t::time_spec_t(time_t,long,double)
Somehow Python's integer is not recognized as compatible with time_t
parameter in the second constructor
(uhd::time_spec_t::time_spec_t(time_t,double) ).
My question:
Is there a way to use time_spec_t's constructor
uhd::time_spec_t::time_spec_t(time_t,double) from Python interface
exposed by GNU Radio? In my opinion there should be, otherwise why to
expose it through SWIG.
--
Best Regards,
Piotr Krysik
- [Discuss-gnuradio] How to create uhd's time_spec_t from Python,
Piotr Krysik <=