欢迎光临
我们一直在努力

计算文件下载时间-ASP教程,ASP应用

建站超值云服务器,限时71元/月

<%

function downloadtime(intfilesize, strmodemtype)

dim timeinseconds, modemspeed, strdownloadtime, appendstring

dim intyears, intweeks, intdays

dim inthours, intminutes, intseconds

intyears = 0

intweeks = 0

intdays = 0

inthours = 0

intminutes = 0

intseconds = 0

strdownloadtime = ""

select case strmodemtype

case "cable"

modemspeed = 400000

case "56kbps"

modemspeed = 7000

case "33.6kbps"

modemspeed = 4200

case "28.8kbps"

modemspeed = 3600

end select

timeinseconds = int(intfilesize / modemspeed)

“year maths added 1/4 of a day. 1 exact orbit of the sub is 365.25 days.

if (int(timeinseconds / 31471200) <> 0) then intyears = int(timeinseconds / 31449600)

if ((int(timeinseconds / 604800) mod 52) <> 0) then intweeks = int(timeinseconds / 604800) mod 52

if ((int(timeinseconds / 86400) mod 7) <> 0) then intdays = int(timeinseconds / 86400) mod 7

if timeinseconds >= 3600 then inthours = int(timeinseconds / 3600) mod 24

if timeinseconds >= 60 then intminutes = int(timeinseconds / 60) mod 60

if timeinseconds >= 0 then intseconds = int(timeinseconds) mod 60

if intyears <> 0 then

if intyears = 1 then appendstring = "" else appendstring = "s"

strdownloadtime = strdownloadtime & intyears & " year" & appendstring & ", "

end if

if intweeks <> 0 then

if intweeks = 1 then appendstring = "" else appendstring = "s"

strdownloadtime = strdownloadtime & intweeks & " week" & appendstring & ", "

end if

if intdays <> 0 then

if intdays = 1 then appendstring = "" else appendstring = "s"

strdownloadtime = strdownloadtime & intdays & " day" & appendstring & ", "

end if

if inthours <> 0 then

if inthours = 1 then appendstring = "" else appendstring = "s"

strdownloadtime = strdownloadtime & inthours & " hour" & appendstring & ", "

end if

if intminutes <> 0 then

if intminutes = 1 then appendstring = "" else appendstring = "s"

strdownloadtime = strdownloadtime & intminutes & " minute" & appendstring

end if

if ((intyears = 0) and (intweeks = 0) and (intdays = 0) and (inthours = 0)) then

if intseconds = 1 then appendstring = "" else appendstring = "s"

if intminutes > 0 then

strdownloadtime = strdownloadtime & ", " & intseconds & " second" & appendstring

else

strdownloadtime = strdownloadtime & intseconds & " second" & appendstring

end if

end if

downloadtime = strdownloadtime

end function

%>

<html>

<body>

it is going to take about

<%=downloadtime(123456,cable)%> to download this file.

</body>

</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 计算文件下载时间-ASP教程,ASP应用
分享到: 更多 (0)

相关推荐

  • 暂无文章