diff options
author | Josh Blum <josh@joshknows.com> | 2011-02-04 22:49:23 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-02-04 22:49:23 -0800 |
commit | 6c145193a955cfd6295b11bed3cc7cc9828feb9c (patch) | |
tree | e16a0409e7a4976e62240109430ae23d1f0f5b8d /host/lib/types | |
parent | dfb3ed0311b9282043b24a2a743093907e088f3d (diff) | |
download | uhd-6c145193a955cfd6295b11bed3cc7cc9828feb9c.tar.gz uhd-6c145193a955cfd6295b11bed3cc7cc9828feb9c.tar.bz2 uhd-6c145193a955cfd6295b11bed3cc7cc9828feb9c.zip |
uhd: various performance tweaks
Diffstat (limited to 'host/lib/types')
-rw-r--r-- | host/lib/types/time_spec.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
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); } /*********************************************************************** |