hrtime() - php 选项信息函数
hrtime()
(PHP 7 >= 7.3.0)
Get the system's high resolution time
说明
hrtime([bool $get_as_number=FALSE]): mixedReturns the system's high resolution time, counted from an arbitrary point in time. The delivered timestamp is monotonic and can not be adjusted.
参数
$get_as_numberWhether the high resolution time should be returned asarrayor number.
返回值
Returns an array of integers in the form [seconds, nanoseconds], if the parameter$get_as_numberis false. Otherwise the nanoseconds are returned asinteger(64bit platforms)orfloat(32bit platforms).
范例
Example #1hrtime()usage
以上例程的输出类似于:
10444739687370679 Array ( [0] => 10444739 [1] => 687464812 )
参见
- TheHigh resolution timingextension
This function is particularly necessary on VMs running on KVM, XEN (openstack, AWS EC2, etc) when timing execution times. On these platforms which lack vDSO the common method of using time() or microtime() can dramatically increase CPU/execution time due to the context switching from userland to kernel when running the `gettimeofday()` system call. The common pattern is: Substituted as: There is also the new StopWatch class http://php.net/manual/en/class.hrtime-stopwatch.php
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!