茼蒿不能和什么一起吃| 办理结婚证需要什么材料| 养血清脑颗粒治什么病| 咳嗽变异性哮喘吃什么药| 看输卵管是否堵塞做什么检查| 狗和什么属相相冲| 太学是什么意思| 洗了牙齿要注意什么| 上午十点到十一点是什么时辰| 兰花用什么肥料最好| 血压表什么牌子的好最准确最耐用| 喝栀子茶有什么好处| 淋巴结节吃什么药最好| 肛周湿疹用什么药膏效果好| 脸上浮肿是什么原因导致的| 香蕉对身体有什么好处| 射手座属于什么象星座| 苏东坡属什么生肖| 禅位是什么意思| 火华读什么| 耳后淋巴结肿大挂什么科| 眉毛脱落是什么原因造成的| 精神病吃什么药最好| 什么是性格| 犹豫不决是什么生肖| 白细胞偏低吃什么| 红烧肉配什么菜好吃| 人生导师是什么意思| 意念灰是什么意思| 什么是过敏性紫癜| 奶奶的奶奶叫什么| 腰椎间盘突出不能吃什么食物| 首脑是什么意思| 迎春花什么时候开| eso是什么意思| 全身抽筋吃什么药| 祈祷什么意思| 紫苏叶是什么| 小三阳和大三阳有什么区别| 公婆是什么意思| 醋栗是什么东西| 白噪音什么意思| 云南白药气雾剂保险液有什么作用| 儿童调理脾胃用什么药最好| 什么是海拔| 俄罗斯什么东西值得买| 白细胞偏低吃什么| 咳黄痰吃什么药好得快| 2018属什么生肖| 5月27是什么星座| 我什么都可以| 羊水多是什么原因造成的| 脑供血不足挂什么科| 椒盐是什么| 来月经可以吃什么| 水彩笔用什么能洗掉| 胃溃疡十二指肠溃疡吃什么药| 领导喜欢什么样的员工| 日本是什么时候侵略中国的| 痈是什么意思| 芒果与什么不能一起吃| 鼻子老是出血是什么原因| 五一广场有什么好玩的| 投喂是什么意思| 家庭主妇是什么意思| 阿昔洛韦片是什么药| 果实是什么意思| 什么米最贵| 超敏c反应蛋白是什么| 直肠炎用什么药效果最好| 红薯和什么不能一起吃| 南宁晚上有什么好玩的地方| 杰瑞是什么品种的老鼠| 突然头晕想吐是什么原因| 血吸虫是什么动物| lala是什么意思| 活性炭是什么| 右侧胸膜增厚是什么意思| 什么什么的草地| 空调管滴水是什么原因| 屁股上长痘痘是什么情况| 人授和试管有什么区别| hbalc是什么意思| 硒片不适合什么人吃| 吃鱼眼睛有什么好处| 缢死是什么意思| 越狱男主角叫什么| 嘴唇上有痣代表什么| 卟啉病是什么病| 道什么意思| 肝火旺喝什么茶| amh是什么| 总爱放屁是什么原因| 藕不能和什么一起吃| 开封有什么好玩的地方| 农历六月十二是什么日子| lycra是什么面料| 川芎有什么功效与作用| 山川载不动太多悲哀是什么歌| 什么人容易得肾结石| 申字五行属什么| 考研是什么时候考| 查电话号码打什么电话| 权衡利弊是什么意思| 中国精神是什么| 钾离子低的原因是什么| 银装素裹什么意思| 肚脐下四指是什么位置| 麻风病是什么| 支气管扩张什么症状| 念珠菌吃什么药最好| 久视伤血是什么意思| 加号是什么意思| 补脾吃什么食物最好| 亲故是什么意思| 生意盎然什么意思| 砂锅是什么材料做的| 起床气是什么意思| 物质是由什么组成的| 什么的小船| 宫颈炎有什么症状| 韩国买什么东西划算| 清明节是什么时候| 1989年五行属什么| 15岁属什么| 宝宝睡眠不好是什么原因| 头不由自主的摇晃是什么病| 吃什么下奶最快最多最有效| 猫是什么生肖| 五月三十一号是什么星座| 嗓子疼低烧吃什么药| 离婚需要什么资料| 餐后胆囊是什么意思| 腿容易麻是什么原因| 身上起红疙瘩是什么原因| 牙齿发麻是什么原因| 什么是绿色食品| 大姨妈量少是什么原因| 2月18号是什么星座| 嗓子疼喝什么| 1月23号什么星座| 桑葚有什么功效和作用| 什么情况不能献血| 为什么要闰月| 小肚子痛吃什么药| 莞字五行属什么| 百合花代表什么| 血沉是查什么病的| 咳嗽想吐是什么原因| 獐是什么动物| 打开心扉是什么意思| 糖耐是检查什么| 减肥吃什么药瘦得快| 八月八日是什么星座| 甲状腺炎有什么症状| 国老是什么中药| 头发晕是什么病的征兆| 宫颈囊肿多发是什么意思| 化痰祛痰吃什么药| 开五行属性是什么| 地奥司明片治疗什么病| 血小板分布宽度偏高是什么意思| 蚊子喜欢什么血型的人| 一什么牛| 报工伤需要什么材料| 农历八月初五是什么星座| 妇科炎症用什么药| 万宝龙属于什么档次| 血糖低是什么原因| 车厘子是什么季节的| 什么食物降胆固醇最好| 身上长白点是什么原因| 手红是什么原因| 慈禧为什么要毒死光绪| 哈乐是什么药| 贫血严重会导致什么后果| 道家思想的核心是什么| 力排众议是什么意思| 益生菌什么时间吃最好| 口比念什么| 什么叫脂溢性脱发| ct是什么单位| 梦见被子是什么意思| 鱼跃龙门是什么意思| 前列腺特异性抗原是什么意思| 副歌部分是什么意思| rpr是什么检查项目| 甲木命是什么意思| 一个三点水一个除念什么| 姜粉什么时候喝最好| 阴道炎用什么洗液| 助听器什么牌子好| 抓手是什么意思| 早上喝豆浆有什么好处| 甘草片不能和什么药一起吃| 前夫是什么意思| 鸡眼膏为什么越贴越疼| 龙虾的血是什么颜色的| 月经什么颜色的血是正常的| b型和ab型生的孩子是什么血型| 常吃山药有什么好处和坏处| 子宫肌瘤吃什么中药可以消除掉| 令人发指是什么意思| charcoal是什么颜色| cy什么意思| 冰箱发烫是什么原因| 乌鸡不能和什么一起吃| 海纳百川是什么意思| 桃李满天下是什么生肖| 指甲盖凹陷是什么原因| 肺结节吃什么中药| 自信过头叫什么| 讳莫如深是什么意思| 睾丸癌是由什么引起的| 翳是什么意思| 尿葡萄糖是什么意思| 为什么会水肿| 抗体高是什么意思| 苯酚是什么| 羽毛球拍磅数是什么意思| 去医院检查是否怀孕挂什么科| 看诊是什么意思| 小孩子包皮挂什么科| 咖啡伴侣是什么| 腿疼挂什么科| 酸菜鱼放什么配菜好吃| 检查痛风挂什么科| tac是什么| 岁月从不败美人什么意思| 刘亦菲原名叫什么| 梦见输钱是什么预兆| 喉炎吃什么药最有效| 什么茶适合煮着喝| 猿人头是什么牌子| 10月30日是什么星座| 77年的蛇是什么命| 创伤急救的原则是什么| 螳螂捕蝉黄雀在后是什么生肖| 变异性哮喘咳嗽吃什么药| 右侧上颌窦粘膜增厚是什么意思| 无所适从什么意思| 气管炎咳嗽吃什么药最有效| 英红九号是什么茶| 什么纸贵| 胃烧心是什么症状| 神经递质是什么| 肛瘘是什么原因引起的| 口粮是什么意思| 青光眼是什么意思| 脱发缺少什么维生素| 吴承恩是什么朝代的| 高密度脂蛋白胆固醇低是什么意思| 年金是什么意思| 杨梅有什么功效和作用| 老鳖吃什么| 间接胆红素偏高是什么原因| 孕妇羊水少吃什么补的快| 今年夏天为什么这么热| 大仙为什么知道你的事| 胃胆汁反流是什么原因引起的| 什么时候锻炼身体最佳时间| 燕窝什么时候吃好| 怀孕有什么表现| 毛峰茶属于什么茶| 百度Jump to content

智能制造势头良好仍需“闯关”

From Wikipedia, the free encyclopedia
百度 2017年2月27日,42岁的黑龙江义工孙万春给父亲和女儿写了一封长信,解释他卖掉房产捐助病危儿童的决定,希望得到两人的原谅和理解,信中称希望你们能怀着平静、喜悦、欣慰,甚至骄傲的心情去读。

Unix time passed 1000000000 seconds on 2025-08-08T01:46:40Z.[1] It was celebrated in Copenhagen, Denmark, at a party held by the Danish UNIX User Group at 03:46:40 local time.

Unix time[a] is a date and time representation widely used in computing. It measures time by the number of non-leap seconds that have elapsed since 00:00:00 UTC on 1 January 1970, the Unix epoch. For example, at midnight on 1 January 2010, Unix time was 1262304000.

Unix time originated as the system time of Unix operating systems. It has come to be widely used in other computer operating systems, file systems, programming languages, and databases. In modern computing, values are sometimes stored with higher granularity, such as microseconds or nanoseconds.

Definition

[edit]

Unix time is currently defined as the number of non-leap seconds which have passed since 00:00:00 UTC on Thursday, 1 January 1970, which is referred to as the Unix epoch.[3] Unix time is typically encoded as a signed integer.

The Unix time 0 is exactly midnight UTC on 1 January 1970, with Unix time incrementing by 1 for every non-leap second after this. For example, 00:00:00 UTC on 1 January 1971 is represented in Unix time as 31536000. Negative values, on systems that support them, indicate times before the Unix epoch, with the value decreasing by 1 for every non-leap second before the epoch. For example, 00:00:00 UTC on 1 January 1969 is represented in Unix time as ?31536000. Every day in Unix time consists of exactly 86400 seconds.

Unix time is sometimes referred to as Epoch time. This can be misleading since Unix time is not the only time system based on an epoch and the Unix epoch is not the only epoch used by other time systems.[5]

Leap seconds

[edit]

Unix time differs from both Coordinated Universal Time (UTC) and International Atomic Time (TAI) in its handling of leap seconds. UTC includes leap seconds that adjust for the discrepancy between precise time, as measured by atomic clocks, and solar time, relating to the position of the earth in relation to the sun. International Atomic Time (TAI), in which every day is precisely 86400 seconds long, ignores solar time and gradually loses synchronization with the Earth's rotation at a rate of roughly one second per year. In Unix time, every day contains exactly 86400 seconds. Each leap second uses the timestamp of a second that immediately precedes or follows it.[3]

On a normal UTC day, which has a duration of 86400 seconds, the Unix time number changes in a continuous manner across midnight. For example, at the end of the day used in the examples above, the time representations progress as follows:

Unix time across midnight into 17 September 2004 (without leap seconds)
TAI (17 September 2004) UTC (16 to 17 September 2004) Unix time
2025-08-08T00:00:30.75 2025-08-08T23:59:58.75 1095379198.75
2025-08-08T00:00:31.00 2025-08-08T23:59:59.00 1095379199.00
2025-08-08T00:00:31.25 2025-08-08T23:59:59.25 1095379199.25
2025-08-08T00:00:31.50 2025-08-08T23:59:59.50 1095379199.50
2025-08-08T00:00:31.75 2025-08-08T23:59:59.75 1095379199.75
2025-08-08T00:00:32.00 2025-08-08T00:00:00.00 1095379200.00
2025-08-08T00:00:32.25 2025-08-08T00:00:00.25 1095379200.25
2025-08-08T00:00:32.50 2025-08-08T00:00:00.50 1095379200.50
2025-08-08T00:00:32.75 2025-08-08T00:00:00.75 1095379200.75
2025-08-08T00:00:33.00 2025-08-08T00:00:01.00 1095379201.00
2025-08-08T00:00:33.25 2025-08-08T00:00:01.25 1095379201.25

When a leap second occurs, the UTC day is not exactly 86400 seconds long and the Unix time number (which always increases by exactly 86400 each day) experiences a discontinuity. Leap seconds may be positive or negative. No negative leap second has ever been declared, but if one were to be, then at the end of a day with a negative leap second, the Unix time number would jump up by 1 to the start of the next day. During a positive leap second at the end of a day, which occurs about every year and a half on average, the Unix time number increases continuously into the next day during the leap second and then at the end of the leap second jumps back by 1 (returning to the start of the next day). For example, this is what happened on strictly conforming POSIX.1 systems at the end of 1998:

Unix time across midnight into 1 January 1999 (positive leap second)
TAI (1 January 1999) UTC (31 December 1998 to 1 January 1999) Unix time
2025-08-08T00:00:29.75 2025-08-08T23:59:58.75 915148798.75
2025-08-08T00:00:30.00 2025-08-08T23:59:59.00 915148799.00
2025-08-08T00:00:30.25 2025-08-08T23:59:59.25 915148799.25
2025-08-08T00:00:30.50 2025-08-08T23:59:59.50 915148799.50
2025-08-08T00:00:30.75 2025-08-08T23:59:59.75 915148799.75
2025-08-08T00:00:31.00 2025-08-08T23:59:60.00 915148800.00
2025-08-08T00:00:31.25 2025-08-08T23:59:60.25 915148800.25
2025-08-08T00:00:31.50 2025-08-08T23:59:60.50 915148800.50
2025-08-08T00:00:31.75 2025-08-08T23:59:60.75 915148800.75
2025-08-08T00:00:32.00 2025-08-08T00:00:00.00 915148800.00
2025-08-08T00:00:32.25 2025-08-08T00:00:00.25 915148800.25
2025-08-08T00:00:32.50 2025-08-08T00:00:00.50 915148800.50
2025-08-08T00:00:32.75 2025-08-08T00:00:00.75 915148800.75
2025-08-08T00:00:33.00 2025-08-08T00:00:01.00 915148801.00
2025-08-08T00:00:33.25 2025-08-08T00:00:01.25 915148801.25

Unix time numbers are repeated in the second immediately following a positive leap second. The Unix time number 1483228800 is thus ambiguous: it can refer either to start of the leap second (2025-08-08 23:59:60) or the end of it, one second later (2025-08-08 00:00:00). In the theoretical case when a negative leap second occurs, no ambiguity is caused, but instead there is a range of Unix time numbers that do not refer to any point in UTC time at all.

A Unix clock is often implemented with a different type of positive leap second handling associated with the Network Time Protocol (NTP). This yields a system that does not conform to the POSIX standard. See the section below concerning NTP for details.

When dealing with periods that do not encompass a UTC leap second, the difference between two Unix time numbers is equal to the duration in seconds of the period between the corresponding points in time. This is a common computational technique. However, where leap seconds occur, such calculations give the wrong answer. In applications where this level of accuracy is required, it is necessary to consult a table of leap seconds when dealing with Unix times, and it is often preferable to use a different time encoding that does not suffer from this problem.

A Unix time number is easily converted back into a UTC time by taking the quotient and modulus of the Unix time number, modulo 86400. The quotient is the number of days since the epoch, and the modulus is the number of seconds since midnight UTC on that day. If given a Unix time number that is ambiguous due to a positive leap second, this algorithm interprets it as the time just after midnight. It never generates a time that is during a leap second. If given a Unix time number that is invalid due to a negative leap second, it generates an equally invalid UTC time. If these conditions are significant, it is necessary to consult a table of leap seconds to detect them.

Non-synchronous Network Time Protocol-based variant

[edit]

Commonly a Mills-style Unix clock is implemented with leap second handling not synchronous with the change of the Unix time number. The time number initially decreases where a leap should have occurred, and then it leaps to the correct time 1 second after the leap. This makes implementation easier, and is described by Mills' paper.[6] This is what happens across a positive leap second:

Non-synchronous Mills-style Unix clock
across midnight into 1 January 1999 (positive leap second)
TAI (1 January 1999) UTC (31 December 1998 to 1 January 1999) State Unix clock
2025-08-08T00:00:29.75 2025-08-08T23:59:58.75 TIME_INS 915148798.75
2025-08-08T00:00:30.00 2025-08-08T23:59:59.00 TIME_INS 915148799.00
2025-08-08T00:00:30.25 2025-08-08T23:59:59.25 TIME_INS 915148799.25
2025-08-08T00:00:30.50 2025-08-08T23:59:59.50 TIME_INS 915148799.50
2025-08-08T00:00:30.75 2025-08-08T23:59:59.75 TIME_INS 915148799.75
2025-08-08T00:00:31.00 2025-08-08T23:59:60.00 TIME_INS 915148800.00
2025-08-08T00:00:31.25 2025-08-08T23:59:60.25 TIME_OOP 915148799.25
2025-08-08T00:00:31.50 2025-08-08T23:59:60.50 TIME_OOP 915148799.50
2025-08-08T00:00:31.75 2025-08-08T23:59:60.75 TIME_OOP 915148799.75
2025-08-08T00:00:32.00 2025-08-08T00:00:00.00 TIME_OOP 915148800.00
2025-08-08T00:00:32.25 2025-08-08T00:00:00.25 TIME_WAIT 915148800.25
2025-08-08T00:00:32.50 2025-08-08T00:00:00.50 TIME_WAIT 915148800.50
2025-08-08T00:00:32.75 2025-08-08T00:00:00.75 TIME_WAIT 915148800.75
2025-08-08T00:00:33.00 2025-08-08T00:00:01.00 TIME_WAIT 915148801.00
2025-08-08T00:00:33.25 2025-08-08T00:00:01.25 TIME_WAIT 915148801.25

This can be decoded properly by paying attention to the leap second state variable, which unambiguously indicates whether the leap has been performed yet. The state variable change is synchronous with the leap.

A similar situation arises with a negative leap second, where the second that is skipped is slightly too late. Very briefly the system shows a nominally impossible time number, but this can be detected by the TIME_DEL state and corrected.

In this type of system the Unix time number violates POSIX around both types of leap second. Collecting the leap second state variable along with the time number allows for unambiguous decoding, so the correct POSIX time number can be generated if desired, or the full UTC time can be stored in a more suitable format.

The decoding logic required to cope with this style of Unix clock would also correctly decode a hypothetical POSIX-conforming clock using the same interface. This would be achieved by indicating the TIME_INS state during the entirety of an inserted leap second, then indicating TIME_WAIT during the entirety of the following second while repeating the seconds count. This requires synchronous leap second handling. This is probably the best way to express UTC time in Unix clock form, via a Unix interface, when the underlying clock is fundamentally untroubled by leap seconds.

Variant that counts leap seconds

[edit]

Another, much rarer, non-conforming variant of Unix time keeping involves incrementing the value for all seconds, including leap seconds;[7] some Linux systems are configured this way.[8] Time kept in this fashion is sometimes referred to as "TAI" (although timestamps can be converted to UTC if the value corresponds to a time when the difference between TAI and UTC is known), as opposed to "UTC" (although not all UTC time values have a unique reference in systems that do not count leap seconds).[8]

Because TAI has no leap seconds, and every TAI day is exactly 86400 seconds long, this encoding is actually a pure linear count of seconds elapsed since 2025-08-08T00:00:10 TAI. This makes time interval arithmetic much easier. Time values from these systems do not suffer the ambiguity that strictly conforming POSIX systems or NTP-driven systems have.

In these systems it is necessary to consult a table of leap seconds to correctly convert between UTC and the pseudo-Unix-time representation. This resembles the manner in which time zone tables must be consulted to convert to and from civil time; the IANA time zone database includes leap second information, and the sample code available from the same source uses that information to convert between TAI-based timestamps and local time. Conversion also runs into definitional problems prior to the 1972 commencement of the current form of UTC (see section UTC basis below).

This system, despite its superficial resemblance, is not Unix time. It encodes times with values that differ by several seconds from the POSIX time values. A version of this system, in which the epoch was 2025-08-08T00:00:00 TAI rather than 2025-08-08T00:00:10 TAI, was proposed for inclusion in ISO C's time.h, but only the UTC part was accepted in 2011.[9] A tai_clock does, however, exist in C++20.

Representing the number

[edit]

A Unix time number can be represented in any form capable of representing numbers. In some applications the number is simply represented textually as a string of decimal digits, raising only trivial additional problems. However, certain binary representations of Unix times are particularly significant.

The Unix time_t data type that represents a point in time is, on many platforms, a signed integer, traditionally of 32 bits (but see below), directly encoding the Unix time number as described in the preceding section. A signed 32-bit value covers about 68 years before and after the 2025-08-08 epoch. The minimum representable date is Friday 2025-08-08, and the maximum representable date is Tuesday 2025-08-08. One second after 2025-08-08T03:14:07Z this representation will overflow in what is known as the year 2038 problem.

UUIDv7 encodes the Unix epoch timestamp (in milliseconds) in an unsigned 48-bit field. This representation is valid until the year 10889 AD.[10]

In some newer operating systems, time_t has been widened to 64 bits. This expands the times representable to about 292.3 billion years in both directions, which is over twenty times the present age of the universe.

There was originally some controversy over whether the Unix time_t should be signed or unsigned. If unsigned, its range in the future would be doubled, postponing the 32-bit overflow (by 68 years). However, it would then be incapable of representing times prior to the epoch. The consensus is for time_t to be signed, and this is the usual practice. The software development platform for version 6 of the QNX operating system has an unsigned 32-bit time_t, though older releases used a signed type.

The POSIX and Open Group Unix specifications include the C standard library, which includes the time types and functions defined in the <time.h> header file. The ISO C standard states that time_t must be an arithmetic type, but does not mandate any specific type or encoding for it. POSIX requires time_t to be an integer type, but does not mandate that it be signed or unsigned.

Unix has no tradition of directly representing non-integer Unix time numbers as binary fractions. Instead, times with sub-second precision are represented using composite data types that consist of two integers, the first being a time_t (the integral part of the Unix time), and the second being the fractional part of the time number in millionths (in struct timeval) or billionths (in struct timespec).[11][12] These structures provide a decimal-based fixed-point data format, which is useful for some applications, and trivial to convert for others.

UTC basis

[edit]

The present form of UTC, with leap seconds, is defined only starting from 1 January 1972. Prior to that, since 1 January 1961 there was an older form of UTC in which not only were there occasional time steps, which were by non-integer numbers of seconds, but also the UTC second was slightly longer than the SI second, and periodically changed to continuously approximate the Earth's rotation. Prior to 1961 there was no UTC, and prior to 1958 there was no widespread atomic timekeeping; in these eras, some approximation of GMT (based directly on the Earth's rotation) was used instead of an atomic timescale.[citation needed]

The precise definition of Unix time as an encoding of UTC is only uncontroversial when applied to the present form of UTC. The Unix epoch predating the start of this form of UTC does not affect its use in this era: the number of days from 1 January 1970 (the Unix epoch) to 1 January 1972 (the start of UTC) is not in question, and the number of days is all that is significant to Unix time.

The meaning of Unix time values below +63072000 (i.e., prior to 1 January 1972) is not precisely defined. The basis of such Unix times is best understood to be an unspecified approximation of UTC. Computers of that era rarely had clocks set sufficiently accurately to provide meaningful sub-second timestamps in any case. Unix time is not a suitable way to represent times prior to 1972 in applications requiring sub-second precision; such applications must, at least, define which form of UT or GMT they use.

As of 2009, the possibility of ending the use of leap seconds in civil time is being considered.[13] A likely means to execute this change is to define a new time scale, called International Time[citation needed], that initially matches UTC but thereafter has no leap seconds, thus remaining at a constant offset from TAI. If this happens, it is likely that Unix time will be prospectively defined in terms of this new time scale, instead of UTC. Uncertainty about whether this will occur makes prospective Unix time no less predictable than it already is: if UTC were simply to have no further leap seconds the result would be the same.

History

[edit]

The earliest versions of Unix time had a 32-bit integer incrementing at a rate of 60 Hz, which was the rate of the system clock on the hardware of the early Unix systems. Timestamps stored this way could only represent a range of a little over two and a quarter years. The epoch being counted from was changed with Unix releases to prevent overflow, with midnight on 1 January 1971 and 1 January 1972 both being used as epochs during Unix's early development. Early definitions of Unix time also lacked timezones.[14][15]

The current epoch of 1 January 1970 00:00:00 UTC was selected arbitrarily by Unix engineers because it was considered a convenient date to work with. The precision was changed to count in seconds in order to avoid short-term overflow.[1]

When POSIX.1 was written, the question arose of how to precisely define time_t in the face of leap seconds. The POSIX committee considered whether Unix time should remain, as intended, a linear count of seconds since the epoch, at the expense of complexity in conversions with civil time or a representation of civil time, at the expense of inconsistency around leap seconds. Computer clocks of the era were not sufficiently precisely set to form a precedent one way or the other.

The POSIX committee was swayed by arguments against complexity in the library functions,[16] and firmly defined the Unix time in a simple manner in terms of the elements of UTC time. This definition was so simple that it did not even encompass the entire leap year rule of the Gregorian calendar, and would make 2100 a leap year.

The 2001 edition of POSIX.1 rectified the faulty leap year rule in the definition of Unix time, but retained the essential definition of Unix time as an encoding of UTC rather than a linear time scale. Since the mid-1990s, computer clocks have been routinely set with sufficient precision for this to matter, and they have most commonly been set using the UTC-based definition of Unix time. This has resulted in considerable complexity in Unix implementations, and in the Network Time Protocol, to execute steps in the Unix time number whenever leap seconds occur.[citation needed]

Usage

[edit]

Unix time is widely adopted in computing beyond its original application as the system time for Unix. Unix time is available in almost all system programming APIs, including those provided by both Unix-based and non-Unix operating systems. Almost all modern programming languages provide APIs for working with Unix time or converting them to another data structure. Unix time is also used as a mechanism for storing timestamps in a number of file systems, file formats, and databases.

The C standard library uses Unix time for all date and time functions, and Unix time is sometimes referred to as time_t, the name of the data type used for timestamps in C and C++. C's Unix time functions are defined as the system time API in the POSIX specification.[17] The C standard library is used extensively in all modern desktop operating systems, including Microsoft Windows and Unix-like systems such as macOS and Linux, where it is a standard programming interface.[18][19][20]

iOS provides a Swift API which defaults to using an epoch of 1 January 2001 but can also be used with Unix timestamps.[21] Android uses Unix time alongside a timezone for its system time API.[22]

Windows does not use Unix time for storing time internally but does use it in system APIs, which are provided in C++ and implement the C standard library specification.[18] Unix time is used in the PE format for Windows executables.[23]

Unix time is typically available in major programming languages and is widely used in desktop, mobile, and web application programming. Java provides an Instant object which holds a Unix timestamp in both seconds and nanoseconds.[24] Python provides a time library which uses Unix time.[25] JavaScript provides a Date library which provides and stores timestamps in milliseconds since the Unix epoch and is implemented in all modern desktop and mobile web browsers as well as in JavaScript server environments like Node.js.[26]

Free Pascal implements UNIX time with the GetTickCount (deprecated unsigned 32 bit) and GetTickCount64 (Unsigned 64 bit) functions to a resolution of 1ms on Unix-like platforms.

Filesystems designed for use with Unix-based operating systems tend to use Unix time. APFS, the file system used by default across all Apple devices, and ext4, which is widely used on Linux and Android devices, both use Unix time in nanoseconds for file timestamps.[27][28] Several archive file formats can store timestamps in Unix time, including RAR and tar.[29][30] Unix time is also commonly used to store timestamps in databases, including in MySQL and PostgreSQL.[31][32]

Limitations

[edit]

Unix time was designed to encode calendar dates and times in a compact manner intended for use by computers internally. It is not intended to be easily read by humans or to store timezone-dependent values. It is also limited by default to representing time in seconds, making it unsuited for use when a more precise measurement of time is needed, such as when measuring the execution time of programs.[33]

Range of representable times

[edit]
An animated visual of the 32-bit Unix time overflow which will occur in 2038

Unix time by design does not require a specific size for the storage, but most common implementations of Unix time use a signed integer with the same size as the word size of the underlying hardware. As the majority of modern computers are 32-bit or 64-bit, and a large number of programs are still written in 32-bit compatibility mode, this means that many programs using Unix time are using signed 32-bit integer fields. The maximum value of a signed 32-bit integer is 231 ? 1, and the minimum value is ?231, making it impossible to represent dates before 13 December 1901 (at 20:45:52 UTC) or after 19 January 2038 (at 03:14:07 UTC). The early cutoff can have an impact on databases that are storing historical information; in some databases where 32-bit Unix time is used for timestamps, it may be necessary to store time in a different form of field, such as a string, to represent dates before 1901. The late cutoff is known as the Year 2038 problem and has the potential to cause issues as the date approaches, as dates beyond the 2038 cutoff would wrap back around to the start of the representable range in 1901.[33]:?60?[34]

Date range cutoffs are not an issue with 64-bit representations of Unix time, as the effective range of dates representable with Unix time stored in a signed 64-bit integer is over 584 billion years, or 292 billion years in either direction of the 1970 epoch.[33]:?60-61?[35]

Alternatives

[edit]

Unix time is not the only standard for time that counts away from an epoch. On Windows, the FILETIME type stores time as a count of 100-nanosecond intervals that have elapsed since 0:00 GMT on 1 January 1601.[36] Windows epoch time is used to store timestamps for files[37] and in protocols such as the Active Directory Time Service[38] and Server Message Block.

The Network Time Protocol used to coordinate time between computers uses an epoch of 1 January 1900, counted in an unsigned 32-bit integer for seconds and another unsigned 32-bit integer for fractional seconds, which rolls over every 232 seconds (about once every 136 years).[39]

Many applications and programming languages provide methods for storing time with an explicit timezone.[40] There are also a number of time format standards which exist to be readable by both humans and computers, such as ISO 8601.

Notable events in Unix time

[edit]

Unix enthusiasts have a history of holding "time_t parties" (pronounced "time tea parties") to celebrate significant values of the Unix time number.[41][42] These are directly analogous to the new year celebrations that occur at the change of year in many calendars. As the use of Unix time has spread, so has the practice of celebrating its milestones. Usually it is time values that are round numbers in decimal that are celebrated, following the Unix convention of viewing time_t values in decimal. Among some groups round binary numbers are also celebrated,[citation needed] such as +230, which occurred at 13:37:04 UTC on Saturday, 10 January 2004.

The events that these celebrate are typically described as "N seconds since the Unix epoch", but this is inaccurate; as discussed above, due to the handling of leap seconds in Unix time the number of seconds elapsed since the Unix epoch is slightly greater than the Unix time number for times later than the epoch.

  • At 18:36:57 UTC on Wednesday, 17 October 1973, the first appearance of the date in ISO 8601 format[b] (2025-08-08) within the digits of Unix time (119731017) took place.[43]
  • At 01:46:40 UTC on Sunday, 9 September 2001, the Unix billennium (Unix time number 1000000000) was celebrated.[44] The name billennium is a portmanteau of billion and millennium.[45][46] Some programs which stored timestamps using a text representation encountered sorting errors, as in a text sort, times after the turnover starting with a 1 digit erroneously sorted before earlier times starting with a 9 digit. Affected programs included the popular Usenet reader KNode and e-mail client KMail, part of the KDE desktop environment. Such bugs were generally cosmetic in nature and quickly fixed once problems became apparent.[citation needed] The problem also affected many Filtrix document-format filters provided with Linux versions of WordPerfect; a patch was created by the user community to solve this problem, since Corel no longer sold or supported that version of the program.[47]
  • At 23:31:30 UTC on Friday, 13 February 2009, the decimal representation of Unix time reached 1234567890 seconds.[48] Google celebrated this with a Google Doodle.[49] Parties and other celebrations were held around the world, among various technical subcultures, to celebrate the 1234567890th second.[41][50]
[edit]

Vernor Vinge's novel A Deepness in the Sky describes a spacefaring trading civilization thousands of years in the future that still uses the Unix epoch. The "programmer-archaeologist" responsible for finding and maintaining usable code in mature computer systems first believes that the epoch refers to the time when man first walked on the Moon, but then realizes that it is "the 0-second of one of humankind's first computer operating systems".[51]

See also

[edit]

Notes

[edit]
  1. ^ Unix time is also known as "Epoch time", "POSIX time",[2] "seconds since the Epoch",[3] "Unix timestamp" or "UNIX Epoch time".[4]
  2. ^ cited retroactively since ISO 8601 was published in 1988.

References

[edit]
  1. ^ a b Farhad, Manjoo (8 September 2001). "Unix Tick Tocks to a Billion". Wired. ISSN 1059-1028. Archived from the original on 11 September 2022. Retrieved 16 October 2022.
  2. ^ "The Open Group Base Specifications Issue 7, Rationale: Base Definitions, section A.4 General Concepts". The Open Group. Archived from the original on 15 November 2017. Retrieved 9 September 2019.
  3. ^ a b c "The Open Group Base Specifications Issue 7, section 4.16 Seconds Since the Epoch". The Open Group. Archived from the original on 22 December 2017. Retrieved 22 January 2017.
  4. ^ Matthew, Neil; Stones, Richard (2008). "The Linux Environment". Beginning Linux Programming. Indianapolis, Indiana, US: Wiley. p. 148. ISBN 978-0-470-14762-7.
  5. ^ "FILETIME structure (minwinbase.h)". Microsoft Docs. 2 April 2021.
  6. ^ Mills, David L. (12 May 2012). "The NTP Timescale and Leap Seconds". eecis.udel.edu. Archived from the original on 15 May 2012. Retrieved 21 August 2017.
  7. ^ "Precision timekeeping". Sources for time zone and daylight saving time data. Archived from the original on 16 October 2017. Retrieved 30 May 2022. The tz code and data support leap seconds via an optional "right" configuration where a computer's internal time_t integer clock counts every TAI second, as opposed to the default "posix" configuration where the internal clock ignores leap seconds. The two configurations agree for timestamps starting with 2025-08-08 00:00:00 UTC (time_t 63?072?000) and diverge for timestamps starting with time_t 78?796?800, which corresponds to the first leap second 2025-08-08 23:59:60 UTC in the "right" configuration, and to 2025-08-08 00:00:00 UTC in the "posix" configuration.
  8. ^ a b "Time Scales". Network Time Protocol Wiki. 24 July 2019. Archived from the original on 12 January 2020. Retrieved 12 January 2020.
  9. ^ Markus Kuhn. "Modernized API for ISO C". www.cl.cam.ac.uk. Archived from the original on 26 September 2020. Retrieved 31 August 2020.
  10. ^ RFC 9562
  11. ^ "timespec". NetBSD Manual Pages. 12 April 2011. Archived from the original on 10 August 2019. Retrieved 5 July 2019.
  12. ^ "time.h(0P)". Linux manual page. Archived from the original on 27 June 2019. Retrieved 5 July 2019.
  13. ^ McCarthy, D. D.; Seidelmann, P. K. (2009). TIME—From Earth Rotation to Atomic Physics. Weinheim: Wiley–VCH Verlag GmbH & Co. KGaA. p. 232. ISBN 978-3-527-40780-4.
  14. ^ Unix Programmer's Manual (PDF) (1st ed.). 3 November 1971. Archived (PDF) from the original on 5 March 2022. Retrieved 28 March 2012. time returns the time since 00:00:00, Jan. 1, 1971, measured in sixtieths of a second.
  15. ^ Unix Programmer's Manual (PDF) (3rd ed.). 15 March 1972. Archived (PDF) from the original on 12 February 2023. Retrieved 11 February 2023. time returns the time since 00:00:00, Jan. 1, 1972, measured in sixtieths of a second...The time is stored in 32 bits. This guarantees a crisis every 2.26 years.
  16. ^ "Posix Has Become Outdated (2016) [pdf] | Hacker News". news.ycombinator.com. Archived from the original on 18 March 2025. Retrieved 23 July 2025.
  17. ^ "The Open Group Technical Standard Base Specifications Issue 7 (2018 edition)". IEEE and The Open Group. Archived from the original on 1 May 2023. Retrieved 1 May 2023.
  18. ^ a b "time, _time32, _time64". learn.microsoft.net. Microsoft Corporation. 13 February 2023. Archived from the original on 1 May 2023. Retrieved 1 May 2023.
  19. ^ "The GNU C Library (glibc)". The GNU Operating Sisyem. Free Software Foundation. Archived from the original on 22 April 2016. Retrieved 1 May 2023. The GNU C Library project provides the core libraries for the GNU system and GNU/Linux systems, as well as many other systems that use Linux as the kernel.
  20. ^ "Mac OS X Manual Page for localtime(3)". Apple Documentation Archive. Apple Inc. Archived from the original on 22 July 2022. Retrieved 1 May 2023.
  21. ^ "NSDate". Apple Developer Documentation. Apple Inc. Archived from the original on 1 May 2023. Retrieved 1 May 2023.
  22. ^ "Time Overview". Android Open Source Project. Google LLC. Archived from the original on 1 May 2023. Retrieved 1 May 2023.
  23. ^ "PE Format - Win32 apps". learn.microsoft.com. Microsoft Corporation. 24 March 2023. Archived from the original on 29 April 2023. Retrieved 1 May 2023.
  24. ^ "Instant (Java Platform SE 8 )". docs.oracle.com. Oracle. Archived from the original on 25 November 2016. Retrieved 1 May 2023.
  25. ^ "time — Time access and conversions", Python documentation, archived from the original on 22 July 2022, retrieved 25 July 2022
  26. ^ "Date - JavaScript | MDN". developer.mozilla.org. Mozilla. Archived from the original on 21 July 2021. Retrieved 1 May 2023.
  27. ^ Apple File System Reference (PDF), p. 57, archived (PDF) from the original on 5 November 2022, retrieved 19 October 2022, This timestamp is represented as the number of nanoseconds since January 1, 1970 at 0:00 UTC, disregarding leap seconds
  28. ^ "Data Structures and Algorithms". The Linux Kernel documentation. Linux Kernel Organization, Inc. Archived from the original on 1 May 2023. Retrieved 1 May 2023.
  29. ^ "RAR 5.0 archive format". www.rarlab.com. win.rar GmbH. Archived from the original on 1 May 2023. Retrieved 1 May 2023. Time is stored in Unix time_t format if this flags [sic] is set and in Windows FILETIME format otherwise
  30. ^ "Tape Archive (tar) File Format Family". www.loc.gov. Library of Congress. 7 January 2021. Archived from the original on 1 May 2023. Retrieved 1 May 2023.
  31. ^ "Date and Time Functions", MySQL 8.0 Reference Manual, archived from the original on 19 October 2022, retrieved 19 October 2022
  32. ^ "8.5. Date/Time Types". PostgreSQL Documentation. The PostgreSQL Global Development Group. 9 February 2023. Archived from the original on 1 May 2023. Retrieved 1 May 2023.
  33. ^ a b c Rochkind, Mark (2004). Advanced UNIX Programing (2nd ed.). Addison-Wesley. pp. 56–63. ISBN 978-0-13-141154-8.
  34. ^ "What is the Year 2038 problem?". HowStuffWorks. 1 April 2000. Retrieved 23 July 2025.
  35. ^ Saxena, Ashutosh; Rawat, Sanjay. "IDRBT Working Paper No. 9" (PDF). Archived from the original (PDF) on 13 May 2012.
  36. ^ "FILETIME (minwinbase.h) - Win32 apps". Microsoft Learn. Microsoft. 2 April 2021. Archived from the original on 10 March 2023. Retrieved 9 March 2023.
  37. ^ "File Times - Win32 apps". Microsoft Learn. Microsoft. 7 January 2021. Archived from the original on 8 March 2023. Retrieved 9 March 2023.
  38. ^ "How to convert date/time attributes in Active Directory to standard time format". Microsoft Learn. Microsoft. Archived from the original on 20 October 2022. Retrieved 20 October 2022.
  39. ^ W. Richard Stevens; Bill Fenner; Andrew M. Rudoff (2004). UNIX Network Programming. Addison-Wesley Professional. pp. 582–. ISBN 978-0-13-141155-5. Archived from the original on 30 March 2019. Retrieved 16 October 2016.
  40. ^ "datetime — Basic date and time types". Python Standard Library Reference. Python Software Foundation. Archived from the original on 19 October 2022. Retrieved 20 October 2022. Attributes: year, month, day, hour, minute, second, microsecond, and tzinfo.
  41. ^ a b Tweney, Dylan (12 February 2009). "Unix Lovers to Party Like It's 1234567890". Wired. Archived from the original on 29 March 2014. Retrieved 12 March 2017.
  42. ^ "Slashdot | date +%s Turning 1111111111". 17 March 2005. Archived from the original on 12 January 2020. Retrieved 12 January 2020.[unreliable source?]
  43. ^ Converter, Epoch. "Epoch Converter - Unix Timestamp Converter". epochconverter-unixtimestampconverter.com. Retrieved 23 July 2025.
  44. ^ "Unix time facts & trivia – Unix Time . Info". Archived from the original on 27 October 2017.
  45. ^ "UNIX Approaches Ripe Old Age of One Billion". Electromagnetic.net. Archived from the original on 13 April 2013. Retrieved 6 December 2012.
  46. ^ Neumann, Peter G. (15 October 2001). "The RISKS Digest, Volume 21 Issue 69". The Risks Digest. 21 (69). Archived from the original on 22 October 2015. Retrieved 6 December 2012.
  47. ^ "Technical Problems". linuxmafia.com. Archived from the original on 11 October 2012. Retrieved 21 August 2017.
  48. ^ nixCraft. "Humor: On Feb, Friday 13, 2009 Unix time Will Be 1234567890". Cyberciti.biz. Retrieved 5 July 2023.
  49. ^ "Google 1234567890 Logo". Google Inc. Archived from the original on 11 January 2013. Retrieved 28 January 2013.
  50. ^ Ahmed, Murad (13 February 2009). "At the third stroke, the Unix time will be 1234567890". The Times. Archived from the original on 14 November 2016. Retrieved 12 January 2020.
  51. ^ Mashey, John R. (27 December 2004). "Languages, Levels, Libraries, and Longevity". Queue. 2 (9): 32–38. doi:10.1145/1039511.1039532. S2CID 28911378.
[edit]
月经期间喝酒会有什么影响 什么是血清 大马士革是什么意思 嬴政和芈月是什么关系 铁锈色痰见于什么病
司空见惯什么意思 芦笋炒什么好吃 蛔虫属于什么动物 什么时候是排卵期 6月8日什么星座
卵巢保养吃什么好 鼻咽癌有什么症状 睾丸痛挂什么科 男人下面胀痛什么原因造成呢 高冷是什么意思
丝丝入扣是什么意思 回声不均匀是什么意思 经常流鼻血什么原因 性质是什么 卵巢囊肿吃什么药好得最快
百香果什么时候成熟beikeqingting.com ats是什么意思hcv8jop5ns2r.cn 美人尖是什么意思hcv9jop7ns0r.cn 三月份有什么节日bfb118.com 年底是什么时候hcv8jop6ns4r.cn
什么花在春天开aiwuzhiyu.com 祖籍是什么意思hcv7jop6ns4r.cn 脑电图是检查什么的hcv8jop1ns8r.cn 国花是什么hcv9jop7ns0r.cn 高氨血症是什么病hcv8jop3ns8r.cn
博士生导师是什么级别hcv8jop4ns5r.cn 鼻子里流出黄水是什么原因hcv7jop7ns1r.cn 头痛看什么科hcv7jop5ns3r.cn 手臂酸痛什么原因hcv7jop6ns3r.cn 鼻窦炎是什么原因引起的呢hcv8jop1ns8r.cn
叶酸片什么时候吃hcv9jop6ns4r.cn 亲嘴什么感觉wzqsfys.com 尼莫地平片治什么病hcv7jop4ns7r.cn 降压药什么药好hcv8jop7ns8r.cn 道听途说是什么意思hcv8jop1ns7r.cn
百度