diff base/RealTime.h @ 383:94fc0591ea43 1.2-stable

* merge from trunk (1.2 ended up being tracked from trunk, but we may want this branch for fixes later)
author Chris Cannam
date Wed, 27 Feb 2008 10:32:45 +0000
parents 21b9b25bff48
children
line wrap: on
line diff
--- a/base/RealTime.h	Fri Nov 30 17:36:14 2007 +0000
+++ b/base/RealTime.h	Wed Feb 27 10:32:45 2008 +0000
@@ -95,30 +95,48 @@
     RealTime operator*(int m) const;
     RealTime operator/(int d) const;
 
-    // Find the fractional difference between times
-    //
+    RealTime operator*(double m) const;
+    RealTime operator/(double d) const;
+
+    /**
+     * Return the ratio of two times.
+     */
     double operator/(const RealTime &r) const;
 
-    // Return a human-readable debug-type string to full precision
-    // (probably not a format to show to a user directly).  If align
-    // is true, prepend " " to the start of positive values so that
-    // they line up with negative ones (which start with "-").
-    // 
+    /**
+     * Return a human-readable debug-type string to full precision
+     * (probably not a format to show to a user directly).  If align
+     * is true, prepend " " to the start of positive values so that
+     * they line up with negative ones (which start with "-").
+     */ 
     std::string toString(bool align = false) const;
 
-    // Return a user-readable string to the nearest millisecond
-    // in a form like HH:MM:SS.mmm
-    //
+    /**
+     * Convert a string as obtained from toString back to a RealTime
+     * object.
+     */
+    static RealTime fromString(std::string);
+
+    /**
+     * Return a user-readable string to the nearest millisecond, in a
+     * form like HH:MM:SS.mmm
+     */
     std::string toText(bool fixedDp = false) const;
 
-    // Return a user-readable string to the nearest second in a form
-    // like "6s" (for less than a minute) or "2:21" (for more).
-    //
+    /**
+     * Return a user-readable string to the nearest second, in a form
+     * like "6s" (for less than a minute) or "2:21" (for more).
+     */
     std::string toSecText() const;
 
-    // Convenience functions for handling sample frames
-    //
+    /**
+     * Convert a RealTime into a sample frame at the given sample rate.
+     */
     static long realTime2Frame(const RealTime &r, unsigned int sampleRate);
+
+    /**
+     * Convert a sample frame at the given sample rate into a RealTime.
+     */
     static RealTime frame2RealTime(long frame, unsigned int sampleRate);
 
     static const RealTime zeroTime;