diff --git a/MongoDB/include/Poco/MongoDB/Element.h b/MongoDB/include/Poco/MongoDB/Element.h index 8ad530e9f..f2418d130 100644 --- a/MongoDB/include/Poco/MongoDB/Element.h +++ b/MongoDB/include/Poco/MongoDB/Element.h @@ -291,7 +291,7 @@ inline void BSONWriter::write(NullValue& from) { } -struct SpecialTimestamp { +struct Timestamp { Poco::Timestamp ts; Poco::Int32 inc; }; @@ -299,11 +299,11 @@ struct SpecialTimestamp { // BSON Timestamp // spec: int64 template<> -struct ElementTraits +struct ElementTraits { enum { TypeId = 0x11 }; - static std::string toString(const SpecialTimestamp& value, int indent = 0) + static std::string toString(const Timestamp& value, int indent = 0) { std::string result; result.append(1, '"'); @@ -317,18 +317,18 @@ struct ElementTraits template<> -inline void BSONReader::read(SpecialTimestamp& to) +inline void BSONReader::read(Timestamp& to) { Poco::Int64 value; _reader >> value; to.inc = value & 0xffffffff; value >>= 32; - to.ts = Timestamp::fromEpochTime(static_cast(value)); + to.ts = Poco::Timestamp::fromEpochTime(static_cast(value)); } template<> -inline void BSONWriter::write(SpecialTimestamp& from) +inline void BSONWriter::write(Timestamp& from) { Poco::Int64 value = from.ts.epochMicroseconds() / 1000; value <<= 32; diff --git a/MongoDB/include/Poco/MongoDB/ObjectId.h b/MongoDB/include/Poco/MongoDB/ObjectId.h index aa85a2907..6c7868749 100644 --- a/MongoDB/include/Poco/MongoDB/ObjectId.h +++ b/MongoDB/include/Poco/MongoDB/ObjectId.h @@ -56,7 +56,7 @@ public: virtual ~ObjectId(); /// Destructor - Timestamp timestamp() const; + Poco::Timestamp timestamp() const; /// Returns the timestamp which is stored in the first four bytes of the id std::string toString(const std::string& fmt = "%02x") const; @@ -81,7 +81,7 @@ private: }; -inline Timestamp ObjectId::timestamp() const +inline Poco::Timestamp ObjectId::timestamp() const { int time; char* T = (char *) &time; @@ -89,7 +89,7 @@ inline Timestamp ObjectId::timestamp() const T[1] = _id[2]; T[2] = _id[1]; T[3] = _id[0]; - return Timestamp::fromEpochTime((time_t) time); + return Poco::Timestamp::fromEpochTime((time_t) time); } inline int ObjectId::fromHex(char c) diff --git a/MongoDB/src/Document.cpp b/MongoDB/src/Document.cpp index 080095112..9f7cce2d8 100644 --- a/MongoDB/src/Document.cpp +++ b/MongoDB/src/Document.cpp @@ -96,8 +96,8 @@ void Document::read(BinaryReader& reader) case ElementTraits::TypeId: element = new ConcreteElement(name, Poco::Timestamp()); break; - case ElementTraits::TypeId: - element = new ConcreteElement(name, SpecialTimestamp()); + case ElementTraits::TypeId: + element = new ConcreteElement(name, Timestamp()); break; case ElementTraits::TypeId: element = new ConcreteElement(name, NullValue(0));