Resending previous mail, because mail distribution was broken...

Morning Internals,

PHP doesn't currently have a way to access a monotonic time. There's a
feature request in the bug tracker: bugs [dot] php [dot]
net/bug.php?id=68029

A monotonic time is required to measure time intervals correctly, e.g. for
implementing event loops based on stream_select. microtime() is affected by
NTP and leap seconds and can therefore not be reliably used for measuring
time intervals.

Event loops based on extensions like libuv can take advantage of libuv's
own API for accessing a monotonic time.

Related: twitter [dot] com/danluu/status/815442765811023872
Related: blog [dot] cloudflare [dot] com/how-and-why-the-leap-secon
d-affected-cloudflare-dns/

Node.js does have a monotonic time and calls the function
process.hrtime: nodejs [dot] org/api/process.html#process_p
rocess_hrtime_time

There's an existing PECL extension named hrtime: php [dot]
net/manual/en/book.hrtime.php

I think we can reuse parts of it to implement a function in core to access
a monotonic time, I don't think we need to merge the extension into core.

What do you think about adding such a function to the PHP core?

Regards, Niklas

PS: No links, because stupid PHP.net spam filter ...

Reply via email to