https://github.com/php/pecl-datetime-hrtime
High resolution timing
https://github.com/php/pecl-datetime-hrtime
Last synced: 5 months ago
JSON representation
High resolution timing
- Host: GitHub
- URL: https://github.com/php/pecl-datetime-hrtime
- Owner: php
- License: other
- Created: 2021-04-06T09:15:34.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T10:06:58.000Z (over 4 years ago)
- Last Synced: 2025-01-29T20:34:17.061Z (6 months ago)
- Language: C
- Size: 20.5 KB
- Stars: 5
- Watchers: 9
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# High resolution timer for PHP #
This PHP extension brings the possibility to use a high resolution timer from the user land PHP scripts. The best available APIs are used on differend platforms to achieve this goal.
## Synopsis ##
```php
$c = new HRTime\StopWatch;
$c->start();
/* do some interesting stuff*/
$c->stop();
$elapsed0 = $c->getLastElapsedTime(HRTime\Unit::NANOSECOND);/* do something else */
$c->start();
/* do some interesting stuff again */
$c->stop();
$elapsed1 = $c->getLastElapsedTime(HRTime\Unit::NANOSECOND);$elapsed_total = $c->getElapsedTime(HRTime\Unit::NANOSECOND);
```