diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2014-04-15 16:48:06 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2014-04-15 16:48:06 -0700 |
commit | 4313320c03e7195c183d6ce3d5c58775b2e217be (patch) | |
tree | 25c8040a7317c608ace5249de03b13a2af47347d | |
parent | f281fb9d18192cf878f40b2e77501822e093d0a5 (diff) | |
parent | 9df52c1b0c598872c7ae1cd92c885ef1e92f4a4f (diff) |
Merge remote-tracking branch 'mmueller/gr_uhd_time_spec_t_fix'
-rw-r--r-- | gr-uhd/python/uhd/qa_uhd.py | 8 | ||||
-rw-r--r-- | gr-uhd/swig/uhd_swig.i | 15 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gr-uhd/python/uhd/qa_uhd.py b/gr-uhd/python/uhd/qa_uhd.py index 511c098753..4df0d4273e 100644 --- a/gr-uhd/python/uhd/qa_uhd.py +++ b/gr-uhd/python/uhd/qa_uhd.py @@ -35,6 +35,14 @@ class test_uhd(gr_unittest.TestCase): They may not have a UHD device connected, etc. Don't try to run anything""" pass + def test_time_spec_t (self): + seconds = 42.0 + time = uhd.time_spec_t(seconds) + twice_time = time + time; + zero_time = time - time; + self.assertEqual(time.get_real_secs() * 2, seconds * 2 ) + self.assertEqual(time.get_real_secs() - time.get_real_secs() , 0.0) + def test_stream_args_channel_foo(self): """ Try to manipulate the stream args channels for proper swig'ing checks. diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i index c98416f307..4eaef9112d 100644 --- a/gr-uhd/swig/uhd_swig.i +++ b/gr-uhd/swig/uhd_swig.i @@ -84,6 +84,21 @@ %include <uhd/types/time_spec.hpp> +%extend uhd::time_spec_t{ + uhd::time_spec_t __add__(const uhd::time_spec_t &what) + { + uhd::time_spec_t temp = *self; + temp += what; + return temp; + } + uhd::time_spec_t __sub__(const uhd::time_spec_t &what) + { + uhd::time_spec_t temp = *self; + temp -= what; + return temp; + } +}; + %include <uhd/types/stream_cmd.hpp> %include <uhd/types/clock_config.hpp> |