计算剩余时间 [英] Calculate Time Remaining

查看:167
本文介绍了计算剩余时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是好的算法来确定的东西来完成余下的时间呢?我知道一共有多少行有,又有多少已经完成了,我应该怎么估计剩余时间?

What's a good algorithm for determining the remaining time for something to complete? I know how many total lines there are, and how many have completed already, how should I estimate the time remaining?

推荐答案

为什么不呢?

<打击> (linesProcessed / TimeTaken) (timetaken / linesProcessed)* LinesLeft =的timeleft

的timeleft 届时将pssed在EX $ P $任何单位时间 timeTaken

TimeLeft will then be expressed in whatever unit of time timeTaken is.

感谢您的评论,你说的没错,这应该是:

Thanks for the comment you're right this should be:

(TimeTaken / linesProcessed)* linesLeft =的timeleft

所以我们有

(10/100)* 200 = 20秒,现在10秒晃过
(20/100)* 200 = 40秒,现在剩下10多秒,我们处理100多行
(30/200)* 100 = 15秒,现在大家都明白为什么复制文件对话框从3小时跳跃到30分钟:-)

(10 / 100) * 200 = 20 Seconds now 10 seconds go past
(20 / 100) * 200 = 40 Seconds left now 10 more seconds and we process 100 more lines
(30 / 200) * 100 = 15 Seconds and now we all see why the copy file dialog jumps from 3 hours to 30 minutes :-)

这篇关于计算剩余时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆