什么是最终time_t表示的typedef? [英] What is ultimately a time_t typedef to?

查看:158
本文介绍了什么是最终time_t表示的typedef?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索在Linux操作系统中,看到它是的typedef

I searched in linux box and saw it being typedef to

typedef __time_t time_t;

但找不到__time_t定义。

But could not find the __time_t definition.

推荐答案

维基百科文章,文章揭示了这一些轻。底线是,类型 time_t的在C规格不能保证。

The time_t Wikipedia article article sheds some light on this. The bottom line is that the type of time_t is not guaranteed in the C specification.

time_t的数据类型是一种数据类型
  用于存储定义ISO C库
  系统时间值。这些价值是
  从标准返回时间()
  库函数。这种类型是一个
  的typedef在标准中定义
   头。 ISO C定义
  time_t的作为运算式,但不执行
  未指定任何特定类型

  范围,分辨率,或编码它。
  也未指明是的含义
  算术运算应用到时间
  值。

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和POSIX兼容的系统实施 time_t的键入作为签署
  整数
(通常为32或64位宽)
  这将重新presents的秒数
  自Unix时代的开始

  1970年1月1日午夜UTC(不
  计算闰秒)。有些系统
  正确处理负的时间值,
  而有的则没有。使用系统
  32位 time_t的类型易受
   2038问题。

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.

这篇关于什么是最终time_t表示的typedef?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆