[PATCH 09/12] Skip min conversion on Seabear import

Miika Turkia miika.turkia at gmail.com
Wed Jul 22 08:06:34 PDT 2015


New format of Seabear logs have sample interval in header. Thus we can
skip the conversion from minutes to seconds when import was from new
format.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 qt-ui/divelogimportdialog.cpp | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/qt-ui/divelogimportdialog.cpp b/qt-ui/divelogimportdialog.cpp
index e253ba7..3a17dd2 100644
--- a/qt-ui/divelogimportdialog.cpp
+++ b/qt-ui/divelogimportdialog.cpp
@@ -626,12 +626,20 @@ void DiveLogImportDialog::on_buttonBox_accepted()
 						       ) < 0) {
 					return;
 				}
-				// Seabear CSV stores NDL and TTS in Minutes, not seconds
-				struct dive *dive = dive_table.dives[dive_table.nr - 1];
-				for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) {
-					struct sample *sample = dive->dc.sample + s_nr;
-					sample->ndl.seconds *= 60;
-					sample->tts.seconds *= 60;
+
+				/*
+				 * Seabear CSV stores NDL and TTS in Minutes, not seconds
+				 * However, the new format has delta in the header in
+				 * seconds, thus skipping this for new format
+				 */
+
+				if (delta.toInt() > 0) {
+					struct dive *dive = dive_table.dives[dive_table.nr - 1];
+					for(int s_nr = 0 ; s_nr <= dive->dc.samples ; s_nr++) {
+						struct sample *sample = dive->dc.sample + s_nr;
+						sample->ndl.seconds *= 60;
+						sample->tts.seconds *= 60;
+					}
 				}
 			} else {
 				parse_csv_file(fileNames[i].toUtf8().data(),
-- 
2.1.4



More information about the subsurface mailing list