summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Blum2011-01-17 20:37:09 -0800
committerJosh Blum2011-01-17 20:37:09 -0800
commit7cea46f75e3f4f4b0d42de89d7cedd90a0f091e0 (patch)
tree0686b8a16f2db72e6603d430779fc100bcc481a0
parent31bbbec88b19230eb37b197d7623c3671e57837e (diff)
downloadgnuradio-7cea46f75e3f4f4b0d42de89d7cedd90a0f091e0.tar.gz
gnuradio-7cea46f75e3f4f4b0d42de89d7cedd90a0f091e0.tar.bz2
gnuradio-7cea46f75e3f4f4b0d42de89d7cedd90a0f091e0.zip
qtgui boost use posix time:
Replace calls to gmtime_r with boost::posix_time to make the code portable on systems without gmtime_r.
-rw-r--r--gr-qtgui/src/lib/Makefile.am6
-rw-r--r--gr-qtgui/src/lib/WaterfallDisplayPlot.cc8
2 files changed, 8 insertions, 6 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 680c44756..dc8d7b7ac 100644
--- a/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
+++ b/gr-qtgui/src/lib/WaterfallDisplayPlot.cc
@@ -12,6 +12,8 @@
#include <qapplication.h>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
class FreqOffsetAndPrecisionClass
{
public:
@@ -138,8 +140,7 @@ public:
QwtText returnLabel("");
timespec lineTime = timespec_add(GetZeroTime(), (-value) * GetSecondsPerLine());
- struct tm timeTm;
- gmtime_r(&lineTime.tv_sec, &timeTm);
+ tm timeTm(boost::posix_time::to_tm(boost::posix_time::from_time_t(lineTime.tv_sec)));
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,
@@ -192,8 +193,7 @@ protected:
QString yLabel("");
timespec lineTime = timespec_add(GetZeroTime(), (-p.y()) * GetSecondsPerLine());
- struct tm timeTm;
- gmtime_r(&lineTime.tv_sec, &timeTm);
+ tm timeTm(boost::posix_time::to_tm(boost::posix_time::from_time_t(lineTime.tv_sec)));
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,