Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98217 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63689 invoked from network); 6 Feb 2017 16:45:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Feb 2017 16:45:13 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.82 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.82 mx101.easyname.com Received: from [77.244.243.82] ([77.244.243.82:47007] helo=mx101.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/A5-30708-718A8985 for ; Mon, 06 Feb 2017 11:45:12 -0500 Received: from cable-81-173-135-7.netcologne.de ([81.173.135.7] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1camPc-0006gI-Sl; Mon, 06 Feb 2017 16:45:09 +0000 Reply-To: internals@lists.php.net References: <146cbb21-72cf-ed65-095a-43a7420482fc@php.net> <02c901d2684e$d1ee2a30$75ca7e90$@belski.net> <013d01d26e80$5c916f30$15b44d90$@belski.net> <019301d28075$2efdce40$8cf96ac0$@belski.net> To: Anatol Belski , 'Niklas Keller' Cc: 'PHP Internals' Message-ID: Date: Mon, 6 Feb 2017 17:45:01 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <019301d28075$2efdce40$8cf96ac0$@belski.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Fwd: Monotonic Time From: php@fleshgrinder.com (Fleshgrinder) On 2/6/2017 1:33 PM, Anatol Belski wrote: > With the names and API, probably some more clarity should be. AFM, > the low level units should be exposed, rather than a concrete time. > Also, the name hrtime() is probably not much speaking. Maybe these > three? > > sys_get_monotonic_ticks() > sys_get_monotonic_freq() > sys_get_monotonic_nanotime() or even - > sys_get_monotonic_time(int $unit = NANOSECOND) > > Regarding to "sys_get_*" scheme with these. But in general, probably > nanoseconds were enough for the general case and fast, the pure ticks > were for the advanced usage. > > In general, probably for the core it should be done a more robust > way, some parts on the original lib should get more error checks and > improved. It would be probably more handy to discuss the further on > the PR page. > > Regards > > Anatol > Hey guys! :) Please do not introduce more functions that require flags, it makes code hard to read. It's much better to have dedicated functions that provide exactly what is requested. A good bad example is `microtime()` vs `microtime(true)`. :( `sys_get_monotonic_nanotime()` is rather long but at least descriptive. Obviously providing a class could help with naming a lot and future extension would be easy, e.g. `MonotonicTime::getNanoseconds()`. -- Richard "Fleshgrinder" Fussenegger