diff base/RealTime.cpp @ 247:21b9b25bff48

* More useful status bar text -- show the current play time and the extents of the visible area * Add update-i18n.sh to update the i18n/ts and qm files -- I can't get qmake to do the right thing now that the project file has been split up into several project files * Fix missing Q_OBJECTs, etc, reported by lupdate * Update Russian translation from AlexandrE
author Chris Cannam
date Wed, 07 Mar 2007 17:07:02 +0000
parents 146eb9e35baa
children d7c41483af8f 94fc0591ea43
line wrap: on
line diff
--- a/base/RealTime.cpp	Mon Mar 05 15:32:55 2007 +0000
+++ b/base/RealTime.cpp	Wed Mar 07 17:07:02 2007 +0000
@@ -125,7 +125,7 @@
 std::string
 RealTime::toText(bool fixedDp) const
 {
-    if (*this < RealTime::zeroTime) return "-" + (-*this).toText();
+    if (*this < RealTime::zeroTime) return "-" + (-*this).toText(fixedDp);
 
     std::stringstream out;
 
@@ -173,6 +173,41 @@
     return s;
 }
 
+std::string
+RealTime::toSecText() const
+{
+    if (*this < RealTime::zeroTime) return "-" + (-*this).toSecText();
+
+    std::stringstream out;
+
+    if (sec >= 3600) {
+	out << (sec / 3600) << ":";
+    }
+
+    if (sec >= 60) {
+	out << (sec % 3600) / 60 << ":";
+    }
+
+    if (sec >= 10) {
+	out << ((sec % 60) / 10);
+    }
+
+    out << (sec % 10);
+    
+    if (sec < 60) {
+        out << "s";
+    }
+
+	
+#if (__GNUC__ < 3)
+    out << std::ends;
+#endif
+
+    std::string s = out.str();
+
+    return s;
+}
+
 RealTime
 RealTime::operator*(int m) const
 {