是否保证time()是leap秒意识的? [英] Is time() guaranteed to be leap-second aware?

查看:80
本文介绍了是否保证time()是leap秒意识的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP手册指出time()返回 "当前UNIX timestamp    ­ microtime()返回 "当前Unix时间戳(以微秒为单位)   ʙ .

PHP manual states that time() returns "the current UNIX timestamp"  ­and microtime() returns the "current Unix timestamp with microseconds" ʙ.

但是,这些功能是否得到保证以像那样严格遵循POSIX.1系统?

However, are these functions guaranteed to behave like that of strictly conforming POSIX.1 systems?

具体来说,插入leap秒的方式应使第二天开始时time()  | ­ microtime()的输出向后跳跃1秒,(也就是the秒的末尾),为我们提供了重复的返回值—而不是 fresh 唯一值—在第二天的第一秒的整个过程中都是如此?

Specifically, do leap seconds get inserted in such a way that the output of time() | ­microtime() jump backwards by 1 second at the start of the next day, (which is the also at the end of the leap second,) giving us repeated return values —as opposed to fresh unique values— throughout the entirety of the first second of that next day?

例如,如果我们在1998 -12 -31和1999 -01- 01,在915  148  800<=范围内会出现两个值. x< 915  148  801?

For example, if we poll time() | ­microtime() every microsecond throughout the span of 1998-12-31 and 1999-01-01, would there be two occurences of each value within the range 915 148 800 <= x < 915 148 801?

推荐答案

PHP是一种服务器端语言. time()函数将解析为该服务器的系统时间.如果服务器正在运行NTP守护程序,则它将知道leap秒并进行相应调整. PHP不知道这一点,但是系统知道.

PHP is a serverside language. The time() function will resolve to the system time of that server. If the server is running an NTP daemon then it will be leap second aware and adjust accordingly. PHP has no knowledge of this, but the system does.

这篇关于是否保证time()是leap秒意识的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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