c++ - 如何在 C++ 中从 protobuf 时间戳重建日期

标签 c++ date timestamp protocol-buffers

我试图从 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/

相关文章:

c++ - 自定义排序比较函数抛出编译错误

c++ - macOS fatal error : sys/_types/_int8_t. h : No such file or directory #include <sys/_types/_int8_t. h>

java - 在 Java 中对两个日期求和

c# - 为什么我的 IEnumerable 日期不包含我的日期

javascript - 17位时间戳的区别

c++ - Beast websocket 惯用关闭?

c++ - CRTP 和多级继承

java - Android计算两个日期之间的天数

sql - HH :MM:SS 中的 Oracle SQL 时间差

timestamp - 如何在 postman 请求中添加时间戳?