Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Include Lap results AND Total Time #1

Merged
merged 2 commits into from

2 participants

@andyfleming

Include lap results as well as total time in array return from end() method.

Array
(
    [Laps] =>
        [0] => 1353195346.6762
        [1] => 1353195347.6763
        [2] => 1353195349.6764
    [Total] => 3.0002
)
@jsanc623 jsanc623 merged commit c9cb875 into jsanc623:master
@jsanc623
Owner

Thanks for this!

@andyfleming

No problem :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 5, 2012
  1. @andyfleming
  2. @andyfleming

    README update for laps

    andyfleming authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 7 deletions.
  1. +10 −6 README.md
  2. +5 −1 src/PHPBenchTime.php
View
16 README.md
@@ -90,9 +90,11 @@ Let's see the results:
```
Array
(
- [0] => 1353195346.6762
- [1] => 1353195347.6763
- [2] => 1353195349.6764
+ [Laps] =>
+ [0] => 1353195346.6762
+ [1] => 1353195347.6763
+ [2] => 1353195349.6764
+ [Total] => 3.0002
)
```
@@ -125,9 +127,11 @@ Let's see the result:
```
Array
(
- [Start] => 1353195603.1876
- [First Lap] => 1353195604.1877
- [Second Lap] => 1353195606.1878
+ [Laps] =>
+ [Start] => 1353195603.1876
+ [First Lap] => 1353195604.1877
+ [Second Lap] => 1353195606.1878
+ [Total] => 3.0002
)
```
View
6 src/PHPBenchTime.php
@@ -99,7 +99,11 @@ public function __construct(){}
*/
public final function End(){
if(is_array($this->_startTime))
- return $this->_startTime;
+ return array(
+ 'Laps' => $this->_startTime,
+ 'Total' => round(($this->_CurrentTimeFloat() - $this->_startTime[0]), 4)
+ );
+
else {
return array(
'Start' => $this->_startTime,
Something went wrong with that request. Please try again.