我试图从 protobuf 时间戳推断出表示当前日期的字符串。我在文档中看到应该有一个名为 DateTime 的类,但我在任何地方都没有看到它。
我唯一的解决方案是编写从 protobuf 时间戳转换回“日期”格式的逻辑吗?
最佳答案
一旦我们知道了 protobuf 知名类型时间戳的功能(这样我们就不会重新发明轮子):
https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp
然后,继续 C++ API 引用:
https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.util.time_util
关于c++ - 如何在 C++ 中从 protobuf 时间戳重建日期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48065142/