计算文件的下载时间
2008-02-23 09:27:38来源:互联网 阅读 ()
<% 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> |
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:随机产生用户密码
下一篇:实现网页密码验证的两个基本方法
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash