TestTimer.php 839 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Link : http://www.phpcorner.net
  4. * User : qingbing<780042175@qq.com>
  5. * Date : 2018-10-28
  6. * Version : 1.0
  7. */
  8. namespace Test;
  9. use Helper\Timer;
  10. use TestCore\Tester;
  11. class TestTimer extends Tester
  12. {
  13. /**
  14. * 执行函数
  15. * @throws \Helper\Exception
  16. */
  17. public function run()
  18. {
  19. // 获取当前的时间戳,时间格式,最多6为小数
  20. $timestamp = Timer::microTime();
  21. var_dump($timestamp);
  22. // 获取当前的时间戳,浮点格式,最多6为小数
  23. $timestamp = Timer::microTime(false);
  24. var_dump($timestamp);
  25. /**
  26. * timer 时间栈的用法
  27. */
  28. // 开始
  29. Timer::begin('app');
  30. // coding here.
  31. $much = Timer::end('app');
  32. var_dump($much);
  33. }
  34. }