aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-01-31 14:44:35 -0800
committerJosh Blum <josh@joshknows.com>2012-01-31 14:44:35 -0800
commit5b06adb7911727353938df84a0a6b71cda66c95c (patch)
treead0040340db02559682164d4f6e134ac019e7dc6 /host
parente30cf4ec6d3c5e5c83fdb8e4ee39632fdb46c0df (diff)
downloaduhd-5b06adb7911727353938df84a0a6b71cda66c95c.tar.gz
uhd-5b06adb7911727353938df84a0a6b71cda66c95c.tar.bz2
uhd-5b06adb7911727353938df84a0a6b71cda66c95c.zip
uhd: branch-less round for time spec convert to ticks
This fixes valgrind warnings with branching on unit'd values, and possible exceptions thrown on bad unit'd values. As it turns out, sometimes tick_rate was passed unit'd, however, the value calculated was not of consequence. Also, iround was overkill because we dont need to handle negative tick rates or frac seconds, or bounds checking.
Diffstat (limited to 'host')
-rw-r--r--host/lib/types/time_spec.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/host/lib/types/time_spec.cpp b/host/lib/types/time_spec.cpp
index e019f1ccd..8e540c14c 100644
--- a/host/lib/types/time_spec.cpp
+++ b/host/lib/types/time_spec.cpp
@@ -16,7 +16,6 @@
//
#include <uhd/types/time_spec.hpp>
-#include <boost/math/special_functions/round.hpp>
using namespace uhd;
@@ -109,7 +108,7 @@ time_spec_t::time_spec_t(time_t full_secs, long tick_count, double tick_rate){
* Time spec accessors
**********************************************************************/
long time_spec_t::get_tick_count(double tick_rate) const{
- return boost::math::iround(this->get_frac_secs()*tick_rate);
+ return long(this->get_frac_secs()*tick_rate + 0.5);
}
double time_spec_t::get_real_secs(void) const{