From 6c145193a955cfd6295b11bed3cc7cc9828feb9c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 4 Feb 2011 22:49:23 -0800 Subject: uhd: various performance tweaks --- host/lib/types/time_spec.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'host/lib/types') diff --git a/host/lib/types/time_spec.cpp b/host/lib/types/time_spec.cpp index ece3b92f3..4a41f0fb9 100644 --- a/host/lib/types/time_spec.cpp +++ b/host/lib/types/time_spec.cpp @@ -99,7 +99,7 @@ time_spec_t::time_spec_t(time_t full_secs, double frac_secs): time_spec_t::time_spec_t(time_t full_secs, long tick_count, double tick_rate): _full_secs(full_secs), - _frac_secs(double(tick_count)/tick_rate) + _frac_secs(tick_count/tick_rate) { /* NOP */ } @@ -116,13 +116,11 @@ double time_spec_t::get_real_secs(void) const{ } time_t time_spec_t::get_full_secs(void) const{ - double intpart; - std::modf(this->_frac_secs, &intpart); - return this->_full_secs + time_t(intpart); + return this->_full_secs + time_t(this->_frac_secs); } double time_spec_t::get_frac_secs(void) const{ - return std::fmod(this->_frac_secs, 1.0); + return this->_frac_secs - time_t(this->_frac_secs); } /*********************************************************************** -- cgit v1.2.3