php-doc-en/reference/datetime/functions/microtime.xml
Friedhelm Betz aeed73d9cf tags in examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@120845 c90b9560-bf6c-de11-be94-00142212c4b1
2003-03-21 15:46:14 +00:00

75 lines
1.9 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.microtime">
<refnamediv>
<refname>microtime</refname>
<refpurpose>
Return current UNIX timestamp with microseconds</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>microtime</methodname>
<void/>
</methodsynopsis>
<para>
Returns the string "msec sec" where sec is the current time
measured in the number of seconds since the Unix Epoch (0:00:00
January 1, 1970 GMT), and msec is the microseconds part. This
function is only available on operating systems that support the
gettimeofday() system call.
</para>
<para>
Both portions of the string are returned in units of seconds.
<example>
<title><function>microtime</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
for ($i=0; $i < 1000; $i++){
//do nothing, 1000 times
}
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Did nothing in $time seconds";
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <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
-->