Home  |  Linux  | Mysql  | PHP  | XML
From:kalle@php.net Date:Wed Aug 27 12:08:15 2008
Subject:#44286 [Opn->Csd]: date('u'): milli or microseconds?
 ID:               44286
 Updated by:       kalle@php.net
 Reported By:      carsten at bitbybit dot dk
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: any
 PHP Version:      Irrelevant
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.




Previous Comments:
------------------------------------------------------------------------

[2008-08-27 18:06:14] ross dot masters dot rm at googlemail dot com

The source (below)

case 'u': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%06d", (int)
floor(t->f * 1000000)); break;

Which is 10^-6 - microseconds.

I don't have a CVS account but here's a small docbook patch for it:


Index: phpdoc/en/reference/datetime/functions/date.xml
--- phpdoc/en/reference/datetime/functions/date.xml Base (1.42)
+++ phpdoc/en/reference/datetime/functions/date.xml Locally Modified
(Based On 1.42)
@@ -214,7 +214,7 @@
           </row>
           <row>
            <entry><literal>u</literal></entry>
-           <entry>Milliseconds (added in PHP 5.2.2)</entry>
+           <entry>Microseconds (added in PHP 5.2.2)</entry>
            <entry>Example: <literal>54321</literal></entry>
           </row>
           <row>

------------------------------------------------------------------------

[2008-02-28 20:21:25] carsten at bitbybit dot dk

Description:
------------
According to current documentation, date('u') returns "Milliseconds
(added in PHP 5.2.2) | Example: 54321".

I suspect that what is meant is microseconds (10^-6 s), not
milliseconds (10^-3 s). Otherwise, the example value doesn't make sense.

Reproduce code:
---------------
shell> php -r 'echo date("u")."\n".date("u")."\n";'


Expected result:
----------------
microseconds, not milliseconds

Actual result:
--------------
microseconds (apparently)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=44286&edit=1

Navigate in group php.doc.bugs at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants