Is time() guaranteed to be leap-second aware?
hhvm, linux, php, time, windows
Solution
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.
Problem
PHP manual states that `time()` returns "the current UNIX timestamp" ᴀ and `microtime()` returns the "current Unix timestamp with microseconds" ʙ. However, are these functions guaranteed to behave like that of strictly conforming POSIX.1 systems? 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? 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?