c - time_t 最终的 typedef 是什么?

我搜索了我的 Linux 机器并看到了这个 typedef:

typedef __time_t time_t;

但我找不到 __time_t 定义。

最佳答案

time_t Wikipedia article文章对此有所了解。底线是 time_t 的类型在 C 规范中是没有保证的。

The time_t datatype is a data type in the ISO C library defined for storing system time values. Such values are returned from the standard time() library function. This type is a typedef defined in the standard header. ISO C defines time_t as an arithmetic type, but does not specify any particular type, range, resolution, or encoding for it. Also unspecified are the meanings of arithmetic operations applied to time values.

Unix and POSIX-compliant systems implement the time_t type as a signed integer (typically 32 or 64 bits wide) which represents the number of seconds since the start of the Unix epoch: midnight UTC of January 1, 1970 (not counting leap seconds). Some systems correctly handle negative time values, while others do not. Systems using a 32-bit time_t type are susceptible to the Year 2038 problem.

https://stackoverflow.com/questions/471248/

相关文章:

linux - 如何使用 Bash 脚本自动添加用户帐户和密码?

python - 如何使用子图更改图形大小?

python - 如何让 IntelliJ 识别常见的 Python 模块?

python - 如何动态地将属性添加到类中?

linux - 在 Unix shell 中添加一列数字

linux - 在 Linux 上开始使用 Latex

python - 如何使用python解析包含毫秒的时间字符串?

linux - 如何卸载繁忙的设备

linux - 执行命令而不将其保留在历史记录中

python - 如何 pip 安装具有最小和最大版本范围的软件包?