From d10114734e1e718f1184714d0d0db8b7ccd70e10 Mon Sep 17 00:00:00 2001 From: Andy Schwerin Date: Tue, 23 Jul 2013 20:53:47 -0400 Subject: SERVER-7965 Move date/time types and functions from bson/util/misc.h to util/time_support.{h,cpp}. --- src/mongo/util/time_support.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/mongo/util/time_support.h') 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 #include -#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(millis); + } + }; // uses ISO 8601 dates without trailing Z // colonsOk should be false when creating filenames -- cgit v1.2.1