计算文件的下载时间
<STRONG><FONT color=red><%<BR>Function DownloadTime(intFileSize, strModemType)<BR>Dim TimeInSeconds, ModemSpeed, strDownloadTime, AppendString<BR>Dim intYears, intWeeks, intDays<BR>Dim intHours, intMinutes, intSeconds<BR>intYears = 0<BR>intWeeks = 0<BR>intDays = 0<BR>intHours = 0<BR>intMinutes = 0<BR>intSeconds = 0<BR>strDownloadTime = ""<BR>Select Case strModemType<BR>Case "Cable"<BR>ModemSpeed = 400000<BR>Case "56kbps"<BR>ModemSpeed = 7000<BR>Case "33.6kbps"<BR>ModemSpeed = 4200<BR>Case "28.8kbps"<BR>ModemSpeed = 3600<BR>End Select<BR>TimeInSeconds = int(intFileSize / ModemSpeed)<BR>'year maths added 1/4 of a day. 1 exact orbit of the sub is 365.25 days.<BR>If (Int(TimeInSeconds / 31471200) <> 0) Then intYears = Int(TimeInSeconds / 31449600)<BR>If ((Int(TimeInSeconds / 604800) Mod 52) <> 0) Then intWeeks = Int(TimeInSeconds / 604800) Mod 52<BR>If ((Int(TimeInSeconds / 86400) Mod 7) <> 0) Then intDays = Int(TimeInSeconds / 86400) Mod 7<BR>If TimeInSeconds >= 3600 Then intHours = Int(TimeInSeconds / 3600) Mod 24<BR>If TimeInSeconds >= 60 Then intMinutes = Int(TimeInSeconds / 60) Mod 60<BR>If TimeInSeconds >= 0 Then intSeconds = Int(TimeInSeconds) Mod 60<BR>If intYears <> 0 Then<BR>If intYears = 1 Then AppendString = "" Else AppendString = "s"<BR>strDownloadTime = strDownloadTime & intYears & " year" & AppendString & ", "<BR>End If<BR>If intWeeks <> 0 Then<BR>If intWeeks = 1 Then AppendString = "" Else AppendString = "s"<BR>strDownloadTime = strDownloadTime & intWeeks & " week" & AppendString & ", "<BR>End If<BR>If intDays <> 0 Then<BR>If intDays = 1 Then AppendString = "" Else AppendString = "s"<BR>strDownloadTime = strDownloadTime & intDays & " day" & AppendString & ", "<BR>End If<BR>If intHours <> 0 Then<BR>If intHours = 1 Then AppendString = "" Else AppendString = "s"<BR>strDownloadTime = strDownloadTime & intHours & " hour" & AppendString & ", "<BR>End If<BR>If intMinutes <> 0 Then<BR>If intMinutes = 1 Then AppendString = "" Else AppendString = "s"<BR>strDownloadTime = strDownloadTime & intMinutes & " minute" & AppendString<BR>End If<BR>If ((intYears = 0) And (intWeeks = 0) And (intDays = 0) And (intHours = 0)) Then<BR>If intSeconds = 1 Then AppendString = "" Else AppendString = "s"<BR>If intMinutes > 0 Then<BR>strDownloadTime = strDownloadTime & ", " & intSeconds & " second" & AppendString<BR>Else<BR>strDownloadTime = strDownloadTime & intSeconds & " second" & AppendString<BR>End If<BR>End If<BR>DownloadTime = strDownloadTime<BR>End Function<BR>%><BR><html><BR><body><BR>It is going to take about<BR><%=DownloadTime(1*1024*1024,"56kbps")%> to download this file.<BR></body><BR></html> </FONT></STRONG>页:
[1]