内容简介:如何计算下载一个文件需要多长时间?
<%
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]
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 我们为什么需要 lock 文件
- Flex AIR 重启需要修改的配置文件
- 对付无文件攻击,你的主机需要猎鹰保护!
- angular6根据environments配置文件更改开发所需要的环境
- 项目文件中的已知 NuGet 属性(使用这些属性,创建 NuGet 包就可以不需要 nuspec 文件啦)
- 云计算也需要维护 SDN也需要网工 只不过更智能了
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
URL 编码/解码
URL 编码/解码
html转js在线工具
html转js在线工具