Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
246:d7eeffbb8aaf | 247:21b9b25bff48 |
---|---|
123 } | 123 } |
124 | 124 |
125 std::string | 125 std::string |
126 RealTime::toText(bool fixedDp) const | 126 RealTime::toText(bool fixedDp) const |
127 { | 127 { |
128 if (*this < RealTime::zeroTime) return "-" + (-*this).toText(); | 128 if (*this < RealTime::zeroTime) return "-" + (-*this).toText(fixedDp); |
129 | 129 |
130 std::stringstream out; | 130 std::stringstream out; |
131 | 131 |
132 if (sec >= 3600) { | 132 if (sec >= 3600) { |
133 out << (sec / 3600) << ":"; | 133 out << (sec / 3600) << ":"; |
171 std::string s = out.str(); | 171 std::string s = out.str(); |
172 | 172 |
173 return s; | 173 return s; |
174 } | 174 } |
175 | 175 |
176 std::string | |
177 RealTime::toSecText() const | |
178 { | |
179 if (*this < RealTime::zeroTime) return "-" + (-*this).toSecText(); | |
180 | |
181 std::stringstream out; | |
182 | |
183 if (sec >= 3600) { | |
184 out << (sec / 3600) << ":"; | |
185 } | |
186 | |
187 if (sec >= 60) { | |
188 out << (sec % 3600) / 60 << ":"; | |
189 } | |
190 | |
191 if (sec >= 10) { | |
192 out << ((sec % 60) / 10); | |
193 } | |
194 | |
195 out << (sec % 10); | |
196 | |
197 if (sec < 60) { | |
198 out << "s"; | |
199 } | |
200 | |
201 | |
202 #if (__GNUC__ < 3) | |
203 out << std::ends; | |
204 #endif | |
205 | |
206 std::string s = out.str(); | |
207 | |
208 return s; | |
209 } | |
210 | |
176 RealTime | 211 RealTime |
177 RealTime::operator*(int m) const | 212 RealTime::operator*(int m) const |
178 { | 213 { |
179 double t = (double(nsec) / ONE_BILLION) * m; | 214 double t = (double(nsec) / ONE_BILLION) * m; |
180 t += sec * m; | 215 t += sec * m; |