Home  |  Linux  | Mysql  | PHP  | XML
From:ross dot masters dot rm at googlemail dot com Date:Wed Aug 27 12:06:15 2008
Subject:#44286 [Com]: date('u'): milli or microseconds?
 ID:               44286
 Comment by:       ross dot masters dot rm at googlemail dot com
 Reported By:      carsten at bitbybit dot dk
 Status:           Open
 Bug Type:         Documentation problem
 Operating System: any
 PHP Version:      Irrelevant
 New Comment:

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>


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

[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