Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97510 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12587 invoked from network); 4 Jan 2017 12:58:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2017 12:58: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.218 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.218 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.218] ([81.169.146.218:12695] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/8E-55609-C71FC685 for ; Wed, 04 Jan 2017 07:58:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1483534712; l=3967; s=domk; d=kelunik.com; h=Content-Type:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=ORXkJrSmmEAratiALY4L9V8g5jUpYsXoU4v0hGAhxfw=; b=cMOldbb6K5bwEQghTQUV0q+5bmruuJmdEAV0amuv6EJqX7/p0RGUCHgUMa0Pc/pIwu fbaeKJ+4KCmmb5dJ87l0vdMKpPz9E9UYvm4c/Rjiey7Onp1rraayRb77cQxU+pWeOATN 1oEgiy1x4sUViUqZkuCWdL5I9+D1lMg6IdoiE= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoBPBqDwsb8= X-RZG-CLASS-ID: mo00 Received: from mail-qk0-f181.google.com ([209.85.220.181]) by smtp.strato.de (RZmta 39.11 AUTH) with ESMTPSA id 007c45t04CwWsBM (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 ; Wed, 4 Jan 2017 13:58:32 +0100 (CET) Received: by mail-qk0-f181.google.com with SMTP id a20so10024110qkc.1 for ; Wed, 04 Jan 2017 04:58:32 -0800 (PST) X-Gm-Message-State: AIkVDXIh/arhRtJ63w/7PO7mgKrpuneSjfOZ4J3BKN5SdFn15Ltos65rRTTE8552x7jZe8pcUYb4aZeJG9Z1bw== X-Received: by 10.55.17.68 with SMTP id b65mr63478034qkh.60.1483534711980; Wed, 04 Jan 2017 04:58:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.141.204 with HTTP; Wed, 4 Jan 2017 04:58:31 -0800 (PST) In-Reply-To: References: Date: Wed, 4 Jan 2017 13:58:31 +0100 X-Gmail-Original-Message-ID: Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=001a1146f10685a78605454457bb Subject: Fwd: Monotonic Time From: me@kelunik.com (Niklas Keller) --001a1146f10685a78605454457bb Content-Type: text/plain; charset=UTF-8 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 ... --001a1146f10685a78605454457bb--