Skip to content
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

timeRemaining should be 0 once done (Fix #503) #504

Merged
merged 1 commit into from Dec 2, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

timeRemaining should be 0 once done (Fix #503)

timeRemaining property should be 0 once a torrent has been downloaded (or is being seeded)
  • Loading branch information
DiegoRBaquero committed Dec 2, 2015
commit 16e44457fa5a5d8c84e80cbac9a5cbbb59f43c8f
@@ -94,6 +94,7 @@ function Torrent (torrentId, opts) {
// Time remaining (in milliseconds)
Object.defineProperty(Torrent.prototype, 'timeRemaining', {
get: function () {
if (this.done) return 0
if (this.swarm.downloadSpeed() === 0) return Infinity
else return ((this.length - this.downloaded) / this.swarm.downloadSpeed()) * 1000
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.