`struct tm` 中的 'tm' 代表什么?
What does the 'tm' in `struct tm` stand for?
只是好奇。我倾向于将 struct tm
类型的变量命名为 time_bits
或类似的名称,因为它包含细分的日历时间位。我看到的大多数文档都将这种类型称为 'calendar time',而不是 'clock time' 或 'epoch seconds' 表示 time_t
.
几乎可以肯定它只代表 "time"。 ISO标准将其描述为一个东西:
... which holds the components of a calendar time, called the broken-down time.
如果命名为struct time
,很多人会把它和这个函数混淆:
time_t time(time_t *);
尽管在 C 语言中结构标记不会干扰 variable/function 名称,但使用不同的名称可以减少混淆。
只是好奇。我倾向于将 struct tm
类型的变量命名为 time_bits
或类似的名称,因为它包含细分的日历时间位。我看到的大多数文档都将这种类型称为 'calendar time',而不是 'clock time' 或 'epoch seconds' 表示 time_t
.
几乎可以肯定它只代表 "time"。 ISO标准将其描述为一个东西:
... which holds the components of a calendar time, called the broken-down time.
如果命名为struct time
,很多人会把它和这个函数混淆:
time_t time(time_t *);
尽管在 C 语言中结构标记不会干扰 variable/function 名称,但使用不同的名称可以减少混淆。