gpt4 book ai didi

c# - 从 .Net System.DateTime 生成 Google Protobuf 时间戳

转载 作者:太空宇宙 更新时间:2023-11-03 22:28:41 24 4
gpt4 key购买 nike

如何在形成 protobuf 消息时将 .Net System.DateTime 转换为 google Protobuf TimeStamp?

最佳答案

使用 protobuf 的 Timestamp.FromDateTime。以下是将 DateTime.Now 转换为原始时间戳类型的示例。

Google.Protobuf.WellKnownTypes.Timestamp protoTimestamp 
= Google.Protobuf.WellKnownTypes.Timestamp.FromDateTime(DateTime.Now);

这是官方引用link

关于c# - 从 .Net System.DateTime 生成 Google Protobuf 时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59298112/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com