diff options
Diffstat (limited to 'mblock/src/lib/mb_time.h')
-rw-r--r-- | mblock/src/lib/mb_time.h | 68 |
1 files changed, 3 insertions, 65 deletions
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 */ |