c++ - linux中的time_t类型是什么

标签 c++ linux time types

<分区>

我是 C/linux 的新手。 man time_t 不成功。我想弄清楚 time_t 类型到底是什么?当我将 const int 分配给变量类型 time_t 时就可以了,如下所示:

time_t =4;

似乎这种类型只是某些数字类型的别名。但是我不明白这是什么类型?

最佳答案

是的,它通常是一个别名,但它是 C/C++ 中的标准类型。它不仅可以在 Linux 中使用。

http://www.cplusplus.com/reference/ctime/time_t/

time_t

Time type

Alias of a fundamental arithmetic type capable of representing times, as those returned by function time.

For historical reasons, it is generally implemented as an integral value representing the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC (i.e., a unix timestamp). Although libraries may implement this type using alternative time representations.

Portable programs should not use values of this type directly, but always rely on calls to elements of the standard library to translate them to portable types.

关于c++ - linux中的time_t类型是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23585495/

相关文章:

c++ - 为什么函数指针定义可以使用任意数量的与号 '&' 或星号 '*' ?

Linux:更新 yaml 文件中的值

python - 为什么 .append() 比在预分配数组中设置值慢?

c++ - XOR 高 32 位与 64 位数字中的低 32 位

c++ - 如何从文本文件中取出每一行并对它们进行平均?

c - 发送源地址为 0.0.0.0 的 UDP 包

c - gcc 的静态编译错误

java - 在时间复杂度很重要的情况下从值数组映射键值

go - GO 时间字符串中的 "m=+"是什么?

c++ - 如何将可变参数参数传递给另一个函数?