Date and time type for use with Protobuf

前端 未结 3 1269
夕颜
夕颜 2020-12-24 10:37

I\'m considering to use Protocol Buffers for data exchange between a Linux and a Windows based system.

Whats the recommended format for sending date/time (timestamp

3条回答
  •  春和景丽
    2020-12-24 10:46

    Although you aren't saying which languages you are using or what kind of precision you need, I would suggest using Unix time encoded into a int64. It is fairly easy to handle in most languages and platforms (see here for a Windows example), and Protobufs will use a varint-encoding keeping the size small without limiting the representable range too much.

提交回复
热议问题