diff data/fileio/CSVFormat.cpp @ 1525:a92e94215863

Various CSV format tests
author Chris Cannam
date Fri, 14 Sep 2018 14:47:46 +0100
parents 64ef24ebb19c
children 9570ef94eaa3
line wrap: on
line diff
--- a/data/fileio/CSVFormat.cpp	Fri Sep 14 09:25:17 2018 +0100
+++ b/data/fileio/CSVFormat.cpp	Fri Sep 14 14:47:46 2018 +0100
@@ -249,6 +249,7 @@
     m_timeUnits = CSVFormat::TimeWindows;
         
     int timingColumnCount = 0;
+    bool haveDurationOrEndTime = false;
 
     SVDEBUG << "Estimated column qualities overall: ";
     for (int i = 0; i < m_columnCount; ++i) {
@@ -310,6 +311,7 @@
 
                 if (timingColumnCount == 2 && m_timingType == ExplicitTiming) {
                     purpose = ColumnEndTime;
+                    haveDurationOrEndTime = true;
                 }
             }
         }
@@ -353,15 +355,17 @@
                 if (m_columnQualities[timecol] & ColumnIncreasing) {
                     // This shouldn't happen; should have been settled above
                     m_columnPurposes[timecol] = ColumnEndTime;
+                    haveDurationOrEndTime = true;
                 } else {
                     m_columnPurposes[timecol] = ColumnDuration;
+                    haveDurationOrEndTime = true;
                 }
                 --valueCount;
             }
         }
     }
 
-    if (timingColumnCount > 1) {
+    if (timingColumnCount > 1 || haveDurationOrEndTime) {
         m_modelType = TwoDimensionalModelWithDuration;
     } else {
         if (valueCount == 0) {