RcppMsgPack (version 0.2.3)

msgpack_timestamp_decode: 'MsgPack' Timestamp

Description

Decodes a timestamp from the 'MsgPack' extension specifications.

Usage

msgpack_timestamp_decode(x, posix = T, tz = "UTC")

msgpackTimestampDecode(x, posix = T, tz = "UTC")

Arguments

x

A raw vector with attriubte EXT = -1, following the 'MsgPack' timestamp specifications.

posix

Return a POSIXct object. Otherwise, return a list with seconds and nanoseconds since 1970-01-01 00:00:00.

tz

If returning a POSIXct, set the timezone. Note that this doesn't change the underlying value.

Value

A POSIXct or list. mt <- Sys.time() attr(mt, "tzone") <- "UTC" mp <- msgpack_pack(msgpack_timestamp_encode(mt)) mtu <- msgpack_timestamp_decode(msgpack_unpack(mp)) identical(mt, mtu)