int read;
float amount;
- // Now try to read it in the letter-abreviated format
+ // Now try to read it in the letter-abbreviated format
while(pos<str.size() && sscanf(String(str,pos).c_str(),"%f%n",&amount,&read))
{
pos+=read;
int second;
second=time;time-=second;
- if(fps)
+ if(fps && fps>1)
{
int frame;
frame=round_to_int(time*fps);
started = true;
}
- if(fps)
+ if(fps && fps>1)
{
int second;
float frame;
if(format<=FORMAT_FULL || second || !started)
{
if(abs(second-floor(second))>=epsilon_())
- ret+=strprintf("%0.8fs",second);
+ {
+ String seconds(strprintf("%0.8f",second));
+
+ // skip trailing zeros
+ int count = 0;
+ for (String::reverse_iterator i = seconds.rbegin(); (*i) == '0'; i++)
+ count++;
+
+ // if we removed too many, go back one place, leaving one zero
+ if (*i < '0' || *i > '9') count--;
+
+ ret += seconds.substr(0, seconds.size()-count) + "s";
+ }
else
ret+=strprintf("%0.0fs",second);
}
return ceil(time)/fps;
}
+#ifdef _DEBUG
+const char *
+Time::c_str()const
+{
+ return get_string().c_str();
+}
+#endif
+
//! \writeme
bool
Time::is_valid()const