Mercurial > hg > svcore
comparison base/RealTime.cpp @ 843:e802e550a1f2
Drop std:: from cout, cerr, endl -- pull these in through Debug.h
author | Chris Cannam |
---|---|
date | Tue, 26 Nov 2013 13:35:08 +0000 |
parents | 335c3f922327 |
children | 0f363d0fbdc3 |
comparison
equal
deleted
inserted
replaced
842:23d3a6eca5c3 | 843:e802e550a1f2 |
---|---|
21 #include <iostream> | 21 #include <iostream> |
22 | 22 |
23 #include <cstdlib> | 23 #include <cstdlib> |
24 #include <sstream> | 24 #include <sstream> |
25 | 25 |
26 using std::cerr; | |
27 using std::endl; | |
28 | |
29 #include "RealTime.h" | 26 #include "RealTime.h" |
30 #include "sys/time.h" | 27 #include "sys/time.h" |
28 | |
29 #include "Debug.h" | |
31 | 30 |
32 #include "Preferences.h" | 31 #include "Preferences.h" |
33 | 32 |
34 // A RealTime consists of two ints that must be at least 32 bits each. | 33 // A RealTime consists of two ints that must be at least 32 bits each. |
35 // A signed 32-bit int can store values exceeding +/- 2 billion. This | 34 // A signed 32-bit int can store values exceeding +/- 2 billion. This |
127 | 126 |
128 ++i; | 127 ++i; |
129 } | 128 } |
130 | 129 |
131 if (year > 0) { | 130 if (year > 0) { |
132 std::cerr << "WARNING: This xsd:duration (\"" << xsdd << "\") contains a non-zero year.\nWith no origin and a limited data size, I will treat a year as exactly 31556952\nseconds and you should expect overflow and/or poor results." << std::endl; | 131 cerr << "WARNING: This xsd:duration (\"" << xsdd << "\") contains a non-zero year.\nWith no origin and a limited data size, I will treat a year as exactly 31556952\nseconds and you should expect overflow and/or poor results." << endl; |
133 t = t + RealTime(year * 31556952, 0); | 132 t = t + RealTime(year * 31556952, 0); |
134 } | 133 } |
135 | 134 |
136 if (month > 0) { | 135 if (month > 0) { |
137 std::cerr << "WARNING: This xsd:duration (\"" << xsdd << "\") contains a non-zero month.\nWith no origin and a limited data size, I will treat a month as exactly 2629746\nseconds and you should expect overflow and/or poor results." << std::endl; | 136 cerr << "WARNING: This xsd:duration (\"" << xsdd << "\") contains a non-zero month.\nWith no origin and a limited data size, I will treat a month as exactly 2629746\nseconds and you should expect overflow and/or poor results." << endl; |
138 t = t + RealTime(month * 2629746, 0); | 137 t = t + RealTime(month * 2629746, 0); |
139 } | 138 } |
140 | 139 |
141 if (day > 0) { | 140 if (day > 0) { |
142 t = t + RealTime(day * 86400, 0); | 141 t = t + RealTime(day * 86400, 0); |
339 div *= 10; | 338 div *= 10; |
340 } | 339 } |
341 | 340 |
342 out << ":"; | 341 out << ":"; |
343 | 342 |
344 // std::cerr << "div = " << div << ", f = "<< f << std::endl; | 343 // cerr << "div = " << div << ", f = "<< f << endl; |
345 | 344 |
346 while (div) { | 345 while (div) { |
347 int d = (f / div) % 10; | 346 int d = (f / div) % 10; |
348 out << d; | 347 out << d; |
349 div /= 10; | 348 div /= 10; |
350 } | 349 } |
351 | 350 |
352 std::string s = out.str(); | 351 std::string s = out.str(); |
353 | 352 |
354 // std::cerr << "converted " << toString() << " to " << s << std::endl; | 353 // cerr << "converted " << toString() << " to " << s << endl; |
355 | 354 |
356 return s; | 355 return s; |
357 } | 356 } |
358 | 357 |
359 std::string | 358 std::string |