<%
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)
' 准确地说,1年=365.25天.
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
strdownloadtime = strdownloadtime & intyears & "年" & appendstring & ", "
end if
if intweeks <> 0 then
strdownloadtime = strdownloadtime & intweeks & "周" & appendstring & ", "
end if
if intdays <> 0 then
strdownloadtime = strdownloadtime & intdays & "日" & appendstring & ", "
end if
if inthours <> 0 then
strdownloadtime = strdownloadtime & inthours & "小时" & appendstring & ", "
end if
if intminutes <> 0 then
strdownloadtime = strdownloadtime & intminutes & "分" & appendstring
end if
if ((intyears = 0) and (intweeks = 0) and (intdays = 0) and (inthours = 0)) then
if intminutes > 0 then
strdownloadtime = strdownloadtime & ", " & intseconds & "秒" & appendstring
else
strdownloadtime = strdownloadtime & intseconds & "秒" & appendstring
end if
end if
downloadtime = strdownloadtime
end function
%>
<html>
<body>
撼雪喷云提示:您下载这个文件一共花费了<%=downloadtime(123456,cable)%>.
</body></html>
[1]
发表评论