mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-29 12:22:19 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@261459 c90b9560-bf6c-de11-be94-00142212c4b1
155 lines
3.7 KiB
XML
155 lines
3.7 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.19 $ -->
|
|
<!-- EN-Revision: 1.15 Maintainer: yannick Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
|
|
|
|
<refentry xml:id="function.microtime" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>microtime</refname>
|
|
<refpurpose>Retourne le timestamp UNIX actuel avec les microsecondes</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>microtime</methodname>
|
|
<methodparam choice="opt"><type>bool</type><parameter>get_as_float</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>microtime</function> retourne le stimestamp Unix avec les microsecondes.
|
|
Cette fonction est uniquement disponible sur les systèmes qui supportent la fonction
|
|
gettimeofday().
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>get_as_float</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Lorsque cette fonction est appelée sans l'argument optionnel,
|
|
elle retourne la chaîne "msec sec" avec sec qui est mesurée en
|
|
secondes depuis le début
|
|
de l'époque UNIX, (1er janvier 1970 00:00:00 GMT), et msec
|
|
qui est le nombre de microsecondes de cette heure.
|
|
Les deux parties de la chaîne sont retournées sous la forme de secondes.
|
|
</para>
|
|
<para>
|
|
Si le paramètre optionnel <parameter>get_as_float</parameter> est défini à
|
|
&true; alors <function>microtime</function> retourne un nombre à virgule.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<para>
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>5.0.0</entry>
|
|
<entry>
|
|
Le paramètre <parameter>get_as_float</parameter> a été ajouté.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Durée d'exécution d'un script avec la fonction <function>microtime</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/**
|
|
* Fonction simple identique à celle en PHP 5 qui va suivre
|
|
*/
|
|
function microtime_float()
|
|
{
|
|
list($usec, $sec) = explode(" ", microtime());
|
|
return ((float)$usec + (float)$sec);
|
|
}
|
|
|
|
$time_start = microtime_float();
|
|
|
|
// Attend pendant un moment
|
|
usleep(100);
|
|
|
|
$time_end = microtime_float();
|
|
$time = $time_end - $time_start;
|
|
|
|
echo "Ne rien faire pendant $time secondes\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Durée d'exécution d'un script en PHP 5</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$time_start = microtime(true);
|
|
|
|
// Sleep for a while
|
|
usleep(100);
|
|
|
|
$time_end = microtime(true);
|
|
$time = $time_end - $time_start;
|
|
|
|
echo "Did nothing in $time seconds\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>time</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:"../../../../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
|
|
--> |