diff options
author | Vidush <vidush.vishwanath@ettus.com> | 2018-06-26 12:06:42 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-06-26 13:51:34 -0700 |
commit | 523994c793c8e63f7b30657e06ce3588de0855c1 (patch) | |
tree | 934d1876e37bb4bcdc6433e6d71b7f7220661722 /host | |
parent | f2896713d48f6c0bc19a859f5ad506e0ddd7ae61 (diff) | |
download | uhd-523994c793c8e63f7b30657e06ce3588de0855c1.tar.gz uhd-523994c793c8e63f7b30657e06ce3588de0855c1.tar.bz2 uhd-523994c793c8e63f7b30657e06ce3588de0855c1.zip |
fixup! Time_spec: Add Operators
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/types/time_spec.hpp | 4 | ||||
-rw-r--r-- | host/lib/types/time_spec.cpp | 19 |
2 files changed, 10 insertions, 13 deletions
diff --git a/host/include/uhd/types/time_spec.hpp b/host/include/uhd/types/time_spec.hpp index a8173d471..32810c6e9 100644 --- a/host/include/uhd/types/time_spec.hpp +++ b/host/include/uhd/types/time_spec.hpp @@ -98,8 +98,8 @@ namespace uhd{ //! Implement addable interface time_spec_t &operator+=(const time_spec_t &); time_spec_t &operator+=(double &); - time_spec_t &operator+(double &); - time_spec_t &operator+(const time_spec_t &); + time_spec_t operator+(double &); + time_spec_t operator+(const time_spec_t &); //! Implement subtractable interface time_spec_t &operator-=(const time_spec_t &); diff --git a/host/lib/types/time_spec.cpp b/host/lib/types/time_spec.cpp index 124b08ac9..907e97d1a 100644 --- a/host/lib/types/time_spec.cpp +++ b/host/lib/types/time_spec.cpp @@ -91,21 +91,18 @@ time_spec_t &time_spec_t::operator+=(double &rhs){ return *this; } -time_spec_t &time_spec_t::operator+(double &rhs){ +time_spec_t time_spec_t::operator+(double &rhs){ double full_secs = std::trunc(rhs); - time_spec_init( - this->get_full_secs() + full_secs, - this->get_frac_secs() + rhs - full_secs - ); - return *this; + time_spec_t toRet(this->get_full_secs() + full_secs, + this->get_frac_secs() + rhs - full_secs); + return toRet; } -time_spec_t &time_spec_t::operator+(const time_spec_t &rhs){ - time_spec_init( +time_spec_t time_spec_t::operator+(const time_spec_t &rhs){ + time_spec_t toRet( this->get_full_secs() + rhs.get_full_secs(), - this->get_frac_secs() + rhs.get_frac_secs() - ); - return *this; + this->get_frac_secs() + rhs.get_frac_secs()); + return toRet; } time_spec_t &time_spec_t::operator-=(const time_spec_t &rhs){ |