From 30f85a3c20f5da01406e52a781b1661cf5685ae4 Mon Sep 17 00:00:00 2001
From: Fred Gleason <fredg@paraelsystems.com>
Date: Tue, 20 Nov 2018 13:40:56 -0500
Subject: [PATCH] 2018-11-20 Fred Gleason <fredg@paravelsystems.com> 	*
 Cleaned up code styling in 'lib/rdsound_panel.cpp'.

---
 ChangeLog             |  2 ++
 lib/rdsound_panel.cpp | 16 +++++-----------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f0d134dc..05debdd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18032,3 +18032,5 @@
 	* Fixed marker bugs in rdlibrary(1) audio editor widget.
 2018-11-16 Fred Gleason <fredg@paravelsystems.com>
 	* Updated the package version to 3.0.0alpha04.
+2018-11-20 Fred Gleason <fredg@paravelsystems.com>
+	* Cleaned up code styling in 'lib/rdsound_panel.cpp'.
diff --git a/lib/rdsound_panel.cpp b/lib/rdsound_panel.cpp
index d30cbea5..f705211a 100644
--- a/lib/rdsound_panel.cpp
+++ b/lib/rdsound_panel.cpp
@@ -1458,7 +1458,7 @@ void RDSoundPanel::LogTraffic(RDPanelButton *button)
 
   QString sql;
   RDSqlQuery *q;
-  QDateTime datetime(QDate::currentDate(),QTime::currentTime());
+  QDateTime now=QDateTime::currentDateTime();
 
   sql=QString("select ")+
     "CART.TITLE,"+         // 00
@@ -1480,20 +1480,14 @@ void RDSoundPanel::LogTraffic(RDPanelButton *button)
     "CUTS.CUT_NAME=\""+RDEscapeString(button->cutName())+"\"";
   q=new RDSqlQuery(sql);
   if(q->first()) {
-
-    QString eventDateTimeSQL = "NULL";
-
-    if(datetime.isValid() && button->startTime().isValid())
-      eventDateTimeSQL = RDCheckDateTime(QDateTime(datetime.date(),
-            button->startTime()), "yyyy-MM-dd hh:mm:ss");
-
     sql=QString("insert into ELR_LINES set ")+
       "SERVICE_NAME=\""+RDEscapeString(panel_svcname)+"\","+
-      QString().sprintf("LENGTH=%d,",button->startTime().
-			msecsTo(datetime.time()))+
+      QString().sprintf("LENGTH=%d,",button->startTime().msecsTo(now.time()))+
       QString().sprintf("CART_NUMBER=%u,",button->cart())+
       "STATION_NAME=\""+RDEscapeString(rda->station()->name().utf8())+"\","+
-      "EVENT_DATETIME="+eventDateTimeSQL+","+
+      "EVENT_DATETIME="+
+      RDCheckDateTime(QDateTime(now.date(),button->startTime()),
+		      "yyyy-MM-dd hh:mm:ss")+","+
       QString().sprintf("EVENT_TYPE=%d,",RDAirPlayConf::TrafficStop)+
       QString().sprintf("EVENT_SOURCE=%d,",RDLogLine::SoundPanel)+
       QString().sprintf("PLAY_SOURCE=%d,",RDLogLine::SoundPanel)+