From 5b06adb7911727353938df84a0a6b71cda66c95c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 31 Jan 2012 14:44:35 -0800 Subject: 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. --- host/lib/types/time_spec.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'host/lib') 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 -#include 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{ -- cgit v1.2.3