mirror of
https://github.com/php/doc-de.git
synced 2026-03-29 10:42:12 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/de/trunk@166853 c90b9560-bf6c-de11-be94-00142212c4b1
115 lines
3.0 KiB
XML
115 lines
3.0 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.8 $ -->
|
|
<!-- EN-Revision: 1.11 Maintainer: betz Status: ready -->
|
|
|
|
<refentry id="function.microtime">
|
|
<refnamediv>
|
|
<refname>microtime</refname>
|
|
<refpurpose>
|
|
Gibt den aktuellen Unix-Timestamp/Zeitstempel mit Mikrosekunden
|
|
zurück
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Beschreibung:</title>
|
|
<methodsynopsis>
|
|
<type>mixed</type><methodname>microtime</methodname>
|
|
<methodparam choice="opt"><type>bool</type><parameter>get_as_float</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>microtime</function> gibt den aktuellen Unix Timestamp mit
|
|
Mikrosekunden zurück. Diese Funktion steht nur auf Systemen zur Verfügung,
|
|
die den Systemaufruf gettimeofday() unterstützen.
|
|
</para>
|
|
<para>
|
|
Wird diese Funktion ohne den optionalen Parameter aufgerufen, gibt diese
|
|
die Zeichenkette "msec sec" zurück. Dabei entspricht sec der aktuellen
|
|
Zeit, ausgedrückt als Anzahl der Sekunden seit Beginn der UNIX-Epoche
|
|
(0:00:00 January 1, 1970 GMT), msec stellt den Mikrosekunden-Teil dar.
|
|
Beide Teile des Strings werden in Sekundeneinheiten zurückgegeben.
|
|
</para>
|
|
<para>
|
|
Wird <parameter>get_as_float</parameter> angegeben und als &true;
|
|
ausgewertet gibt <function>microtime</function> eine Fließkommazahl
|
|
(float) zurück.
|
|
</para>
|
|
<note>
|
|
<simpara>
|
|
Der Parameter <parameter>get_as_float</parameter> wurde in
|
|
PHP 5.0.0 eingeführt.
|
|
</simpara>
|
|
</note>
|
|
<para>
|
|
<example>
|
|
<title>Zeitmessung einer Skriptausführung mit <function>microtime</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
/**
|
|
* Simple function to replicate PHP5 behaviour
|
|
*/
|
|
function microtime_float()
|
|
{
|
|
list($usec, $sec) = explode(" ", microtime());
|
|
return ((float)$usec + (float)$sec);
|
|
}
|
|
|
|
$time_start = microtime_float();
|
|
|
|
// Sleep for a while
|
|
usleep(100);
|
|
|
|
$time_end = microtime_float();
|
|
$time = $time_end - $time_start;
|
|
|
|
echo "Did nothing in $time seconds\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
<example>
|
|
<title>Zeitmessung einer Skriptausführung in PHP5</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 "Nichts getan in $time Sekunden\n";
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<para>
|
|
Siehe auch <function>time</function>.
|
|
</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
|
|
-->
|