reference/misc/functions/sleep.xml
0abd79a0d9d783d492a2c61b834a4ded74bc7145
...
...
@@ -16,6 +16,13 @@
16
16
Delays the program execution for the given number of
17
17
<parameter>seconds</parameter>.
18
18
</simpara>
19
+
<note>
20
+
<para>
21
+
In order to delay program execution for a fraction of a second, use <function>usleep</function>
22
+
as the <function>sleep</function> function expects an &integer;. For example, <code>sleep(0.25)</code> will
23
+
pause program execution for <literal>0</literal> seconds.
24
+
</para>
25
+
</note>
19
26
</refsect1>
20
27

21
28
<refsect1 role="parameters">
...
...
@@ -26,7 +33,7 @@
26
33
<term><parameter>seconds</parameter></term>
27
34
<listitem>
28
35
<para>
29
-
Halt time in seconds.
36
+
Halt time in seconds (must be greater than or equal to <literal>0</literal>).
30
37
</para>
31
38
</listitem>
32
39
</varlistentry>
...
...
@@ -37,7 +44,7 @@
37
44
<refsect1 role="returnvalues">
38
45
&reftitle.returnvalues;
39
46
<para>
40
-
Returns zero on success, or &false; on error.
47
+
Returns zero on success.
41
48
</para>
42
49
<para>
43
50
If the call was interrupted by a signal, <function>sleep</function> returns
...
...
@@ -53,10 +60,33 @@
53
60
&reftitle.errors;
54
61
<para>
55
62
If the specified number of <parameter>seconds</parameter> is negative,
56
-
this function will generate a <constant>E_WARNING</constant>.
63
+
this function will throw a <classname>ValueError</classname>.
57
64
</para>
58
65
</refsect1>
59
66

67
+
<refsect1 role="changelog">
68
+
&reftitle.changelog;
69
+
<informaltable>
70
+
<tgroup cols="2">
71
+
<thead>
72
+
<row>
73
+
<entry>&Version;</entry>
74
+
<entry>&Description;</entry>
75
+
</row>
76
+
</thead>
77
+
<tbody>
78
+
<row>
79
+
<entry>8.0.0</entry>
80
+
<entry>
81
+
The function throws a <classname>ValueError</classname> on negative <parameter>seconds</parameter>;
82
+
previously, an <constant>E_WARNING</constant> was raised instead, and the function returned &false;.
83
+
</entry>
84
+
</row>
85
+
</tbody>
86
+
</tgroup>
87
+
</informaltable>
88
+
</refsect1>
89
+

60
90
<refsect1 role="examples">
61
91
&reftitle.examples;
62
92
<para>
63
93