Renamed MongoDB::SpecialTimestamp to MongoDB::Timestamp

This commit is contained in:
Tomaz Beltram 2016-09-28 10:47:14 +02:00
parent 1852739547
commit 06f6f05566
3 changed files with 11 additions and 11 deletions

View File

@ -291,7 +291,7 @@ inline void BSONWriter::write<NullValue>(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<SpecialTimestamp>
struct ElementTraits<Timestamp>
{
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<SpecialTimestamp>
template<>
inline void BSONReader::read<SpecialTimestamp>(SpecialTimestamp& to)
inline void BSONReader::read<Timestamp>(Timestamp& to)
{
Poco::Int64 value;
_reader >> value;
to.inc = value & 0xffffffff;
value >>= 32;
to.ts = Timestamp::fromEpochTime(static_cast<std::time_t>(value));
to.ts = Poco::Timestamp::fromEpochTime(static_cast<std::time_t>(value));
}
template<>
inline void BSONWriter::write<SpecialTimestamp>(SpecialTimestamp& from)
inline void BSONWriter::write<Timestamp>(Timestamp& from)
{
Poco::Int64 value = from.ts.epochMicroseconds() / 1000;
value <<= 32;

View File

@ -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)

View File

@ -96,8 +96,8 @@ void Document::read(BinaryReader& reader)
case ElementTraits<Poco::Timestamp>::TypeId:
element = new ConcreteElement<Poco::Timestamp>(name, Poco::Timestamp());
break;
case ElementTraits<SpecialTimestamp>::TypeId:
element = new ConcreteElement<SpecialTimestamp>(name, SpecialTimestamp());
case ElementTraits<Timestamp>::TypeId:
element = new ConcreteElement<Timestamp>(name, Timestamp());
break;
case ElementTraits<NullValue>::TypeId:
element = new ConcreteElement<NullValue>(name, NullValue(0));