23#include <boost/date_time/posix_time/posix_time_types.hpp>
24#include <boost/thread/xtime.hpp>
25#include <boost/version.hpp>
27#include "mongo/base/status_with.h"
28#include "mongo/client/export_macros.h"
32typedef boost::posix_time::milliseconds Milliseconds;
33typedef boost::posix_time::seconds Seconds;
35void time_t_to_Struct(time_t t,
struct tm* buf,
bool local =
false);
36std::string time_t_to_String(time_t t);
37std::string time_t_to_String_short(time_t t);
41 unsigned long long millis;
43 Date_t(
unsigned long long m) : millis(m) {}
44 operator unsigned long long&() {
47 operator const unsigned long long&()
const {
51 std::string toString()
const;
52 time_t toTimeT()
const;
53 int64_t asInt64()
const {
54 return static_cast<int64_t
>(millis);
56 bool isFormatable()
const;
61MONGO_CLIENT_API std::string MONGO_CLIENT_FUNC terseCurrentTime(
bool colonsOk =
true);
120boost::gregorian::date currentDate();
123bool toPointInTime(
const std::string& str, boost::posix_time::ptime* timeOfDay);
125MONGO_CLIENT_API
void MONGO_CLIENT_FUNC sleepsecs(
int s);
126MONGO_CLIENT_API
void MONGO_CLIENT_FUNC sleepmillis(
long long ms);
127MONGO_CLIENT_API
void MONGO_CLIENT_FUNC sleepmicros(
long long micros);
131 Backoff(
int maxSleepMillis,
int resetAfter)
132 : _maxSleepMillis(maxSleepMillis),
133 _resetAfterMillis(maxSleepMillis + resetAfter),
135 _lastErrorTimeMillis(0) {}
137 void nextSleepMillis();
143 unsigned long long currTimeMillis,
144 unsigned long long lastErrorTimeMillis)
const;
149 int _resetAfterMillis;
152 int _lastSleepMillis;
153 unsigned long long _lastErrorTimeMillis;
157void jsTimeVirtualSkew(
long long skew);
159void jsTimeVirtualThreadSkew(
long long skew);
160long long getJSTimeVirtualThreadSkew();
167unsigned long long curTimeMicros64();
168unsigned long long curTimeMillis64();
171char* asctime(
const struct tm* tm);
172char* ctime(
const time_t* timep);
173struct tm* gmtime(
const time_t* timep);
174struct tm* localtime(
const time_t* timep);
176#if (BOOST_VERSION >= 105000)
177#define MONGO_BOOST_TIME_UTC boost::TIME_UTC_
179#define MONGO_BOOST_TIME_UTC boost::TIME_UTC
Definition time_support.h:129
int getNextSleepMillis(int lastSleepMillis, unsigned long long currTimeMillis, unsigned long long lastErrorTimeMillis) const
testing-only function.
Definition sasl_client_conversation.h:28
the main MongoDB namespace
Definition bulk_operation_builder.h:24
MONGO_CLIENT_API std::string MONGO_CLIENT_FUNC timeToISOString(time_t time)
Formats "time" according to the ISO 8601 extended form standard, including date, and time,...
MONGO_CLIENT_API std::string MONGO_CLIENT_FUNC dateToCtimeString(Date_t date)
Formats "date" in fixed width in the local time zone.
MONGO_CLIENT_API std::string MONGO_CLIENT_FUNC dateToISOStringLocal(Date_t date)
Formats "date" according to the ISO 8601 extended form standard, including date, and time with millis...
MONGO_CLIENT_API void MONGO_CLIENT_FUNC outputDateAsISOStringUTC(std::ostream &os, Date_t date)
Like dateToISOStringUTC, except outputs to a std::ostream.
MONGO_CLIENT_API StatusWith< Date_t > MONGO_CLIENT_FUNC dateFromISOString(const StringData &dateString)
Parses a Date_t from an ISO 8601 string representation.
MONGO_CLIENT_API Date_t MONGO_CLIENT_FUNC jsTime()
Date_t is milliseconds since epoch.
MONGO_CLIENT_API void MONGO_CLIENT_FUNC outputDateAsISOStringLocal(std::ostream &os, Date_t date)
Like dateToISOStringLocal, except outputs to a std::ostream.
unsigned curTimeMicros()
warning this will wrap
MONGO_CLIENT_API std::string MONGO_CLIENT_FUNC dateToISOStringUTC(Date_t date)
Formats "date" according to the ISO 8601 extended form standard, including date, and time with millis...
MONGO_CLIENT_API void MONGO_CLIENT_FUNC outputDateAsCtime(std::ostream &os, Date_t date)
Like dateToCtimeString, except outputs to a std::ostream.
Definition time_support.h:39