Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97502 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81568 invoked from network); 2 Jan 2017 23:35:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jan 2017 23:35:38 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.217 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.217 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.217] ([81.169.146.217:11468] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/67-55609-7C3EA685 for ; Mon, 02 Jan 2017 18:35:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1483400132; l=3771; s=domk; d=kelunik.com; h=Content-Type:To:Subject:Date:From:MIME-Version; bh=yh4/e2P7AphMdL84geMs0VhFK3FlMgxFeqlIOPbq4r4=; b=AzEaMsi166e2dPhu6UE7tMkQbcEIkGz3nTJ8FnUWTXBtHq7D3b4LS1oFdAXPg3Iamz vwbkLSO9tgOJd0r3fkqxNXnMQY58kfS5foLJl9n95yLrycV9vAw/FMMli6BJ36aIfWxN GednjaPbWuyL9ze2xpQWbvPCG43yzBwAg+VMk= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoBPBqD/sF4= X-RZG-CLASS-ID: mo00 Received: from mail-qk0-f170.google.com ([209.85.220.170]) by smtp.strato.de (RZmta 39.11 AUTH) with ESMTPSA id 209b93t02NZWZiw (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Tue, 3 Jan 2017 00:35:32 +0100 (CET) Received: by mail-qk0-f170.google.com with SMTP id n21so355909597qka.3 for ; Mon, 02 Jan 2017 15:35:32 -0800 (PST) X-Gm-Message-State: AIkVDXIEAyUvbImF/2nNClXshgz0fLSEA/Bq61r+ARsJGKPL9qPyy3U8Pm7UeXH0WDZHOEzcuDFThrGcYXUDnA== X-Received: by 10.55.154.197 with SMTP id c188mr45622376qke.113.1483400131926; Mon, 02 Jan 2017 15:35:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.141.204 with HTTP; Mon, 2 Jan 2017 15:35:31 -0800 (PST) Date: Tue, 3 Jan 2017 00:35:31 +0100 X-Gmail-Original-Message-ID: Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=94eb2c0540d4ec611b05452501c9 Subject: Monotonic Time From: me@kelunik.com (Niklas Keller) --94eb2c0540d4ec611b05452501c9 Content-Type: text/plain; charset=UTF-8 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 ... --94eb2c0540d4ec611b05452501c9--