do you realy think that convertion to String and back to float can be fast??
this function runs 10 times faster than utime() :
function fastUtime()
{
$t = gettimeofday();
return (float) ($t['sec'] + $t['usec'] / 1000000.0);
}
gettimeofday说明mixed gettimeofday ( [bool return_float] )本函数是 gettimeofday(2) 的接口。返回一个关联数组,包含有系统调用返回的数据。 自 PHP 5.1.0 起有个可选参数 return_float,当其设为 TRUE 时,gettimeofday() 会返回一个浮点数。 数组中的键为:
add a note
User Contributed Notes
void0( the dog )yandex.ru
21-Sep-2006 02:07
do you realy think that convertion to String and back to float can be fast??
lucas dot karisny at linuxmail dot org
14-Feb-2005 10:26
A small improvement on getTimer. Using vsprintf instead of sprintf there is no need to assign the array:
beidson at calpoly dot edu
14-Sep-2000 02:21
Since USLEEP doesn't work under windows, you need to come up with your own fix. gettimeofday() can access useconds on a windows box, so this little function using gettimeofday() will do the trick.
middleto at pilot dot msu dot edu
13-Aug-1999 10:49
The types of DST correction (from sys/time.h on a Linux system):
| |||