didou Fri Dec 19 08:25:30 2003 EDT
Modified files: /phpdoc/en/reference/datetime/functions microtime.xml Log: document the new optional parameter introduced by PHP5 (andrey) # commited by error during a huge CS commit, improving it now Index: phpdoc/en/reference/datetime/functions/microtime.xml diff -u phpdoc/en/reference/datetime/functions/microtime.xml:1.5 phpdoc/en/reference/datetime/functions/microtime.xml:1.6 --- phpdoc/en/reference/datetime/functions/microtime.xml:1.5 Thu Dec 18 12:43:32 2003 +++ phpdoc/en/reference/datetime/functions/microtime.xml Fri Dec 19 08:25:30 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 --> <refentry id="function.microtime"> <refnamediv> @@ -15,21 +15,28 @@ <methodparam choice="opt"><type>bool</type><parameter>get_as_float</parameter></methodparam> </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. + <function>microtime</function> returns the current Unix timestamp with + microseconds. This function is only available on operating systems that + support the gettimeofday() system call. + </para> + <para> + When called without the optional argument, this function 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. + Both portions of the string are returned in units of seconds. + </para> + <para> + When <parameter>get_as_float</parameter> is given, and evaluates to + &true;, <function>microtime</function> will return a float. </para> <note> <simpara> The <parameter>get_as_float</parameter> parameter was added as of - <literal>PHP 5.0.0</literal>. It allows you to get the result of - <function>microtime</function> as a float. + <literal>PHP 5.0.0</literal>. </simpara> </note> <para> - Both portions of the string are returned in units of seconds. <example> <title><function>microtime</function> example</title> <programlisting role="php"> @@ -54,13 +61,13 @@ // with PHP 5 you can do the same this way: -$time_start = microtime(true); +$time_start = microtime(1); for ($i=0; $i < 1000; $i++){ // do nothing, 1000 times } -$time_end = microtime(true); +$time_end = microtime(1); $time = $time_end - $time_start; echo "Did nothing in $time seconds\n";