22 #include <boost/thread/xtime.hpp>
23 #include <boost/date_time/posix_time/posix_time.hpp>
25 #include "mongo/bson/util/misc.h"
29 void time_t_to_Struct(time_t t,
struct tm * buf ,
bool local =
false );
43 std::string terseCurrentTime(
bool colonsOk=
true);
45 std::string timeToISOString(time_t time);
47 boost::gregorian::date currentDate();
50 bool toPointInTime(
const std::string& str , boost::posix_time::ptime* timeOfDay );
52 void sleepsecs(
int s);
53 void sleepmillis(
long long ms);
54 void sleepmicros(
long long micros);
59 Backoff(
int maxSleepMillis,
int resetAfter ) :
60 _maxSleepMillis( maxSleepMillis ),
61 _resetAfterMillis( maxSleepMillis + resetAfter ),
62 _lastSleepMillis( 0 ),
63 _lastErrorTimeMillis( 0 )
66 void nextSleepMillis();
72 int _resetAfterMillis;
76 unsigned long long _lastErrorTimeMillis;
80 void jsTimeVirtualSkew(
long long skew );
82 void jsTimeVirtualThreadSkew(
long long skew );
83 long long getJSTimeVirtualThreadSkew();
90 unsigned long long curTimeMicros64();
91 unsigned long long curTimeMillis64();
94 char *asctime(
const struct tm *tm);
95 char *ctime(
const time_t *timep);
96 struct tm *gmtime(
const time_t *timep);
97 struct tm *localtime(
const time_t *timep);
99 #if defined(MONGO_BOOST_TIME_UTC_HACK) || (BOOST_VERSION >= 105000)
100 #define MONGO_BOOST_TIME_UTC boost::TIME_UTC_
102 #define MONGO_BOOST_TIME_UTC boost::TIME_UTC