Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77030 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71182 invoked from network); 2 Sep 2014 09:20:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2014 09:20:24 -0000 Authentication-Results: pb1.pair.com header.from=anatol.php@belski.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=anatol.php@belski.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain belski.net from 85.214.73.107 cause and error) X-PHP-List-Original-Sender: anatol.php@belski.net X-Host-Fingerprint: 85.214.73.107 klapt.com Received: from [85.214.73.107] ([85.214.73.107:59504] helo=h1123647.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 81/40-01676-1DB85045 for ; Tue, 02 Sep 2014 05:20:18 -0400 Received: by h1123647.serverkompetenz.net (Postfix, from userid 33) id E96FC6D209D; Tue, 2 Sep 2014 11:20:13 +0200 (CEST) Received: from 93.205.119.95 (SquirrelMail authenticated user anatol@belski.net) by webmail.klapt.com with HTTP; Tue, 2 Sep 2014 11:20:13 +0200 Message-ID: <209db784d40e796718975276b74725de.squirrel@webmail.klapt.com> In-Reply-To: <5404DBD1.8050604@sugarcrm.com> References: <5404DBD1.8050604@sugarcrm.com> Date: Tue, 2 Sep 2014 11:20:13 +0200 To: "Stas Malyshev" Cc: "Matt Wilmas" , internals@lists.php.net, "Pierre Joye" , "Anatol Belski" User-Agent: SquirrelMail/1.5.2 [SVN] MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [INTERNALS-WIN] [PATCH] Microsecond resolution and accuracy on Windows From: anatol.php@belski.net ("Anatol Belski") On Mon, September 1, 2014 22:49, Stas Malyshev wrote: > Hi! > > >> It's much more optimized than what's there now, and slightly over the >> old implementation. Not sure if I should give the saved patch link, or >> the "live compare" (?) on Github, so I'll do both for now: >> http://realplain.com/php/microtime_5_4.diff >> https://github.com/matt-moo/php-src/compare/PHP-5.4.diff >> >> >> Against 5.4 since that's what I quickly worked on so it's ready for the >> next 5.4 release (Stas?). (Although I guess we're supposed to change >> the oldest branch usually?) > > Looking at the patch, it looks like unfortunately it changes a global > structure (_php_win32_core_globals) which breaks binary compatibility. I > think if you move the additional value to the end of the structure it > should be ok though, since other offsets should not change then. > AFAIR the patch with ABI break was at the time where 5.5 was alpha, so the change was backported. Was not intentional to break ABI and just based on the good user feedback, and good tested anyway. Still used and shows no issue in the phpt and app unit tests. > I'm also not sure how important it is how have it for 5.4. Does the > problem that this patch fixes exist only in older versions of Windows or on > all versions? What are the actual effects of this problem - is it just > lower resolution of microtime or there can be something seriously wrong > with the whole result? If it's just lower resolution, I'd prefer this to > go into 5.5 as the change is pretty extensive. -- That's the lower resolution on systems preceding win8. The previous issue was time_before > time_after which was caused by the same approach Matt has now in the patch. Also I've developed pecl.php.net/hrtime since then which provides the exact solution - a stopwatch for inteval measurements, no synchronized timestamps. The microtime in the core delivers the real timestamp, not a computed one. But well, with an accuracy which one could wish to be better. Currently, something like this can never be true $time0 = microtime(true); time1 = microtime(true); var_dump($time1 - $time0 < 0); For the practical case, i'm not sure if with the Matt's patch one will be able to make an ebay bid in the right time (assumed it's expected to have microsecond precision). However with a lower accuracy there might be an issue, too. Phony buggy timestamp vs. worse accuracy. Please consider also the other issues like hardware/software i mentioned in the other mail. Regards Anatol