Skip to content

Make it possible to not stop a stopwatch but read out the current time process #10175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dawehner opened this issue Feb 1, 2014 · 3 comments
Closed
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) Stopwatch

Comments

@dawehner
Copy link
Contributor

dawehner commented Feb 1, 2014

If you look onto a real (physical) stopwatch you can read out the current passed time easy wiithout having the stop it.

The kind of obvious method would be $stopwatch->getDuration($name)

Related issue: https://drupal.org/node/1936640

@fabpot
Copy link
Member

fabpot commented Feb 1, 2014

@dawehner 👍 Should be easy enough to implement

@jochenvdv
Copy link
Contributor

@dawehner I have looked into this.

At the moment StopwatchEvent::getDuration() does not account for periods that are still running.
This needs to be implemented first before we can add a method to the Stopwatch class.

I have started working on this and will submit a pull request later.

fabpot added a commit that referenced this issue Feb 5, 2014
…alling stop() (jochenvdv)

This PR was merged into the 2.5-dev branch.

Discussion
----------

[Stopwatch] Allow getting duration of events without calling stop()

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | [#10175](#10175)
| License       | MIT
| Doc PR        | [#3539](symfony/symfony-docs#3539)

Commits
-------

2efe461 Allow retrieving unstopped stopwatch events
d3d097d Include running periods in duration
@fabpot fabpot closed this as completed Feb 5, 2014
@dawehner
Copy link
Contributor Author

dawehner commented Jul 2, 2014

@fabpot Would you still accept a PR which adds the proposed feature of $stopwatch->getDuration($name) instead of $stopwatch->getEvent($name)->getDuraction()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Ideal for your first contribution! (some Symfony experience may be required) Stopwatch
Projects
None yet
Development

No branches or pull requests

3 participants