Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111453 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22652 invoked from network); 11 Aug 2020 12:04:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 11 Aug 2020 12:04:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C0867180511 for ; Tue, 11 Aug 2020 04:03:49 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-mahalux.mvorisek.com (mail-mahalux.mvorisek.com [77.93.195.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 11 Aug 2020 04:03:48 -0700 (PDT) Received: from 6279379d2035 (10.228.0.159) by mail-mahalux.mvorisek.com (10.228.0.4) with Microsoft SMTP Server (TLS); Tue, 11 Aug 2020 13:03:45 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_cd79baa882f2b153af21058201d47eed" Date: Tue, 11 Aug 2020 13:03:44 +0200 To: PHP internals In-Reply-To: References: <6cfb77d4d511b5c591e7d7b5cc80199955123b2cd4276a5bca2327e4b02942db@mahalux.com> Message-ID: X-Mailer: SAP NetWeaver 7.03 Subject: Re: [PHP-DEV] Allow sleep() to accept non-integer values From: vorismi3@fel.cvut.cz (=?UTF-8?Q?Michael_Vo=C5=99=C3=AD=C5=A1ek_-_=C4=8CVUT_FEL?=) --=_cd79baa882f2b153af21058201d47eed Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8; format=flowed > Another reason is that sleep(0.1); is silently accepted now (even with strict types enabled), > > That appears to not be true: https://3v4l.org/7YbqX corrected, should be "without strict types enabled" - https://3v4l.org/A2olN "even with strict type enabled" statement in BC section remains valid > Having a function that behaves differently based on different platforms is a bad idea. I will implement fallback to usleep. I have not noticed any issues with usleep availability. Is there any known platform without nanosleep neither usleep support? With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem, Michael Voříšek On 11 Aug 2020 12:39, Dan Ackroyd wrote: > Michael Voříšek wrote: > >> Another reason is that sleep(0.1); is silently accepted now (even with > strict types enabled), > > That appears to not be true: https://3v4l.org/7YbqX > > Rowan wrote: > >> Unless there are problems with the implementation, this seems like a > straight-forward win. > > From the PR. > >> Implemented using nanosleep which is not guaranteed to be available everywhere. > > Please just use usleep if you need more accuracy than seconds. > > Having a function that behaves differently based on different > platforms is a bad idea. > > Changing a function to have surprising behaviour just to avoid using a > different function, that is already available, is a really bad > tradeoff. > > cheers > Dan > Ack --=_cd79baa882f2b153af21058201d47eed--