Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111511 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45278 invoked from network); 14 Aug 2020 06:31:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Aug 2020 06:31:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 311D41804AC for ; Thu, 13 Aug 2020 22:31:18 -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=0.4 required=5.0 tests=BAYES_00,BODY_8BITS, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RDNS_DYNAMIC,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from qq.com (out203-205-251-73.mail.qq.com [203.205.251.73]) (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 ; Thu, 13 Aug 2020 22:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1597383061; bh=1xrNLqOpaG1NiP0voubm887T9JYi4zbuoxE1xvpnD0o=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=GSdP6y4l4p34NRN1h4JBDJN+CM2nWoirJI2aSIxCME8I/ZFXzCUI7Kf0488Hxlkiw rbXjmMau/X0OyisL32hqdAiNCABB+0DNNdN2u+W4X5VoX6r9kUUHrZPoHTmO8S18Zw ONBBPU70Oh45X0ZUhSNY/R+KQ3yh4L+t2DOW6nQs= Received: from [127.0.0.1] ([111.198.225.237]) by newxmesmtplogicsvrszb6.qq.com (NewEsmtp) with SMTP id 7BAA58AD; Fri, 14 Aug 2020 13:30:58 +0800 X-QQ-mid: xmsmtpt1597383058tlecoxdvr Message-ID: X-QQ-XMAILINFO: OIk6OTm+tKReQ3RYyA+dnMBLPhLjkTWT0NL8xEKYWT5H5jwc4pX9cq6T2hMMTT krzk4OUlWrY1BqPKhUb2UBnKWds6o6tnVyqnMCvqnFp2Txc1CJBbnZuK/HLoZyVoWSPeZ/O5Vl12 raOuka2uxgT2/zl8FL0EqLh5x0oX8w73zpSIjJzRCDz9mW5rBIChHuROkEjuk4aDl0cj/ikMeWHz Fn2NLXImZ997Woe8iKAf25G2fkJEzRwyxo3BL+qfoh5qRlkTnMWw+Bgh4daBQLupZsfWkNEb9Alf A0f4ATtPIOe/JQ9Dif+ZvxshjLPnKfPA9GON0Uw5ag6NqJ24T3YjaPL3m522K2LEq5cVTiRxxf5x WFEzMQJLPlDkHBWw3Xcb080pbPP67SA7gVWsmqoX/lWWwM5Od96qzCxx+2BP0WkZ0Ble+qUEbixo 7ksklGtW6Dbrz9GYX8FuzPX7V24Vb/3QuAvctRkZ5urWXPM4zOWOoz+R8jWk/Vd17zXSPSxjxWIb mzvN0KELq/nkiP89/OfwwhVnhD+TL5rCcq+ZFg+H2mYWV816BnuexcFQXARpEqWVjERu7y4FO+CB xlV05E5UiATPLbSFlzLyqSnOTNggV/H0jWxrnvNcaUpXlasKX7bAycS6SrzZnUbtIwkbAYxg7r7C miWyzlLZ4FGgVagZUhije3uy3VwmLF9NEUvILLsH51vNZZoMZYWmHvU4dYCbzlNrygbnsUh9vUEd YccUTOHSZagx0= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) In-Reply-To: Date: Fri, 14 Aug 2020 13:30:57 +0800 Cc: =?utf-8?B?TWljaGFlbCBWb8WZw63FoWVrIC0gxIxWVVQgRkVM?= , PHP internals Content-Transfer-Encoding: quoted-printable X-OQ-MSGID: References: <6cfb77d4d511b5c591e7d7b5cc80199955123b2cd4276a5bca2327e4b02942db@mahalux.com> To: Dan Ackroyd X-Mailer: Apple Mail (2.3608.80.23.2.2) Subject: Re: [PHP-DEV] Allow sleep() to accept non-integer values From: twose@qq.com (twosee) > 2020=E5=B9=B48=E6=9C=8811=E6=97=A5 =E4=B8=8B=E5=8D=886:39=EF=BC=8CDan = Ackroyd =E5=86=99=E9=81=93=EF=BC=9A >=20 > Michael Vo=C5=99=C3=AD=C5=A1ek wrote: >=20 >> Another reason is that sleep(0.1); is silently accepted now (even = with > strict types enabled), >=20 > That appears to not be true: https://3v4l.org/7YbqX >=20 > Rowan wrote: >> Unless there are problems with the implementation, this seems like a > straight-forward win. >=20 > =46rom the PR. >> Implemented using nanosleep which is not guaranteed to be available = everywhere. >=20 > Please just use usleep if you need more accuracy than seconds. >=20 > Having a function that behaves differently based on different > platforms is a bad idea. >=20 > Changing a function to have surprising behaviour just to avoid using a > different function, that is already available, is a really bad > tradeoff. >=20 > cheers > Dan > Ack >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 >=20 +1 I would rather have a new function like this (actually I am using it on = my project): ``` function msleep(int $milli_seconds) { } ``` int is always a better choice than float, otherwise, we have to do dirty = conversions and more checks on it And usually, we don't need high precision, millisecond sleep is enough, = e.g. the timeout feature provided by epoll, it is the reason why many = async libraries provide timeout feature in milliseconds. Regards, Twosee