note 46039 added to function.gettimeofday
| From: | steve at unicycle dot co dot nz | Date: | Tue, 28 Sep 2004 00:52:45 +0000 |
| Subject: | note 46039 added to function.gettimeofday | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77456@lists.php.net to get a copy of this message | ||
Thanks jz for your useful function. I have used it a lot, with one small extension:
The usec must be zero padded before it can be appended to the seconds. The reson is this: if the
time is 10 sec, 90 usec then the real time is 10.000090 but a simple string append would return
10.90
function getTimer()
{
$t = gettimeofday();
return (double)(sprintf( '%d.%06d', $t['sec'], $t['usec']));
}
----
Manual Page -- http://www.php.net/manual/en/function.gettimeofday.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46039
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46039&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46039&report=yes
Search -- http://master.php.net/manage/user-notes.php