mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
Renamed MongoDB::SpecialTimestamp to MongoDB::Timestamp
This commit is contained in:
@@ -291,7 +291,7 @@ inline void BSONWriter::write<NullValue>(NullValue& from)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SpecialTimestamp {
|
struct Timestamp {
|
||||||
Poco::Timestamp ts;
|
Poco::Timestamp ts;
|
||||||
Poco::Int32 inc;
|
Poco::Int32 inc;
|
||||||
};
|
};
|
||||||
@@ -299,11 +299,11 @@ struct SpecialTimestamp {
|
|||||||
// BSON Timestamp
|
// BSON Timestamp
|
||||||
// spec: int64
|
// spec: int64
|
||||||
template<>
|
template<>
|
||||||
struct ElementTraits<SpecialTimestamp>
|
struct ElementTraits<Timestamp>
|
||||||
{
|
{
|
||||||
enum { TypeId = 0x11 };
|
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;
|
std::string result;
|
||||||
result.append(1, '"');
|
result.append(1, '"');
|
||||||
@@ -317,18 +317,18 @@ struct ElementTraits<SpecialTimestamp>
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void BSONReader::read<SpecialTimestamp>(SpecialTimestamp& to)
|
inline void BSONReader::read<Timestamp>(Timestamp& to)
|
||||||
{
|
{
|
||||||
Poco::Int64 value;
|
Poco::Int64 value;
|
||||||
_reader >> value;
|
_reader >> value;
|
||||||
to.inc = value & 0xffffffff;
|
to.inc = value & 0xffffffff;
|
||||||
value >>= 32;
|
value >>= 32;
|
||||||
to.ts = Timestamp::fromEpochTime(static_cast<std::time_t>(value));
|
to.ts = Poco::Timestamp::fromEpochTime(static_cast<std::time_t>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline void BSONWriter::write<SpecialTimestamp>(SpecialTimestamp& from)
|
inline void BSONWriter::write<Timestamp>(Timestamp& from)
|
||||||
{
|
{
|
||||||
Poco::Int64 value = from.ts.epochMicroseconds() / 1000;
|
Poco::Int64 value = from.ts.epochMicroseconds() / 1000;
|
||||||
value <<= 32;
|
value <<= 32;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public:
|
|||||||
virtual ~ObjectId();
|
virtual ~ObjectId();
|
||||||
/// Destructor
|
/// Destructor
|
||||||
|
|
||||||
Timestamp timestamp() const;
|
Poco::Timestamp timestamp() const;
|
||||||
/// Returns the timestamp which is stored in the first four bytes of the id
|
/// Returns the timestamp which is stored in the first four bytes of the id
|
||||||
|
|
||||||
std::string toString(const std::string& fmt = "%02x") const;
|
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;
|
int time;
|
||||||
char* T = (char *) &time;
|
char* T = (char *) &time;
|
||||||
@@ -89,7 +89,7 @@ inline Timestamp ObjectId::timestamp() const
|
|||||||
T[1] = _id[2];
|
T[1] = _id[2];
|
||||||
T[2] = _id[1];
|
T[2] = _id[1];
|
||||||
T[3] = _id[0];
|
T[3] = _id[0];
|
||||||
return Timestamp::fromEpochTime((time_t) time);
|
return Poco::Timestamp::fromEpochTime((time_t) time);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int ObjectId::fromHex(char c)
|
inline int ObjectId::fromHex(char c)
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ void Document::read(BinaryReader& reader)
|
|||||||
case ElementTraits<Poco::Timestamp>::TypeId:
|
case ElementTraits<Poco::Timestamp>::TypeId:
|
||||||
element = new ConcreteElement<Poco::Timestamp>(name, Poco::Timestamp());
|
element = new ConcreteElement<Poco::Timestamp>(name, Poco::Timestamp());
|
||||||
break;
|
break;
|
||||||
case ElementTraits<SpecialTimestamp>::TypeId:
|
case ElementTraits<Timestamp>::TypeId:
|
||||||
element = new ConcreteElement<SpecialTimestamp>(name, SpecialTimestamp());
|
element = new ConcreteElement<Timestamp>(name, Timestamp());
|
||||||
break;
|
break;
|
||||||
case ElementTraits<NullValue>::TypeId:
|
case ElementTraits<NullValue>::TypeId:
|
||||||
element = new ConcreteElement<NullValue>(name, NullValue(0));
|
element = new ConcreteElement<NullValue>(name, NullValue(0));
|
||||||
|
|||||||
Reference in New Issue
Block a user