summaryrefslogtreecommitdiff
path: root/gr-qtgui/lib
diff options
context:
space:
mode:
authorJosh Blum2011-06-07 21:48:02 -0400
committerTom Rondeau2011-06-07 21:48:02 -0400
commit697562c3d4319ab6f13e4c2910a853409731595d (patch)
tree9ab54b8e3a3e17bed020783f1a5ef6f9c7377b0a /gr-qtgui/lib
parent275d14afc2b2f4088db204213cf14ab75499cc4e (diff)
downloadgnuradio-697562c3d4319ab6f13e4c2910a853409731595d.tar.gz
gnuradio-697562c3d4319ab6f13e4c2910a853409731595d.tar.bz2
gnuradio-697562c3d4319ab6f13e4c2910a853409731595d.zip
qtgui: replace timespec with typedef so its easier to replace
Diffstat (limited to 'gr-qtgui/lib')
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.cc4
-rw-r--r--gr-qtgui/lib/ConstellationDisplayPlot.h2
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.cc4
-rw-r--r--gr-qtgui/lib/FrequencyDisplayPlot.h2
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.cc20
-rw-r--r--gr-qtgui/lib/SpectrumGUIClass.h8
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.cc18
-rw-r--r--gr-qtgui/lib/WaterfallDisplayPlot.h4
-rw-r--r--gr-qtgui/lib/highResTimeFunctions.h196
-rw-r--r--gr-qtgui/lib/qtgui_sink_c.cc2
-rw-r--r--gr-qtgui/lib/qtgui_sink_f.cc2
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_c.cc4
-rw-r--r--gr-qtgui/lib/qtgui_time_sink_f.cc4
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.cc8
-rw-r--r--gr-qtgui/lib/spectrumUpdateEvents.h12
-rw-r--r--gr-qtgui/lib/spectrumdisplayform.cc4
16 files changed, 159 insertions, 135 deletions
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.cc b/gr-qtgui/lib/ConstellationDisplayPlot.cc
index 7ec2db820..fc3293bc7 100644
--- a/gr-qtgui/lib/ConstellationDisplayPlot.cc
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.cc
@@ -58,7 +58,7 @@ protected:
ConstellationDisplayPlot::ConstellationDisplayPlot(QWidget* parent)
: QwtPlot(parent)
{
- timespec_reset(&_lastReplot);
+ highres_timespec_reset(&_lastReplot);
resize(parent->width(), parent->height());
@@ -183,7 +183,7 @@ void ConstellationDisplayPlot::PlotNewData(const double* realDataPoints,
const double timeInterval)
{
if((numDataPoints > 0) &&
- (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
+ (diff_highres_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
if(numDataPoints != _numPoints){
_numPoints = numDataPoints;
diff --git a/gr-qtgui/lib/ConstellationDisplayPlot.h b/gr-qtgui/lib/ConstellationDisplayPlot.h
index 3a85f3bc3..38e401c68 100644
--- a/gr-qtgui/lib/ConstellationDisplayPlot.h
+++ b/gr-qtgui/lib/ConstellationDisplayPlot.h
@@ -83,7 +83,7 @@ private:
double* _realDataPoints;
double* _imagDataPoints;
- timespec _lastReplot;
+ highres_timespec _lastReplot;
int64_t _numPoints;
int64_t _penSize;
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.cc b/gr-qtgui/lib/FrequencyDisplayPlot.cc
index 4d60cd9be..e8c8e230d 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.cc
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.cc
@@ -120,7 +120,7 @@ FrequencyDisplayPlot::FrequencyDisplayPlot(QWidget* parent)
_startFrequency = 0;
_stopFrequency = 4000;
- timespec_reset(&_lastReplot);
+ highres_timespec_reset(&_lastReplot);
resize(parent->width(), parent->height());
@@ -362,7 +362,7 @@ FrequencyDisplayPlot::PlotNewData(const double* dataPoints, const int64_t numDat
{
// Only update plot if there is data and if the time interval has elapsed
if((numDataPoints > 0) &&
- (diff_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
+ (diff_highres_timespec(get_highres_clock(), _lastReplot) > timeInterval)) {
if(numDataPoints != _numPoints) {
_numPoints = numDataPoints;
diff --git a/gr-qtgui/lib/FrequencyDisplayPlot.h b/gr-qtgui/lib/FrequencyDisplayPlot.h
index 6689703bc..98c8d77b1 100644
--- a/gr-qtgui/lib/FrequencyDisplayPlot.h
+++ b/gr-qtgui/lib/FrequencyDisplayPlot.h
@@ -122,7 +122,7 @@ private:
double _noiseFloorAmplitude;
- timespec _lastReplot;
+ highres_timespec _lastReplot;
bool _useCenterFrequencyFlag;
};
diff --git a/gr-qtgui/lib/SpectrumGUIClass.cc b/gr-qtgui/lib/SpectrumGUIClass.cc
index b472470c6..798554ab6 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.cc
+++ b/gr-qtgui/lib/SpectrumGUIClass.cc
@@ -54,7 +54,7 @@ SpectrumGUIClass::SpectrumGUIClass(const uint64_t maxDataSize,
_windowType = 5;
- timespec_reset(&_lastGUIUpdateTime);
+ highres_timespec_reset(&_lastGUIUpdateTime);
_windowOpennedFlag = false;
_fftBuffersCreatedFlag = false;
@@ -123,7 +123,7 @@ SpectrumGUIClass::OpenSpectrumWindow(QWidget* parent,
qApp->postEvent(_spectrumDisplayForm,
new QEvent(QEvent::Type(QEvent::User+3)));
- timespec_reset(&_lastGUIUpdateTime);
+ highres_timespec_reset(&_lastGUIUpdateTime);
// Draw Blank Display
UpdateWindow(false, NULL, 0, NULL, 0, NULL, 0, get_highres_clock(), true);
@@ -229,7 +229,7 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag,
const uint64_t realTimeDomainDataSize,
const float* complexTimeDomainData,
const uint64_t complexTimeDomainDataSize,
- const timespec timestamp,
+ const highres_timespec timestamp,
const bool lastOfMultipleFFTUpdateFlag)
{
//gruel::scoped_lock lock(d_mutex);
@@ -283,11 +283,11 @@ SpectrumGUIClass::UpdateWindow(const bool updateDisplayFlag,
_lastDataPointCount = bufferSize;
}
- const timespec currentTime = get_highres_clock();
- const timespec lastUpdateGUITime = GetLastGUIUpdateTime();
+ const highres_timespec currentTime = get_highres_clock();
+ const highres_timespec lastUpdateGUITime = GetLastGUIUpdateTime();
- if((diff_timespec(currentTime, lastUpdateGUITime) > (4*_updateTime)) &&
- (GetPendingGUIUpdateEvents() > 0) && !timespec_empty(&lastUpdateGUITime)) {
+ if((diff_highres_timespec(currentTime, lastUpdateGUITime) > (4*_updateTime)) &&
+ (GetPendingGUIUpdateEvents() > 0) && !highres_timespec_empty(&lastUpdateGUITime)) {
// Do not update the display if too much data is pending to be displayed
_droppedEntriesCount++;
}
@@ -376,17 +376,17 @@ SpectrumGUIClass::SetFFTSize(const int newSize)
_fftSize = newSize;
}
-timespec
+highres_timespec
SpectrumGUIClass::GetLastGUIUpdateTime()
{
gruel::scoped_lock lock(d_mutex);
- timespec returnValue;
+ highres_timespec returnValue;
returnValue = _lastGUIUpdateTime;
return returnValue;
}
void
-SpectrumGUIClass::SetLastGUIUpdateTime(const timespec newTime)
+SpectrumGUIClass::SetLastGUIUpdateTime(const highres_timespec newTime)
{
gruel::scoped_lock lock(d_mutex);
_lastGUIUpdateTime = newTime;
diff --git a/gr-qtgui/lib/SpectrumGUIClass.h b/gr-qtgui/lib/SpectrumGUIClass.h
index ad06674f5..95f010671 100644
--- a/gr-qtgui/lib/SpectrumGUIClass.h
+++ b/gr-qtgui/lib/SpectrumGUIClass.h
@@ -66,7 +66,7 @@ public:
const uint64_t, const float*,
const uint64_t, const float*,
const uint64_t,
- const timespec, const bool);
+ const highres_timespec, const bool);
float GetPowerValue();
void SetPowerValue(const float);
@@ -78,8 +78,8 @@ public:
int GetFFTSizeIndex();
void SetFFTSize(const int);
- timespec GetLastGUIUpdateTime();
- void SetLastGUIUpdateTime(const timespec);
+ highres_timespec GetLastGUIUpdateTime();
+ void SetLastGUIUpdateTime(const highres_timespec);
unsigned int GetPendingGUIUpdateEvents();
void IncrementPendingGUIUpdateEvents();
@@ -114,7 +114,7 @@ private:
int _windowType;
int64_t _lastDataPointCount;
int _fftSize;
- timespec _lastGUIUpdateTime;
+ highres_timespec _lastGUIUpdateTime;
unsigned int _pendingGUIUpdateEventsCount;
int _droppedEntriesCount;
bool _fftBuffersCreatedFlag;
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.cc b/gr-qtgui/lib/WaterfallDisplayPlot.cc
index 52381a9f6..9bcbc46d0 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.cc
@@ -110,7 +110,7 @@ class TimeScaleData
public:
TimeScaleData()
{
- timespec_reset(&_zeroTime);
+ highres_timespec_reset(&_zeroTime);
_secondsPerLine = 1.0;
}
@@ -118,12 +118,12 @@ public:
{
}
- virtual timespec GetZeroTime() const
+ virtual highres_timespec GetZeroTime() const
{
return _zeroTime;
}
- virtual void SetZeroTime(const timespec newTime)
+ virtual void SetZeroTime(const highres_timespec newTime)
{
_zeroTime = newTime;
}
@@ -140,7 +140,7 @@ public:
protected:
- timespec _zeroTime;
+ highres_timespec _zeroTime;
double _secondsPerLine;
private:
@@ -160,7 +160,7 @@ public:
virtual QwtText label(double value) const
{
- timespec lineTime = timespec_add(GetZeroTime(), (-value) * GetSecondsPerLine());
+ highres_timespec lineTime = highres_timespec_add(GetZeroTime(), -value*GetSecondsPerLine());
std::string time_str = pt::to_simple_string(pt::from_time_t(lineTime.tv_sec));
// lops off the YYYY-mmm-DD part of the string
@@ -212,7 +212,7 @@ protected:
using QwtPlotZoomer::trackerText;
virtual QwtText trackerText( const QwtDoublePoint& p ) const
{
- timespec lineTime = timespec_add(GetZeroTime(), (-p.y()) * GetSecondsPerLine());
+ highres_timespec lineTime = highres_timespec_add(GetZeroTime(), -p.y()*GetSecondsPerLine());
std::string time_str = pt::to_simple_string(pt::from_time_t(lineTime.tv_sec));
// lops off the YYYY-mmm-DD part of the string
@@ -254,7 +254,7 @@ WaterfallDisplayPlot::WaterfallDisplayPlot(QWidget* parent)
setAxisTitle(QwtPlot::yLeft, "Time");
setAxisScaleDraw(QwtPlot::yLeft, new QwtTimeScaleDraw());
- timespec_reset(&_lastReplot);
+ highres_timespec_reset(&_lastReplot);
d_spectrogram = new PlotWaterfall(_waterfallData, "Waterfall Display");
@@ -389,7 +389,7 @@ void
WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
const int64_t numDataPoints,
const double timePerFFT,
- const timespec timestamp,
+ const highres_timespec timestamp,
const int droppedFrames)
{
if(numDataPoints > 0){
@@ -408,7 +408,7 @@ WaterfallDisplayPlot::PlotNewData(const double* dataPoints,
_lastReplot = get_highres_clock();
}
- if(diff_timespec(get_highres_clock(), _lastReplot) > timePerFFT) {
+ if(diff_highres_timespec(get_highres_clock(), _lastReplot) > timePerFFT) {
//FIXME: We may want to average the data between these updates to smooth display
_waterfallData->addFFTData(dataPoints, numDataPoints, droppedFrames);
_waterfallData->IncrementNumLinesToUpdate();
diff --git a/gr-qtgui/lib/WaterfallDisplayPlot.h b/gr-qtgui/lib/WaterfallDisplayPlot.h
index 583bf9407..435453fcc 100644
--- a/gr-qtgui/lib/WaterfallDisplayPlot.h
+++ b/gr-qtgui/lib/WaterfallDisplayPlot.h
@@ -51,7 +51,7 @@ public:
double GetStopFrequency()const;
void PlotNewData(const double* dataPoints, const int64_t numDataPoints,
- const double timePerFFT, const timespec timestamp,
+ const double timePerFFT, const highres_timespec timestamp,
const int droppedFrames);
void SetIntensityRange(const double minIntensity, const double maxIntensity);
@@ -98,7 +98,7 @@ private:
WaterfallData* _waterfallData;
- timespec _lastReplot;
+ highres_timespec _lastReplot;
bool _useCenterFrequencyFlag;
diff --git a/gr-qtgui/lib/highResTimeFunctions.h b/gr-qtgui/lib/highResTimeFunctions.h
index 251bbad8b..de08d8adc 100644
--- a/gr-qtgui/lib/highResTimeFunctions.h
+++ b/gr-qtgui/lib/highResTimeFunctions.h
@@ -1,3 +1,25 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2011 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
#ifndef HIGH_RES_TIME_FUNCTIONS_H
#define HIGH_RES_TIME_FUNCTIONS_H
@@ -6,11 +28,13 @@
#include <cmath>
/* Requires the librt and libm libraries */
+typedef timespec highres_timespec;
+
static const long NSEC_PER_SEC = 1000000000L;
static inline bool
-timespec_greater(const struct timespec* t1,
- const struct timespec* t0)
+highres_timespec_greater(const highres_timespec* t1,
+ const highres_timespec* t0)
{
return ((t1->tv_sec > t0->tv_sec) ||
((t1->tv_sec == t0->tv_sec) &&
@@ -18,8 +42,8 @@ timespec_greater(const struct timespec* t1,
}
static inline bool
-timespec_greater(const struct timespec t1,
- const struct timespec t0)
+highres_timespec_greater(const highres_timespec t1,
+ const highres_timespec t0)
{
return ((t1.tv_sec > t0.tv_sec) ||
((t1.tv_sec == t0.tv_sec) &&
@@ -27,8 +51,8 @@ timespec_greater(const struct timespec t1,
}
static inline bool
-timespec_less(const struct timespec* t1,
- const struct timespec* t0)
+highres_timespec_less(const highres_timespec* t1,
+ const highres_timespec* t0)
{
return ((t1->tv_sec < t0->tv_sec) ||
((t1->tv_sec == t0->tv_sec) &&
@@ -36,8 +60,8 @@ timespec_less(const struct timespec* t1,
}
static inline bool
-timespec_less(const struct timespec t1,
- const struct timespec t0)
+highres_timespec_less(const highres_timespec t1,
+ const highres_timespec t0)
{
return ((t1.tv_sec < t0.tv_sec) ||
((t1.tv_sec == t0.tv_sec) &&
@@ -45,31 +69,31 @@ timespec_less(const struct timespec t1,
}
static inline bool
-timespec_equal(const struct timespec* t1,
- const struct timespec* t0)
+highres_timespec_equal(const highres_timespec* t1,
+ const highres_timespec* t0)
{
return ((t1->tv_sec == t0->tv_sec) &&
(t1->tv_nsec == t0->tv_nsec));
}
static inline bool
-timespec_equal(const struct timespec t1,
- const struct timespec t0)
+highres_timespec_equal(const highres_timespec t1,
+ const highres_timespec t0)
{
return ((t1.tv_sec == t0.tv_sec) &&
(t1.tv_nsec == t0.tv_nsec));
}
static inline void
-timespec_reset(struct timespec* ret)
+highres_timespec_reset(highres_timespec* ret)
{
ret->tv_sec = 0;
ret->tv_nsec = 0;
}
static inline void
-set_normalized_timespec(struct timespec *ts,
- time_t sec, long nsec)
+set_normalized_highres_timespec(highres_timespec *ts,
+ time_t sec, long nsec)
{
while (nsec > NSEC_PER_SEC) {
nsec -= NSEC_PER_SEC;
@@ -83,22 +107,22 @@ set_normalized_timespec(struct timespec *ts,
ts->tv_nsec = nsec;
}
-static inline struct timespec
-convert_to_timespec(const double timeValue)
+static inline highres_timespec
+convert_to_highres_timespec(const double timeValue)
{
- struct timespec ret;
+ highres_timespec ret;
double seconds = 0;
long nsec = static_cast<long>(modf(timeValue, &seconds) *
static_cast<double>(NSEC_PER_SEC));
time_t sec = static_cast<time_t>(seconds);
- set_normalized_timespec(&ret, sec, nsec);
+ set_normalized_highres_timespec(&ret, sec, nsec);
return ret;
}
static inline double
-convert_from_timespec(const timespec actual)
+convert_from_highres_timespec(const highres_timespec actual)
{
return (static_cast<double>(actual.tv_sec) +
(static_cast<double>(actual.tv_nsec) /
@@ -106,108 +130,108 @@ convert_from_timespec(const timespec actual)
}
static inline void
-timespec_add(struct timespec *ret,
- const struct timespec* t1,
- const struct timespec* t0)
+highres_timespec_add(highres_timespec *ret,
+ const highres_timespec* t1,
+ const highres_timespec* t0)
{
time_t sec = t1->tv_sec + t0->tv_sec;
long nsec = t1->tv_nsec + t0->tv_nsec;
- set_normalized_timespec(ret, sec, nsec);
+ set_normalized_highres_timespec(ret, sec, nsec);
}
static inline void
-timespec_add(struct timespec *ret,
- const struct timespec t1,
- const struct timespec t0)
+highres_timespec_add(highres_timespec *ret,
+ const highres_timespec t1,
+ const highres_timespec t0)
{
- return timespec_add(ret, &t1, &t0);
+ return highres_timespec_add(ret, &t1, &t0);
}
-static inline struct timespec
-timespec_add(const struct timespec t1,
- const struct timespec t0)
+static inline highres_timespec
+highres_timespec_add(const highres_timespec t1,
+ const highres_timespec t0)
{
- struct timespec ret;
- timespec_add(&ret, &t1, &t0);
+ highres_timespec ret;
+ highres_timespec_add(&ret, &t1, &t0);
return ret;
}
-static inline struct timespec
-timespec_add(const struct timespec t1,
- const double time0)
+static inline highres_timespec
+highres_timespec_add(const highres_timespec t1,
+ const double time0)
{
- struct timespec ret;
- struct timespec t0;
- t0 = convert_to_timespec(time0);
+ highres_timespec ret;
+ highres_timespec t0;
+ t0 = convert_to_highres_timespec(time0);
- timespec_add(&ret, &t1, &t0);
+ highres_timespec_add(&ret, &t1, &t0);
return ret;
}
static inline void
-timespec_subtract(struct timespec *ret,
- const struct timespec* t1,
- const struct timespec* t0)
+highres_timespec_subtract(highres_timespec *ret,
+ const highres_timespec* t1,
+ const highres_timespec* t0)
{
time_t sec = t1->tv_sec - t0->tv_sec;
long nsec = t1->tv_nsec - t0->tv_nsec;
- set_normalized_timespec(ret, sec, nsec);
+ set_normalized_highres_timespec(ret, sec, nsec);
}
static inline void
-timespec_subtract(struct timespec *ret,
- const struct timespec t1,
- const struct timespec t0)
+highres_timespec_subtract(highres_timespec *ret,
+ const highres_timespec t1,
+ const highres_timespec t0)
{
- return timespec_subtract(ret, &t1, &t0);
+ return highres_timespec_subtract(ret, &t1, &t0);
}
-static inline struct timespec
-timespec_subtract(const struct timespec t1,
- const struct timespec t0)
+static inline highres_timespec
+highres_timespec_subtract(const highres_timespec t1,
+ const highres_timespec t0)
{
- struct timespec ret;
- timespec_subtract(&ret, &t1, &t0);
+ highres_timespec ret;
+ highres_timespec_subtract(&ret, &t1, &t0);
return ret;
}
-static inline struct timespec
-timespec_subtract(const struct timespec t1,
- const double time0)
+static inline highres_timespec
+highres_timespec_subtract(const highres_timespec t1,
+ const double time0)
{
- struct timespec ret;
- struct timespec t0;
- t0 = convert_to_timespec(time0);
+ highres_timespec ret;
+ highres_timespec t0;
+ t0 = convert_to_highres_timespec(time0);
- timespec_subtract(&ret, &t1, &t0);
+ highres_timespec_subtract(&ret, &t1, &t0);
return ret;
}
static inline double
-diff_timespec(struct timespec* ret,
- const struct timespec *t1,
- const struct timespec* t0)
+diff_highres_timespec(highres_timespec* ret,
+ const highres_timespec *t1,
+ const highres_timespec* t0)
{
- struct timespec actual;
+ highres_timespec actual;
time_t sec = 0;
long nsec = 0;
- if(timespec_greater(t1, t0)){
+ if(highres_timespec_greater(t1, t0)){
sec = t1->tv_sec - t0->tv_sec;
nsec = t1->tv_nsec - t0->tv_nsec;
- set_normalized_timespec(&actual, sec, nsec);
+ set_normalized_highres_timespec(&actual, sec, nsec);
if(ret != NULL){
ret->tv_sec = actual.tv_sec;
ret->tv_nsec = actual.tv_nsec;
}
- return convert_from_timespec(actual);
+ return convert_from_highres_timespec(actual);
}
else{
sec = t0->tv_sec - t1->tv_sec;
@@ -216,33 +240,33 @@ diff_timespec(struct timespec* ret,
// Do nothing with the ret value as the ret value
// would have to store a negative, which it can't.
- set_normalized_timespec(&actual, sec, nsec);
+ set_normalized_highres_timespec(&actual, sec, nsec);
- return (-convert_from_timespec(actual));
+ return (-convert_from_highres_timespec(actual));
}
}
static inline double
-diff_timespec(struct timespec* ret,
- const struct timespec t1,
- const struct timespec t0)
+diff_highres_timespec(highres_timespec* ret,
+ const highres_timespec t1,
+ const highres_timespec t0)
{
- return diff_timespec(ret, &t1, &t0);
+ return diff_highres_timespec(ret, &t1, &t0);
}
static inline double
-diff_timespec(const struct timespec t1,
- const struct timespec t0)
+diff_highres_timespec(const highres_timespec t1,
+ const highres_timespec t0)
{
- return diff_timespec(NULL, &t1, &t0);
+ return diff_highres_timespec(NULL, &t1, &t0);
}
static inline double
-diff_timespec(const struct timespec* t1,
- const struct timespec* t0)
+diff_highres_timespec(const highres_timespec* t1,
+ const highres_timespec* t0)
{
- return diff_timespec(NULL, t1, t0);
+ return diff_highres_timespec(NULL, t1, t0);
}
@@ -250,7 +274,7 @@ diff_timespec(const struct timespec* t1,
// If we can use clock_gettime, use it;
// otherwise, use gettimeofday
static inline void
-get_highres_clock(struct timespec* ret)
+get_highres_clock(highres_timespec* ret)
{
if(clock_gettime(CLOCK_REALTIME, ret) != 0){
// Unable to get high resolution time -
@@ -267,7 +291,7 @@ get_highres_clock(struct timespec* ret)
// Trick timer functions into thinking it has an nsec timer
// but only use the low resolution (usec) timer.
static inline void
-get_highres_clock(struct timespec* ret)
+get_highres_clock(highres_timespec* ret)
{
timeval lowResTime;
gettimeofday(&lowResTime, NULL);
@@ -276,24 +300,24 @@ get_highres_clock(struct timespec* ret)
}
#endif
-static inline struct timespec
+static inline highres_timespec
get_highres_clock()
{
- struct timespec ret;
+ highres_timespec ret;
get_highres_clock(&ret);
return ret;
}
static inline bool
-timespec_empty(const struct timespec* ret)
+highres_timespec_empty(const highres_timespec* ret)
{
return ( (ret->tv_sec == 0 ) && (ret->tv_nsec == 0) );
}
static inline bool
-timespec_empty(const struct timespec ret)
+highres_timespec_empty(const highres_timespec ret)
{
- return timespec_empty(&ret);
+ return highres_timespec_empty(&ret);
}
#endif /* HIGH_RES_TIME_FUNCTIONS_H */
diff --git a/gr-qtgui/lib/qtgui_sink_c.cc b/gr-qtgui/lib/qtgui_sink_c.cc
index 7b40dd01d..e980318ca 100644
--- a/gr-qtgui/lib/qtgui_sink_c.cc
+++ b/gr-qtgui/lib/qtgui_sink_c.cc
@@ -272,7 +272,7 @@ qtgui_sink_c::general_work (int noutput_items,
// If we have enough input for one full FFT, do it
if(datasize >= resid) {
- const timespec currentTime = get_highres_clock();
+ const highres_timespec currentTime = get_highres_clock();
// Fill up residbuf with d_fftsize number of items
memcpy(d_residbuf+d_index, &in[j], sizeof(gr_complex)*resid);
diff --git a/gr-qtgui/lib/qtgui_sink_f.cc b/gr-qtgui/lib/qtgui_sink_f.cc
index 3312b9006..4e1799150 100644
--- a/gr-qtgui/lib/qtgui_sink_f.cc
+++ b/gr-qtgui/lib/qtgui_sink_f.cc
@@ -268,7 +268,7 @@ qtgui_sink_f::general_work (int noutput_items,
// If we have enough input for one full FFT, do it
if(datasize >= resid) {
- const timespec currentTime = get_highres_clock();
+ const highres_timespec currentTime = get_highres_clock();
// Fill up residbuf with d_fftsize number of items
memcpy(d_residbuf+d_index, &in[j], sizeof(float)*resid);
diff --git a/gr-qtgui/lib/qtgui_time_sink_c.cc b/gr-qtgui/lib/qtgui_time_sink_c.cc
index 6c4793ea1..a4fc48536 100644
--- a/gr-qtgui/lib/qtgui_time_sink_c.cc
+++ b/gr-qtgui/lib/qtgui_time_sink_c.cc
@@ -94,7 +94,7 @@ qtgui_time_sink_c::initialize()
// initialize update time to 10 times a second
set_update_time(0.1);
- timespec_reset(&d_last_time);
+ highres_timespec_reset(&d_last_time);
}
@@ -171,7 +171,7 @@ qtgui_time_sink_c::general_work (int noutput_items,
}
// Update the plot if its time
- if(diff_timespec(d_current_time, d_last_time) > d_update_time) {
+ if(diff_highres_timespec(d_current_time, d_last_time) > d_update_time) {
d_last_time = d_current_time;
d_qApplication->postEvent(d_main_gui,
new TimeUpdateEvent(d_residbufs, d_size));
diff --git a/gr-qtgui/lib/qtgui_time_sink_f.cc b/gr-qtgui/lib/qtgui_time_sink_f.cc
index 28789c163..e04109e96 100644
--- a/gr-qtgui/lib/qtgui_time_sink_f.cc
+++ b/gr-qtgui/lib/qtgui_time_sink_f.cc
@@ -94,7 +94,7 @@ qtgui_time_sink_f::initialize()
// initialize update time to 10 times a second
set_update_time(0.1);
- timespec_reset(&d_last_time);
+ highres_timespec_reset(&d_last_time);
}
@@ -170,7 +170,7 @@ qtgui_time_sink_f::general_work (int noutput_items,
}
// Update the plot if its time
- if(diff_timespec(d_current_time, d_last_time) > d_update_time) {
+ if(diff_highres_timespec(d_current_time, d_last_time) > d_update_time) {
d_last_time = d_current_time;
d_qApplication->postEvent(d_main_gui,
new TimeUpdateEvent(d_residbufs, d_size));
diff --git a/gr-qtgui/lib/spectrumUpdateEvents.cc b/gr-qtgui/lib/spectrumUpdateEvents.cc
index ae4caf31a..6d7ca2701 100644
--- a/gr-qtgui/lib/spectrumUpdateEvents.cc
+++ b/gr-qtgui/lib/spectrumUpdateEvents.cc
@@ -8,10 +8,10 @@ SpectrumUpdateEvent::SpectrumUpdateEvent(const std::complex<float>* fftPoints,
const double* realTimeDomainPoints,
const double* imagTimeDomainPoints,
const uint64_t numTimeDomainDataPoints,
- const timespec dataTimestamp,
+ const highres_timespec dataTimestamp,
const bool repeatDataFlag,
const bool lastOfMultipleUpdateFlag,
- const timespec generatedTimestamp,
+ const highres_timespec generatedTimestamp,
const int droppedFFTFrames)
: QEvent(QEvent::Type(10005))
{
@@ -90,7 +90,7 @@ SpectrumUpdateEvent::getNumTimeDomainDataPoints() const
return _numTimeDomainDataPoints;
}
-timespec
+highres_timespec
SpectrumUpdateEvent::getDataTimestamp() const
{
return _dataTimestamp;
@@ -108,7 +108,7 @@ SpectrumUpdateEvent::getLastOfMultipleUpdateFlag() const
return _lastOfMultipleUpdateFlag;
}
-timespec
+highres_timespec
SpectrumUpdateEvent::getEventGeneratedTimestamp() const
{
return _eventGeneratedTimestamp;
diff --git a/gr-qtgui/lib/spectrumUpdateEvents.h b/gr-qtgui/lib/spectrumUpdateEvents.h
index a5e359a4c..9224cad08 100644
--- a/gr-qtgui/lib/spectrumUpdateEvents.h
+++ b/gr-qtgui/lib/spectrumUpdateEvents.h
@@ -16,10 +16,10 @@ public:
const double* realTimeDomainPoints,
const double* imagTimeDomainPoints,
const uint64_t numTimeDomainDataPoints,
- const timespec dataTimestamp,
+ const highres_timespec dataTimestamp,
const bool repeatDataFlag,
const bool lastOfMultipleUpdateFlag,
- const timespec generatedTimestamp,
+ const highres_timespec generatedTimestamp,
const int droppedFFTFrames);
~SpectrumUpdateEvent();
@@ -29,10 +29,10 @@ public:
const double* getImagTimeDomainPoints() const;
uint64_t getNumFFTDataPoints() const;
uint64_t getNumTimeDomainDataPoints() const;
- timespec getDataTimestamp() const;
+ highres_timespec getDataTimestamp() const;
bool getRepeatDataFlag() const;
bool getLastOfMultipleUpdateFlag() const;
- timespec getEventGeneratedTimestamp() const;
+ highres_timespec getEventGeneratedTimestamp() const;
int getDroppedFFTFrames() const;
protected:
@@ -43,10 +43,10 @@ private:
double* _imagDataTimeDomainPoints;
uint64_t _numFFTDataPoints;
uint64_t _numTimeDomainDataPoints;
- timespec _dataTimestamp;
+ highres_timespec _dataTimestamp;
bool _repeatDataFlag;
bool _lastOfMultipleUpdateFlag;
- timespec _eventGeneratedTimestamp;
+ highres_timespec _eventGeneratedTimestamp;
int _droppedFFTFrames;
};
diff --git a/gr-qtgui/lib/spectrumdisplayform.cc b/gr-qtgui/lib/spectrumdisplayform.cc
index 991f51f47..df1903391 100644
--- a/gr-qtgui/lib/spectrumdisplayform.cc
+++ b/gr-qtgui/lib/spectrumdisplayform.cc
@@ -145,10 +145,10 @@ SpectrumDisplayForm::newFrequencyData( const SpectrumUpdateEvent* spectrumUpdate
const std::complex<float>* complexDataPoints = spectrumUpdateEvent->getFFTPoints();
const uint64_t numFFTDataPoints = spectrumUpdateEvent->getNumFFTDataPoints();
const uint64_t numTimeDomainDataPoints = spectrumUpdateEvent->getNumTimeDomainDataPoints();
- const timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp();
+ const highres_timespec dataTimestamp = spectrumUpdateEvent->getDataTimestamp();
const bool repeatDataFlag = spectrumUpdateEvent->getRepeatDataFlag();
const bool lastOfMultipleUpdatesFlag = spectrumUpdateEvent->getLastOfMultipleUpdateFlag();
- const timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp();
+ const highres_timespec generatedTimestamp = spectrumUpdateEvent->getEventGeneratedTimestamp();
double* realTimeDomainDataPoints = (double*)spectrumUpdateEvent->getRealTimeDomainPoints();
double* imagTimeDomainDataPoints = (double*)spectrumUpdateEvent->getImagTimeDomainPoints();