summaryrefslogtreecommitdiff
path: root/mblock/src/lib
diff options
context:
space:
mode:
authoreb2008-06-19 15:04:26 +0000
committereb2008-06-19 15:04:26 +0000
commit8b04fb2beeae36bbbb8d66ce95dea7df8edb65be (patch)
tree4af4834b661ea2d6d502f30e6f2844ba0033d7f0 /mblock/src/lib
parentdf0ae475f782814c95d4f9be166aaffbcc7d47b1 (diff)
downloadgnuradio-8b04fb2beeae36bbbb8d66ce95dea7df8edb65be.tar.gz
gnuradio-8b04fb2beeae36bbbb8d66ce95dea7df8edb65be.tar.bz2
gnuradio-8b04fb2beeae36bbbb8d66ce95dea7df8edb65be.zip
Moved mb_time to omni_time and left mb_time.h with typedef to maintain
backwards compatibility. Removed gcell's dependency on mblocks. Now gcell only depends on omnithread. Merged eb/wip -r8621:8623 to trunk. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8624 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'mblock/src/lib')
-rw-r--r--mblock/src/lib/Makefile.am1
-rw-r--r--mblock/src/lib/mb_time.cc84
-rw-r--r--mblock/src/lib/mb_time.h68
3 files changed, 3 insertions, 150 deletions
diff --git a/mblock/src/lib/Makefile.am b/mblock/src/lib/Makefile.am
index 4bdd9b1a8..a005f8300 100644
--- a/mblock/src/lib/Makefile.am
+++ b/mblock/src/lib/Makefile.am
@@ -61,7 +61,6 @@ libmblock_la_SOURCES = \
mb_runtime_base.cc \
mb_runtime_nop.cc \
mb_runtime_thread_per_block.cc \
- mb_time.cc \
mb_timer_queue.cc \
mb_util.cc \
mb_worker.cc
diff --git a/mblock/src/lib/mb_time.cc b/mblock/src/lib/mb_time.cc
deleted file mode 100644
index 48b2c6668..000000000
--- a/mblock/src/lib/mb_time.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio 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, or (at your option)
- * any later version.
- *
- * GNU Radio 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <mb_time.h>
-#include <omnithread.h>
-#include <math.h>
-#include <assert.h>
-
-
-mb_time::mb_time(double real_secs)
-{
- double floor_secs = floor(real_secs);
- d_secs = (long) floor_secs;
- d_nsecs = (long) ((real_secs - floor_secs) * 1e9); // always positive
-}
-
-mb_time
-mb_time::time(const mb_time &delta_t)
-{
- unsigned long abs_sec, abs_nsec;
- unsigned long rel_sec = delta_t.d_secs;
- unsigned long rel_nsec = delta_t.d_nsecs;
-
- omni_thread::get_time(&abs_sec, &abs_nsec, rel_sec, rel_nsec);
- return mb_time(abs_sec, abs_nsec);
-}
-
-
-mb_time
-operator+(const mb_time &x, const mb_time &y)
-{
- mb_time r(x.d_secs + y.d_secs, x.d_nsecs + y.d_nsecs);
- while (r.d_nsecs >= 1000000000){
- r.d_nsecs -= 1000000000;
- r.d_secs++;
- }
- return r;
-}
-
-mb_time
-operator-(const mb_time &x, const mb_time &y)
-{
- // assert(!(x < y));
-
- mb_time r(x.d_secs - y.d_secs, x.d_nsecs - y.d_nsecs);
- while (r.d_nsecs < 0){
- r.d_nsecs += 1000000000;
- r.d_secs--;
- }
- return r;
-}
-
-mb_time
-operator+(const mb_time &x, double y)
-{
- return x + mb_time(y);
-}
-
-mb_time
-operator-(const mb_time &x, double y)
-{
- return x - mb_time(y);
-}
diff --git a/mblock/src/lib/mb_time.h b/mblock/src/lib/mb_time.h
index b9c655b6e..cba6be785 100644
--- a/mblock/src/lib/mb_time.h
+++ b/mblock/src/lib/mb_time.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2008 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -21,69 +21,7 @@
#ifndef INCLUDED_MB_TIME_H
#define INCLUDED_MB_TIME_H
-struct mb_time {
- long int d_secs; // seconds.
- long int d_nsecs; // nanoseconds. Always in [0, 1e9-1]
-
- mb_time() : d_secs(0), d_nsecs(0) {}
- mb_time(long secs, long nanosecs=0) : d_secs(secs), d_nsecs(nanosecs) {}
-
- // N.B., this only makes sense for differences between times.
- // Double doesn't have enough bits to precisely represent an absolute time.
- mb_time(double secs);
-
- // N.B. This only makes sense for differences between times.
- // Double doesn't have enough bits to precisely represent an absolute time.
- double double_time() const { return (double)d_secs + d_nsecs * 1e-9; }
-
- /*!
- * \brief Return an absolute time suitable for use with
- * schedule_one_shot_timeout & schedule_periodic_timeout
- *
- * The return value is the current time plus the given relative offset.
- */
- static mb_time time(const mb_time &relative_offset = mb_time());
-};
-
-
-inline static bool
-operator<(const mb_time &x, const mb_time &y)
-{
- return ((x.d_secs < y.d_secs)
- || (x.d_secs == y.d_secs && x.d_nsecs < y.d_nsecs));
-}
-
-inline static bool
-operator>(const mb_time &x, const mb_time &y)
-{
- return ((x.d_secs > y.d_secs)
- || (x.d_secs == y.d_secs && x.d_nsecs > y.d_nsecs));
-}
-
-inline static bool
-operator>=(const mb_time &x, const mb_time &y)
-{
- return ((x.d_secs > y.d_secs)
- || (x.d_secs == y.d_secs && x.d_nsecs >= y.d_nsecs));
-}
-
-inline static bool
-operator<=(const mb_time &x, const mb_time &y)
-{
- return ((x.d_secs < y.d_secs)
- || (x.d_secs == y.d_secs && x.d_nsecs <= y.d_nsecs));
-}
-
-inline static bool
-operator==(const mb_time &x, const mb_time &y)
-{
- return (x.d_secs == y.d_secs && x.d_nsecs == y.d_nsecs);
-}
-
-
-mb_time operator+(const mb_time &x, const mb_time &y);
-mb_time operator+(const mb_time &x, double y);
-mb_time operator-(const mb_time &x, const mb_time &y);
-mb_time operator-(const mb_time &x, double y);
+#include <omni_time.h>
+typedef omni_time mb_time;
#endif /* INCLUDED_MB_TIME_H */