设为首页
联系站长
加入收藏

您的位置: 首页>>IT业界>>互联网>>正文
 ASP计算文件下载时间的程序
 日期:2005-6-14 22:32:22  来源:100down.com
<%
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>
相关文章

·关闭窗口时保存数据的办法
·用正则解析图片地址,并利用XMLHT
·实现搜索结果的关键词变色标注的
·关于处理GET方式提交的含有特殊字
·ASP判断Cookies是否处于开启状态
·NextRecordset 和 GetRows 双簧合
·ASP自动生成编号的方法
·Filter与updatebatch混合使用实现
·asp中利用数组实现数据库记录的批
·asp中通过getrows实现数据库记录


阅读排行

·Win 2000不能访问Win XP的原因及
·解析Windows中的帐户和权限功能
·如何共享Windows XP操作系统
·Windows XP Service Pack 1
·通过 Windows XP 注册表自定义您
·Windows 2000 TCP/IP协议概述
·Windows 2000 Server TCP/IP协议
·dos常用命令使用说明
·Windows变慢原因分析及解决方法(
·Windows变慢原因分析及解决方法(
·WINXP下强行关闭“杀”不了的进程
·Windows XP系统注册表的恢复

最新文档

·创业激情需冷静 网络代理选择应理
·域名交易平台亟需规范 预防域名买
·Travel旅游域名即将引发抢注潮 
·从原理深处分析如何预防arp攻击
·突破建站弊端 企业网络营销大有可
·如何区分进程和病毒?
·java的基础知识,如何学好java
·微机原理与接口技术基础知识
·如何解决青少年沉迷网络的问题,
·全面分析主板BIOS报警信号

请您注意:
·尊重网上道德,遵守中华人民共和国的各项有关法律法规
·您在本站发表的作品,本站有权在网站内转载或引用
·其他网站如果需要转载 本站文章请在贵站著名来源,谢谢合作