svn: /phpdoc/it/trunk/reference/datetime/functions/ microtime.xml
| From: | Marco Cucinato | Date: | Wed, 01 Apr 2015 05:36:16 +0000 |
| Subject: | svn: /phpdoc/it/trunk/reference/datetime/functions/ microtime.xml | ||
| Groups: | php.doc.it | ||
| Request: | Send a blank email to doc-it+get-1808@lists.php.net to get a copy of this message | ||
cucinato Wed, 01 Apr 2015 05:36:16 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=336309
Log:
Sync to EN - Bug #65472
Bug: https://bugs.php.net/65472 (Open) [IT] microtime bad
description in Italian
Changed paths:
U phpdoc/it/trunk/reference/datetime/functions/microtime.xml
Modified: phpdoc/it/trunk/reference/datetime/functions/microtime.xml
===================================================================
--- phpdoc/it/trunk/reference/datetime/functions/microtime.xml 2015-03-31 23:23:42 UTC (rev 336308)
+++ phpdoc/it/trunk/reference/datetime/functions/microtime.xml 2015-04-01 05:36:16 UTC (rev 336309)
@@ -1,58 +1,137 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- splitted from ./it/functions/datetime.xml, last change in rev 1.1 -->
-<!-- last change to 'microtime' in en/ tree in rev 1.2 -->
-<!-- EN-Revision: n/a Maintainer: curcio_it Status: ready -->
-<!-- OLD-Revision: 1.71/EN.1.2 -->
- <refentry xml:id="function.microtime" xmlns="http://docbook.org/ns/docbook">
- <refnamediv>
- <refname>microtime</refname>
- <refpurpose>
- Restituisce l'attuale UNIX timestamp con i microsecondi</refpurpose>
- </refnamediv>
- <refsect1>
- <title>Descrizione</title>
- <methodsynopsis>
- <type>string</type><methodname>microtime</methodname>
- <void/>
- </methodsynopsis>
- <para>
- Restituisce la stringa "msec sec" dove sec è l'attuale orario
- misurato nel numero di secondi dalla Unix Epoch (0:00:00
- January 1, 1970 GMT), e msec è la parte in microsecondi. Questa funzione
- è disponibile solo su sistemi operativi che supportano la
- chiamata di sistema gettimeofday().
- </para>
- <para>
- Entrambi le parti della stringa sono restituite in unità di secondi.
- <example>
- <title>Esempio di <function>microtime</function></title>
- <programlisting role="php">
+<!-- EN-Revision: 334621 Maintainer: curcio_it Status: ready -->
+<refentry xml:id="function.microtime" xmlns="http://docbook.org/ns/docbook">
+ <refnamediv>
+ <refname>microtime</refname>
+ <refpurpose> Restituisce l'attuale UNIX timestamp con i
microsecondi</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><initializer>false</initializer></methodparam>
+ </methodsynopsis>
+ <para>
+ <function>microtime</function> restituisce l'attuale timestamp Unix in
+ microsecondi. Questa funzione è disponibile solo su sistemi operativi che
+ supportano la chiamata di sistema gettimeofday().
+ </para>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><parameter>get_as_float</parameter></term>
+ <listitem>
+ <para>
+ Se utilizzato e impostato a &true;, <function>microtime</function>
restituisce un
+ <type>float</type> invece che un <type>string</type>, come descritto
+ nella sezione sui valori di ritorno, più sotto.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <para>
+ Per default, <function>microtime</function> restituisce una
<type>string</type> in
+ forma di "msec sec", dove <literal>sec</literal> è il numero di secondi
+ dalla Unix Epoch (0:00:00 January 1, 1970 GMT), e <literal>msec</literal>
+ misura i microsecondi che sono trascorsi da <literal>sec</literal>
+ ed è ugualmente espresso in secondi.
+ </para>
+ <para>
+ Se <parameter>get_as_float</parameter> è impostato a &true;, allora
+ <function>microtime</function> restituisce un <type>float</type>, il
quale
+ rappresenta l'orario attuale in microsecondi a partire dalla Unix epoch, approssimato al
+ microsecondo più vicino.
+ </para>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example>
+ <title>Cronometrare l'esecuzione di uno script con
<function>microtime</function></title>
+ <programlisting role="php">
<![CDATA[
-function getmicrotime(){
- list($usec, $sec) = explode(" ",microtime());
- return ((float)$usec + (float)$sec);
- }
+<?php
+/**
+ * Semplice funzione che replica il comportamento di PHP 5
+ */
+function microtime_float()
+{
+ list($usec, $sec) = explode(" ", microtime());
+ return ((float)$usec + (float)$sec);
+}
-$time_start = getmicrotime();
-
-for ($i=0; $i < 1000; $i++){
- //do nothing, 1000 times
- }
+$time_start = microtime_float();
-$time_end = getmicrotime();
+// Sleep for a while
+usleep(100);
+
+$time_end = microtime_float();
$time = $time_end - $time_start;
-echo "Did nothing in $time seconds";
+echo "Non ho fatto nulla per $time secondi\n";
+?>
]]>
- </programlisting>
- </example>
- </para>
- <para>
- Vedere anche <function>time</function>.
- </para>
- </refsect1>
- </refentry>
+ </programlisting>
+ </example>
+ <example>
+ <title>Cronometrare l'esecuzione di uno script in 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 "Non ho fatto nulla per $time secondi\n";
+?>
+]]>
+ </programlisting>
+ </example>
+ <example>
+ <title><function>microtime</function> and
<literal>REQUEST_TIME_FLOAT</literal> (as of PHP 5.4.0)</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Randomize sleeping time
+usleep(mt_rand(100, 10000));
+
+// Da PHP 5.4.0, REQUEST_TIME_FLOAT è disponibile nell'array superglobale $_SERVER.
+// Contiene il timestamp dell'inizio della richiesta con precisione al microsecondo.
+$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
+
+echo "Non ho fatto nulla per $time secondi\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