mirror of
https://github.com/php/doc-pl.git
synced 2026-04-25 07:48:16 +02:00
158 lines
3.9 KiB
XML
158 lines
3.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 0abd79a0d9d783d492a2c61b834a4ded74bc7145 Maintainer: sobak Status: ready -->
|
|
<refentry xml:id="function.sleep" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>sleep</refname>
|
|
<refpurpose>Opóźnia wykonanie</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>sleep</methodname>
|
|
<methodparam><type>int</type><parameter>seconds</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<simpara>
|
|
Opóźnia wykonanie programu o ilość sekund podaną w parametrze
|
|
<parameter>seconds</parameter>.
|
|
</simpara>
|
|
<note>
|
|
<para>
|
|
Aby opóźnić wykonanie programu o ułamki sekund użyj <function>usleep</function>,
|
|
jako że funkcja <function>sleep</function> działa z liczbami całkowitymi (typ &integer;). Na przykład <code>sleep(0.25)</code> zatrzyma
|
|
wykonywanie programu na <literal>0</literal> sekund.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>seconds</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Czas wstrzymania w sekundach (musi być większy lub równy <literal>0</literal>).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Zwraca zero w wypadku powodzenia.
|
|
</para>
|
|
<para>
|
|
Jeśli wywołanie zostało przerwane sygnałem, <function>sleep</function> zwraca
|
|
wartość różną od zera. W systemie Windows tą wartością zawsze będzie
|
|
<literal>192</literal> (wartość stałej
|
|
<constant>WAIT_IO_COMPLETION</constant> w Windows API).
|
|
Na innych platformach zwrócona wartość będzie ilością pozostałych sekund,
|
|
przez które proces powinien był być wstrzymany.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
Jeżeli podana ilość sekund jest ujemna
|
|
to funkcja rzuci <classname>ValueError</classname>.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
Funkcja rzuca <classname>ValueError</classname> dla ujemnych ilości sekund,
|
|
wcześniej zgłaszany był błąd o poziomie <constant>E_WARNING</constant> a funkcja zwracała &false;.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Przykład użycia <function>sleep</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
// obecny czas
|
|
echo date('h:i:s') . "\n";
|
|
|
|
// wstrzymaj na 10 sekund
|
|
sleep(10);
|
|
|
|
// pobudka!
|
|
echo date('h:i:s') . "\n";
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
Po 10 sekundach ten przykład wyświetli
|
|
</para>
|
|
<screen>
|
|
<![CDATA[
|
|
05:31:23
|
|
05:31:33
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>usleep</function></member>
|
|
<member><function>time_nanosleep</function></member>
|
|
<member><function>time_sleep_until</function></member>
|
|
<member><function>set_time_limit</function></member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|