time_t is signed int/long

时间_t是ISO C标准定义的一种用于存储系统时间的数值类型,通常由time()函数返回。虽然ISO C未指定其具体类型、范围、分辨率或编码,但在Unix和POSIX兼容系统中,它被实现为一个带符号整数(通常是32或64位),表示自1970年1月1日(不包括闰秒)以来的秒数。32位实现可能会遇到2038年问题。在X86_64位Centos7系统中,time_t被typedef为long int。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.

 

 

##  X86_64bit  Centos7 

[lhu3@zch127bld08 source]$ g++ -E  time_t_is_signed.cpp  |  grep __time_t
typedef long int __time_t;
typedef __time_t time_t;
    __time_t tv_sec;
    __time_t tv_sec;
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值