c - time_t 最终的 typedef 是什么?

标签 c linux types

我搜索了我的 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.

关于c - time_t 最终的 typedef 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/471248/

相关文章:

C 获取不同的字符串和整数

c - 快速排序特例 - 似乎是 K&R 的错误算法

objective-c - 使用 native Mac 应用程序在远程 Linux 机器上执行 SSH 命令。 ( Objective-C )

linux - 使用命令行从谷歌下载图像

c# - C# 中的数据类型和结构

c++ - 如何写一个无符号的短整型文字?

c - 是否要求从堆栈分配一个 C 可变长度数组?

c - 程序不会进入for循环

java - 在 Linux 上安装 Java

MySql转换问题: from UNIX_TIMESTAMP to INT(11)