primus852/simple-stopwatch

PHP 简单计时器

安装: 111

依赖: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

开放问题: 0

类型:package

1.0.1 2020-02-11 09:43 UTC

This package is auto-updated.

Last update: 2024-09-11 19:46:16 UTC


README

PHP 简单计时器工具

用法

启动计时器

$start = StopWatch::start();

默认输出

$start = StopWatch::start();
sleep(3); // Sleep 3 seconds for testing
$end = Stopwatch::stop($start);
echo 'Elapsed: '.$end; //Elapsed: 0 hours, 0 minutes and 3 seconds

指定输出格式

$start = StopWatch::start();
sleep(3); // Sleep 3 seconds for testing
$end = Stopwatch::stop($start, true, 's');
echo 'Elapsed Seconds: '.$end; //Elapsed Seconds: 3

获取包括微秒在内的当前时间戳

$current = StopWatch::current();
echo $current; //2018-10-04 10:37:30.271700