mirror of
https://github.com/php/doc-es.git
synced 2026-03-29 19:02:23 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@297032 c90b9560-bf6c-de11-be94-00142212c4b1
152 lines
3.7 KiB
XML
152 lines
3.7 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 288721 $ -->
|
|
<!-- EN-Revision: 96c9d88bad9a7d7d44bfb7f26c226df7ee9ddf26 Maintainer: seros Status: ready -->
|
|
<refentry xml:id="function.microtime" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>microtime</refname>
|
|
<refpurpose>Devuelve la fecha Unix actual con microsegundos</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> devuelve la fecha Unix actual con
|
|
microsegundos. Esta función sólo está disponible en sisitemas operativos que
|
|
soportan la llamada al sisitema gettimeofday().
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>get_as_float</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Cuando se llama sin el argumento opcional, esta función devuelve la cadena
|
|
"mseg seg" donde seg es el momento actual medido con el número de
|
|
segundos desde la Época Unix (0:00:00 1 de Enero, 1970 GMT), y
|
|
mseg es la parte de microsegundos.
|
|
Ambas partes de la cadena son devueltas en unidad de segundos.
|
|
</para>
|
|
<para>
|
|
Si el parámetro opcional <parameter>get_as_float</parameter> está establecido a
|
|
&true; se devuelve un <type>float</type> (en segundos).
|
|
</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>
|
|
Se añadió el parámetro <parameter>get_as_float</parameter>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejecución de un script de cronometraje con <function>microtime</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/**
|
|
* Función sencilla para repetir el comportamiento de PHP 5
|
|
*/
|
|
function microtime_float()
|
|
{
|
|
list($usec, $sec) = explode(" ", microtime());
|
|
return ((float)$usec + (float)$sec);
|
|
}
|
|
|
|
$time_start = microtime_float();
|
|
|
|
// Dormir por un momento
|
|
usleep(100);
|
|
|
|
$time_end = microtime_float();
|
|
$time = $time_end - $time_start;
|
|
|
|
echo "No se hizo nada en $time segundos\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Ejecución de un script de cronometraje en PHP 5</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$time_start = microtime(true);
|
|
|
|
// Dormir por un momento
|
|
usleep(100);
|
|
|
|
$time_end = microtime(true);
|
|
$time = $time_end - $time_start;
|
|
|
|
echo "No se hizo nada en $time segundos\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:"~/.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
|
|
-->
|