aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPiotr Krysik <ptrkrysik@gmail.com>2017-10-31 12:57:26 +0100
committerPiotr Krysik <ptrkrysik@gmail.com>2017-10-31 12:57:26 +0100
commit1dd2afe367b52cc1d77ca11a3832bf1fdcac6ef2 (patch)
treed60fe9bcd4b4354b502856ea01db55c09866a9e9 /lib
parent34ce7a02f071c0aa4661799aa566236c92955d74 (diff)
Changed fn_time to use time_spec_t copied from libUHD
Diffstat (limited to 'lib')
-rw-r--r--lib/misc_utils/CMakeLists.txt1
-rw-r--r--lib/misc_utils/fn_time.cc4
-rw-r--r--lib/misc_utils/time_spec.cc (renamed from lib/receiver/time_spec.cc)0
-rw-r--r--lib/receiver/CMakeLists.txt1
-rw-r--r--lib/receiver/time_sample_ref.h2
-rw-r--r--lib/receiver/time_spec.h147
6 files changed, 3 insertions, 152 deletions
diff --git a/lib/misc_utils/CMakeLists.txt b/lib/misc_utils/CMakeLists.txt
index 8597553..81f2ca8 100644
--- a/lib/misc_utils/CMakeLists.txt
+++ b/lib/misc_utils/CMakeLists.txt
@@ -32,6 +32,7 @@ add_sources(
message_printer_impl.cc
msg_to_tag_impl.cc
tmsi_dumper_impl.cc
+ time_spec.cc
fn_time.cc
)
diff --git a/lib/misc_utils/fn_time.cc b/lib/misc_utils/fn_time.cc
index 5248211..25c8e65 100644
--- a/lib/misc_utils/fn_time.cc
+++ b/lib/misc_utils/fn_time.cc
@@ -23,7 +23,6 @@
#include <grgsm/misc_utils/fn_time.h>
#include <math.h>
-#include <uhd/types/time_spec.hpp>
#define GSM_HYPER_FRAME 26 * 51 * 2048
#define GSM_SYM_RATE 13.0e6 / 48.0
@@ -33,7 +32,6 @@
namespace gr {
namespace gsm {
- using namespace uhd;
/**
* Computes difference between two frame numbers modulo
* GSM_HYPER_FRAME / 2. The result is correct if difference
@@ -79,7 +77,7 @@ namespace gr {
* frame numbers
* @return difference between fn_ref and fn
*/
- time_spec_t fn_time_delta(uint32_t fn_ref, time_spec_t time_ref, uint32_t fn_x,
+ time_spec_t fn_time_delta2(uint32_t fn_ref, time_spec_t time_ref, uint32_t fn_x,
time_spec_t time_hint, uint32_t ts_num, uint32_t ts_ref)
{
time_spec_t time_diff_hint = time_hint - time_ref;
diff --git a/lib/receiver/time_spec.cc b/lib/misc_utils/time_spec.cc
index 205508d..205508d 100644
--- a/lib/receiver/time_spec.cc
+++ b/lib/misc_utils/time_spec.cc
diff --git a/lib/receiver/CMakeLists.txt b/lib/receiver/CMakeLists.txt
index 1c5fd53..123eba5 100644
--- a/lib/receiver/CMakeLists.txt
+++ b/lib/receiver/CMakeLists.txt
@@ -23,6 +23,5 @@ add_sources(
receiver_config.cc
receiver_impl.cc
viterbi_detector.cc
- time_spec.cc
time_sample_ref.cc
)
diff --git a/lib/receiver/time_sample_ref.h b/lib/receiver/time_sample_ref.h
index 1fecb81..793944d 100644
--- a/lib/receiver/time_sample_ref.h
+++ b/lib/receiver/time_sample_ref.h
@@ -24,7 +24,7 @@
#define INCLUDED_TIME_SAMPLE_REF_IMPL_H
#include <stdint.h>
-#include "time_spec.h"
+#include <grgsm/misc_utils/time_spec.h>
namespace gr {
namespace gsm {
diff --git a/lib/receiver/time_spec.h b/lib/receiver/time_spec.h
deleted file mode 100644
index cc7f104..0000000
--- a/lib/receiver/time_spec.h
+++ /dev/null
@@ -1,147 +0,0 @@
-//
-// Copyright 2010-2012 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_TYPES_TIME_SPEC_HPP
-#define INCLUDED_TYPES_TIME_SPEC_HPP
-
-#include <boost/operators.hpp>
-#include <ctime>
-
-namespace gr {
- namespace gsm {
-
- /*!
- * A time_spec_t holds a seconds and a fractional seconds time value.
- * Depending upon usage, the time_spec_t can represent absolute times,
- * relative times, or time differences (between absolute times).
- *
- * The time_spec_t provides clock-domain independent time storage,
- * but can convert fractional seconds to/from clock-domain specific units.
- *
- * The fractional seconds are stored as double precision floating point.
- * This gives the fractional seconds enough precision to unambiguously
- * specify a clock-tick/sample-count up to rates of several petahertz.
- */
- class time_spec_t : boost::additive<time_spec_t>, boost::totally_ordered<time_spec_t>{
- public:
-
- /*!
- * Get the system time in time_spec_t format.
- * Uses the highest precision clock available.
- * \return the system time as a time_spec_t
- */
- static time_spec_t get_system_time(void);
-
- /*!
- * Copy constructor
- */
- time_spec_t(const time_spec_t & spec);
-
- /*!
- * Create a time_spec_t from a real-valued seconds count.
- * \param secs the real-valued seconds count (default = 0)
- */
- time_spec_t(double secs = 0);
-
- /*!
- * Create a time_spec_t from whole and fractional seconds.
- * \param full_secs the whole/integer seconds count
- * \param frac_secs the fractional seconds count (default = 0)
- */
- time_spec_t(time_t full_secs, double frac_secs = 0);
-
- /*!
- * Create a time_spec_t from whole seconds and fractional ticks.
- * Translation from clock-domain specific units.
- * \param full_secs the whole/integer seconds count
- * \param tick_count the fractional seconds tick count
- * \param tick_rate the number of ticks per second
- */
- time_spec_t(time_t full_secs, long tick_count, double tick_rate);
-
- /*!
- * Create a time_spec_t from a 64-bit tick count.
- * Translation from clock-domain specific units.
- * \param ticks an integer count of ticks
- * \param tick_rate the number of ticks per second
- */
- static time_spec_t from_ticks(long long ticks, double tick_rate);
-
- /*!
- * Convert the fractional seconds to clock ticks.
- * Translation into clock-domain specific units.
- * \param tick_rate the number of ticks per second
- * \return the fractional seconds tick count
- */
- long get_tick_count(double tick_rate) const;
-
- /*!
- * Convert the time spec into a 64-bit tick count.
- * Translation into clock-domain specific units.
- * \param tick_rate the number of ticks per second
- * \return an integer number of ticks
- */
- long long to_ticks(const double tick_rate) const;
-
- /*!
- * Get the time as a real-valued seconds count.
- * Note: If this time_spec_t represents an absolute time,
- * the precision of the fractional seconds may be lost.
- * \return the real-valued seconds
- */
- double get_real_secs(void) const;
-
- /*!
- * Get the whole/integer part of the time in seconds.
- * \return the whole/integer seconds
- */
- time_t get_full_secs(void) const;
-
- /*!
- * Get the fractional part of the time in seconds.
- * \return the fractional seconds
- */
- double get_frac_secs(void) const;
-
- //! Implement addable interface
- time_spec_t &operator+=(const time_spec_t &);
-
- //! Implement subtractable interface
- time_spec_t &operator-=(const time_spec_t &);
-
- //private time storage details
- private: time_t _full_secs; double _frac_secs;
- };
-
- //! Implement equality_comparable interface
- bool operator==(const time_spec_t &, const time_spec_t &);
-
- //! Implement less_than_comparable interface
- bool operator<(const time_spec_t &, const time_spec_t &);
-
- inline time_t time_spec_t::get_full_secs(void) const{
- return this->_full_secs;
- }
-
- inline double time_spec_t::get_frac_secs(void) const{
- return this->_frac_secs;
- }
-
- } //namespace transceiver
-} //namespace gr
-
-#endif /* INCLUDED_TYPES_TIME_SPEC_HPP */