diff options
author | Josh Blum <josh@joshknows.com> | 2013-04-12 13:41:23 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2013-04-12 13:41:23 -0700 |
commit | cb2473917665903ee5756aba88daf8d59f8ba137 (patch) | |
tree | 38a2bb2ff7922d13964747350b29aabf3d6944d2 /host/tests | |
parent | f01d1a28e2adec61828793c59e3f83817b7f1882 (diff) | |
parent | f1108bd25a369a83ef8227c7564e812d4e27f369 (diff) | |
download | uhd-cb2473917665903ee5756aba88daf8d59f8ba137.tar.gz uhd-cb2473917665903ee5756aba88daf8d59f8ba137.tar.bz2 uhd-cb2473917665903ee5756aba88daf8d59f8ba137.zip |
Merge branch 'maint'
Conflicts:
host/tests/time_spec_test.cpp
Diffstat (limited to 'host/tests')
-rw-r--r-- | host/tests/time_spec_test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/host/tests/time_spec_test.cpp b/host/tests/time_spec_test.cpp index 139a113af..7dee95c5c 100644 --- a/host/tests/time_spec_test.cpp +++ b/host/tests/time_spec_test.cpp @@ -108,3 +108,21 @@ BOOST_AUTO_TEST_CASE(test_time_large_ticks_to_time_spec) std::cout << "t0.get_frac_secs() " << t0.get_frac_secs() << std::endl; BOOST_CHECK_EQUAL(t0.get_full_secs(), time_t(1360217663)); } + +BOOST_AUTO_TEST_CASE(test_time_error_irrational_rate) +{ + static const double rate = 1625e3/6; + const long long tick_in = 23423436291667; + const uhd::time_spec_t ts = uhd::time_spec_t::from_ticks(tick_in, rate); + const long long tick_out = ts.to_ticks(rate); + const long long err = tick_in - tick_out; + + std::cout << std::setprecision(18); + std::cout << "time ............ " << ts.get_real_secs() << std::endl; + std::cout << "tick in ......... " << tick_in << std::endl; + std::cout << "tick out ........ " << tick_out << std::endl; + std::cout << "tick error ...... " << err << std::endl; + std::cout << std::endl; + + BOOST_CHECK_EQUAL(err, (long long)(0)); +} |