primus852 / simple-stopwatch
PHP 简单计时器
1.0.1
2020-02-11 09:43 UTC
Requires
- php: ^7.0
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