comparison base/RealTimeSV.cpp @ 1429:48e9f538e6e9

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents 622d193a00dc
children 71207822a7e0
comparison
equal deleted inserted replaced
1428:87ae75da6527 1429:48e9f538e6e9
167 } 167 }
168 168
169 std::ostream &operator<<(std::ostream &out, const RealTime &rt) 169 std::ostream &operator<<(std::ostream &out, const RealTime &rt)
170 { 170 {
171 if (rt < RealTime::zeroTime) { 171 if (rt < RealTime::zeroTime) {
172 out << "-"; 172 out << "-";
173 } else { 173 } else {
174 out << " "; 174 out << " ";
175 } 175 }
176 176
177 int s = (rt.sec < 0 ? -rt.sec : rt.sec); 177 int s = (rt.sec < 0 ? -rt.sec : rt.sec);
178 int n = (rt.nsec < 0 ? -rt.nsec : rt.nsec); 178 int n = (rt.nsec < 0 ? -rt.nsec : rt.nsec);
179 179
180 out << s << "."; 180 out << s << ".";
181 181
182 int nn(n); 182 int nn(n);
183 if (nn == 0) out << "00000000"; 183 if (nn == 0) out << "00000000";
184 else while (nn < (ONE_BILLION / 10)) { 184 else while (nn < (ONE_BILLION / 10)) {
185 out << "0"; 185 out << "0";
186 nn *= 10; 186 nn *= 10;
187 } 187 }
188 188
189 out << n << "R"; 189 out << n << "R";
190 return out; 190 return out;
191 } 191 }
312 writeSecPart(out, hms, sec); 312 writeSecPart(out, hms, sec);
313 313
314 int ms = msec(); 314 int ms = msec();
315 315
316 if (ms != 0) { 316 if (ms != 0) {
317 out << "."; 317 out << ".";
318 out << (ms / 100); 318 out << (ms / 100);
319 ms = ms % 100; 319 ms = ms % 100;
320 if (ms != 0) { 320 if (ms != 0) {
321 out << (ms / 10); 321 out << (ms / 10);
322 ms = ms % 10; 322 ms = ms % 10;
323 } else if (fixedDp) { 323 } else if (fixedDp) {
324 out << "0"; 324 out << "0";
325 } 325 }
326 if (ms != 0) { 326 if (ms != 0) {
327 out << ms; 327 out << ms;
328 } else if (fixedDp) { 328 } else if (fixedDp) {
329 out << "0"; 329 out << "0";
330 } 330 }
331 } else if (fixedDp) { 331 } else if (fixedDp) {
332 out << ".000"; 332 out << ".000";
333 } 333 }
334 334
335 std::string s = out.str(); 335 std::string s = out.str();
336 336
337 return s; 337 return s;
338 } 338 }
339 339
364 while (div) { 364 while (div) {
365 int d = (f / div) % 10; 365 int d = (f / div) % 10;
366 out << d; 366 out << d;
367 div /= 10; 367 div /= 10;
368 } 368 }
369 369
370 std::string s = out.str(); 370 std::string s = out.str();
371 371
372 // cerr << "converted " << toString() << " to " << s << endl; 372 // cerr << "converted " << toString() << " to " << s << endl;
373 373
374 return s; 374 return s;