https://github.com/php/pecl-datetime-hrtime
High resolution timing
https://github.com/php/pecl-datetime-hrtime
Last synced: about 2 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 (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T10:06:58.000Z (about 5 years ago)
- Last Synced: 2025-10-04T04:45:39.344Z (7 months ago)
- Language: C
- Size: 20.5 KB
- Stars: 6
- Watchers: 8
- Forks: 2
- Open Issues: 1
-
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);
```