如何计算下载一个文件需要多长时间?

2023-12-05 0 542

<%Function DownloadTime(intFileSize, strModemType)Dim TimeInSeconds, ModemSpeed, strDownloadTime, AppendStringDim intYears, intWeeks, intDaysDim intHours, intMinutes, intSecondsintYears = 0intWeeks = 0intDays = 0intHours = 0intMinutes = 0intSeconds = 0strDownloadTime = \”\”Select Case strModemTypeCase \”Cable\” ModemSpeed = 400000Case \”56kbps\” ModemSpeed = 7000Case \”33.6kbps\” ModemSpeed = 4200Case \”28.8kbps\” ModemSpeed = 3600End SelectTimeInSeconds = 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 52If ((Int(TimeInSeconds / 86400) Mod 7) <> 0) Then intDays = Int(TimeInSeconds / 86400) Mod 7If TimeInSeconds >= 3600 Then intHours = Int(TimeInSeconds / 3600) Mod 24If TimeInSeconds >= 60 Then intMinutes = Int(TimeInSeconds / 60) Mod 60If TimeInSeconds >= 0 Then intSeconds = Int(TimeInSeconds) Mod 60If intYears <> 0 Then strDownloadTime = strDownloadTime & intYears & \”\” & AppendString & \”, \”End IfIf intWeeks <> 0 Then strDownloadTime = strDownloadTime & intWeeks & \”\” & AppendString & \”, \”End IfIf intDays <> 0 Then strDownloadTime = strDownloadTime & intDays & \”\” & AppendString & \”, \”End IfIf intHours <> 0 Then strDownloadTime = strDownloadTime & intHours & \”小时\” & AppendString & \”, \”End IfIf intMinutes <> 0 Then strDownloadTime = strDownloadTime & intMinutes & \”\” & AppendStringEnd IfIf ((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 IfEnd IfDownloadTime = strDownloadTimeEnd Function%><html><body>撼雪喷云提示:您下载这个文件一共花费了<%=DownloadTime(123456,Cable)%>.</body></html>

[1]

您可能感兴趣的文章:

  • javascript实现的距离现在多长时间后的一个格式化的日期
  • 将时间以距今多久的形式表示,PHP,js双版本
  • win2003或linux服务器一般多久重启一次
  • php实现用已经过去多长时间的方式显示时间
  • 常见浏览器多长时间会提示“脚本运行时间过长”总结
  • 查看 MySQL 已经运行多长时间的方法
  • 离22周岁距离多长时间的计算[适合没到22周岁的朋友]
  • iOS计算上次日期距离现在多久的代码

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 编程10000问 如何计算下载一个文件需要多长时间? https://www.u-9.cn/biancheng/bc10000/96546.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务