如何在strptime(3)中使用毫秒

问题描述 投票:0回答:1

我想使用 strptime(3) 格式化 2023/10/04T11:41:03.553Z

%Y/%m/%dT%H:%M:%S.???Z

秒分数的输入字段描述符是什么?

虽然我通读了strptime(3)的文档,但我找不到任何与“毫秒”对应的输入字段描述符。

c strptime
1个回答
0
投票
非 C 库函数中的

strptime()
。它通常使用指向
struct tm
的指针。

struct tm
定义为具有至少 7 个成员。它可能还有更多。没有比更精细的时间单位对应的指定成员。

有时

struct tm
有一个成员持续 millisecondsmicorsseocnds 等。但这取决于实现。

引用的

strptime()
根本没有亚秒的说明符。代码需要以其他方式处理此类可选成员。

© www.soinside.com 2019 - 2024. All rights reserved.