diff base/RealTime.cpp @ 1031:344c9ea90181

Add option to toggle H:M:S time display (when off, just show seconds even when more than 60)
author Chris Cannam
date Wed, 18 Feb 2015 12:08:17 +0000
parents ee9f4477f65b
children cc27f35aa75c
line wrap: on
line diff
--- a/base/RealTime.cpp	Fri Feb 13 13:30:28 2015 +0000
+++ b/base/RealTime.cpp	Wed Feb 18 12:08:17 2015 +0000
@@ -274,19 +274,25 @@
 
     std::stringstream out;
 
-    if (sec >= 3600) {
-	out << (sec / 3600) << ":";
+    if (p->getShowHMS()) {
+    
+        if (sec >= 3600) {
+            out << (sec / 3600) << ":";
+        }
+
+        if (sec >= 60) {
+            out << (sec % 3600) / 60 << ":";
+        }
+
+        if (sec >= 10) {
+            out << ((sec % 60) / 10);
+        }
+
+        out << (sec % 10);
+
+    } else {
+        out << sec;
     }
-
-    if (sec >= 60) {
-	out << (sec % 3600) / 60 << ":";
-    }
-
-    if (sec >= 10) {
-	out << ((sec % 60) / 10);
-    }
-
-    out << (sec % 10);
     
     int ms = msec();
 
@@ -319,21 +325,29 @@
 {
     if (*this < RealTime::zeroTime) return "-" + (-*this).toFrameText(fps);
 
+    Preferences *p = Preferences::getInstance();
+
     std::stringstream out;
 
-    if (sec >= 3600) {
-	out << (sec / 3600) << ":";
+    if (p->getShowHMS()) {
+    
+        if (sec >= 3600) {
+            out << (sec / 3600) << ":";
+        }
+
+        if (sec >= 60) {
+            out << (sec % 3600) / 60 << ":";
+        }
+
+        if (sec >= 10) {
+            out << ((sec % 60) / 10);
+        }
+
+        out << (sec % 10);
+
+    } else {
+        out << sec;
     }
-
-    if (sec >= 60) {
-	out << (sec % 3600) / 60 << ":";
-    }
-
-    if (sec >= 10) {
-	out << ((sec % 60) / 10);
-    }
-
-    out << (sec % 10);
     
     int f = nsec / (ONE_BILLION / fps);