summaryrefslogtreecommitdiff
path: root/src/mongo/util/time_support.h
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2013-07-23 20:53:47 -0400
committerAndy Schwerin <schwerin@10gen.com>2013-07-24 12:48:42 -0400
commitd10114734e1e718f1184714d0d0db8b7ccd70e10 (patch)
tree3280e3616f100430bee66af9a404a3eb51c9f6ef /src/mongo/util/time_support.h
parent66d94037a5c2498809abc2c596f2c7a2e332068d (diff)
downloadmongo-d10114734e1e718f1184714d0d0db8b7ccd70e10.tar.gz
SERVER-7965 Move date/time types and functions from bson/util/misc.h to util/time_support.{h,cpp}.
Diffstat (limited to 'src/mongo/util/time_support.h')
-rw-r--r--src/mongo/util/time_support.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/mongo/util/time_support.h b/src/mongo/util/time_support.h
index fe931ab2a1f..1f6c2dbd978 100644
--- a/src/mongo/util/time_support.h
+++ b/src/mongo/util/time_support.h
@@ -21,11 +21,26 @@
#include <string>
#include <boost/thread/xtime.hpp>
-#include "mongo/bson/util/misc.h" // Date_t
-
namespace mongo {
void time_t_to_Struct(time_t t, struct tm * buf , bool local = false );
+ std::string time_t_to_String(time_t t);
+ std::string time_t_to_String_short(time_t t);
+
+ struct Date_t {
+ // TODO: make signed (and look for related TODO's)
+ unsigned long long millis;
+ Date_t(): millis(0) {}
+ Date_t(unsigned long long m): millis(m) {}
+ operator unsigned long long&() { return millis; }
+ operator const unsigned long long&() const { return millis; }
+ void toTm (tm *buf);
+ std::string toString() const;
+ time_t toTimeT() const;
+ int64_t asInt64() const {
+ return static_cast<int64_t>(millis);
+ }
+ };
// uses ISO 8601 dates without trailing Z
// colonsOk should be false when creating filenames