getClockTime returns the current amount of real (clock) time accumulated by this stop_watch. If the stop_watch is stopped, this is just the total accumulated time. If the stop_watch is running, this is the accumulated time + the time since the stop_watch was last started.
| 136 | //the total accumulated time. If the stop_watch is running, this is the |
| 137 | //accumulated time + the time since the stop_watch was last started. |
| 138 | double StopWatch::getClockTime() const |
| 139 | { |
| 140 | if (is_running_ == false) |
| 141 | { |
| 142 | /* stop_watch is currently off, so just return accumulated time */ |
| 143 | return accumulated_times_.clockTime(); |
| 144 | } |
| 145 | |
| 146 | /* stop_watch is currently running, so add the elapsed time since */ |
| 147 | /* the stop_watch was last started to the accumulated time */ |
| 148 | auto now = snapShot_(); |
| 149 | auto diff = now - last_start_; |
| 150 | |
| 151 | /* convert into floating point number of seconds */ |
| 152 | return accumulated_times_.clockTime() + diff.clockTime(); |
| 153 | } |
| 154 | |
| 155 | //getUserTime reports the current amount of user cpu time |
| 156 | //accumulated by this StopWatch. If the stop_watch is currently off, |
no test coverage detected