mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-18 11:39:02 +02:00
Fixed #724.
Fixed type mismatch in msgpack_timestamp. Added 64bit singed postfix.
This commit is contained in:
@@ -28,13 +28,17 @@ static inline bool msgpack_object_to_timestamp(const msgpack_object* obj, msgpac
|
|||||||
switch (obj->via.ext.size) {
|
switch (obj->via.ext.size) {
|
||||||
case 4:
|
case 4:
|
||||||
ts->tv_nsec = 0;
|
ts->tv_nsec = 0;
|
||||||
_msgpack_load32(uint32_t, obj->via.ext.ptr, &ts->tv_sec);
|
{
|
||||||
|
uint32_t v;
|
||||||
|
_msgpack_load32(uint32_t, obj->via.ext.ptr, &v);
|
||||||
|
ts->tv_sec = v;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
case 8: {
|
case 8: {
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
_msgpack_load64(uint64_t, obj->via.ext.ptr, &value);
|
_msgpack_load64(uint64_t, obj->via.ext.ptr, &value);
|
||||||
ts->tv_nsec = (uint32_t)(value >> 34);
|
ts->tv_nsec = (uint32_t)(value >> 34);
|
||||||
ts->tv_sec = value & 0x00000003ffffffffL;
|
ts->tv_sec = value & 0x00000003ffffffffLL;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case 12:
|
case 12:
|
||||||
|
@@ -41,7 +41,7 @@ struct as<std::chrono::system_clock::time_point> {
|
|||||||
uint64_t value;
|
uint64_t value;
|
||||||
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
|
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
|
||||||
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
|
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
|
||||||
uint64_t sec = value & 0x00000003ffffffffL;
|
uint64_t sec = value & 0x00000003ffffffffLL;
|
||||||
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
|
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
|
||||||
std::chrono::nanoseconds(nanosec));
|
std::chrono::nanoseconds(nanosec));
|
||||||
tp += std::chrono::seconds(sec);
|
tp += std::chrono::seconds(sec);
|
||||||
@@ -79,7 +79,7 @@ struct convert<std::chrono::system_clock::time_point> {
|
|||||||
uint64_t value;
|
uint64_t value;
|
||||||
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
|
_msgpack_load64(uint64_t, o.via.ext.data(), &value);
|
||||||
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
|
uint32_t nanosec = static_cast<uint32_t>(value >> 34);
|
||||||
uint64_t sec = value & 0x00000003ffffffffL;
|
uint64_t sec = value & 0x00000003ffffffffLL;
|
||||||
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
|
tp += std::chrono::duration_cast<std::chrono::system_clock::duration>(
|
||||||
std::chrono::nanoseconds(nanosec));
|
std::chrono::nanoseconds(nanosec));
|
||||||
tp += std::chrono::seconds(sec);
|
tp += std::chrono::seconds(sec);
|
||||||
|
Reference in New Issue
Block a user