6 #if defined(HAVE_CONFIG_H)
13 #include <boost/date_time/posix_time/posix_time.hpp>
14 #include <boost/thread.hpp>
17 static int64_t nMockTime = 0;
21 if (nMockTime)
return nMockTime;
28 nMockTime = nMockTimeIn;
33 return (boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time()) -
34 boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1)))
35 .total_milliseconds();
40 return (boost::posix_time::ptime(boost::posix_time::microsec_clock::universal_time()) -
41 boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1)))
42 .total_microseconds();
47 boost::this_thread::sleep_for(boost::chrono::milliseconds(n));
53 std::locale loc(std::locale::classic(),
new boost::posix_time::time_facet(pszFormat));
56 ss << boost::posix_time::from_time_t(nTime);
62 int seconds = nDurationTime % 60;
64 int minutes = nDurationTime % 60;
66 int hours = nDurationTime % 24;
67 int days = nDurationTime / 24;
69 return strprintf(
"%dd %02dh:%02dm:%02ds", days, hours, minutes, seconds);
71 return strprintf(
"%02dh:%02dm:%02ds", hours, minutes, seconds);
72 return strprintf(
"%02dm:%02ds", minutes, seconds);