diff options
Diffstat (limited to 'gr-qtgui/src')
-rw-r--r-- | gr-qtgui/src/lib/Makefile.am | 6 | ||||
-rw-r--r-- | gr-qtgui/src/lib/WaterfallDisplayPlot.cc | 34 |
2 files changed, 21 insertions, 19 deletions
diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/src/lib/Makefile.am index b45b25c9d..446a07fd0 100644 --- a/gr-qtgui/src/lib/Makefile.am +++ b/gr-qtgui/src/lib/Makefile.am @@ -25,7 +25,7 @@ include $(top_srcdir)/Makefile.swig EXTRA_DIST += spectrumdisplayform.ui AM_CPPFLAGS = -I. $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ - $(QT_INCLUDES) $(WITH_INCLUDES) + $(QT_INCLUDES) $(BOOST_CPPFLAGS) $(WITH_INCLUDES) # Only include these files in the build if qtgui passes configure checks # This is mostly to help make distcheck pass @@ -82,10 +82,12 @@ QT_MOC_FLAGS=-DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LI $(QT_UIC_EXEC) $< -o $@ # magic flags -libgnuradio_qtgui_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) +libgnuradio_qtgui_la_LDFLAGS = $(NO_UNDEFINED) $(BOOST_LDFLAGS) $(LTVERSIONFLAGS) libgnuradio_qtgui_la_LIBADD = \ $(GNURADIO_CORE_LA) \ + $(BOOST_THREAD_LIB) \ + $(BOOST_DATE_TIME_LIB) \ -lstdc++ \ $(QT_LIBS) diff --git a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc index 805af1d8d..a8e5361e7 100644 --- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc +++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc @@ -12,6 +12,9 @@ #include <qapplication.h> +#include <boost/date_time/posix_time/posix_time.hpp> +namespace pt = boost::posix_time; + class FreqOffsetAndPrecisionClass { public: @@ -135,16 +138,14 @@ public: virtual QwtText label(double value) const { - QwtText returnLabel(""); - timespec lineTime = timespec_add(GetZeroTime(), (-value) * GetSecondsPerLine()); - struct tm timeTm; - gmtime_r(&lineTime.tv_sec, &timeTm); - returnLabel = (QString("").sprintf("%04d/%02d/%02d\n%02d:%02d:%02d.%03ld", - timeTm.tm_year+1900, timeTm.tm_mon+1, - timeTm.tm_mday, timeTm.tm_hour, timeTm.tm_min, - timeTm.tm_sec, lineTime.tv_nsec/1000000)); - return returnLabel; + 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 + int ind = time_str.find(" "); + if(ind != std::string::npos) + time_str = time_str.substr(ind); + return QwtText(QString("").sprintf("%s.%03ld", time_str.c_str(), lineTime.tv_nsec/1000000)); } virtual void initiateUpdate() @@ -189,15 +190,14 @@ protected: using QwtPlotZoomer::trackerText; virtual QwtText trackerText( const QwtDoublePoint& p ) const { - QString yLabel(""); - timespec lineTime = timespec_add(GetZeroTime(), (-p.y()) * GetSecondsPerLine()); - struct tm timeTm; - gmtime_r(&lineTime.tv_sec, &timeTm); - yLabel = (QString("").sprintf("%04d/%02d/%02d %02d:%02d:%02d.%03ld", - timeTm.tm_year+1900, timeTm.tm_mon+1, - timeTm.tm_mday, timeTm.tm_hour, timeTm.tm_min, - timeTm.tm_sec, lineTime.tv_nsec/1000000)); + 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 + int ind = time_str.find(" "); + if(ind != std::string::npos) + time_str = time_str.substr(ind); + QString yLabel(QString("").sprintf("%s.%03ld", time_str.c_str(), lineTime.tv_nsec/1000000)); QwtText t(QString("%1 %2, %3"). arg(p.x(), 0, 'f', GetFrequencyPrecision()). |