Calculate file download time

zhaozj2021-02-16  123

<%

Function DownloadTime (intFilesize, strmodemtype)

DIM TimeInseconds, ModemSpeed, StrdownloadTime, Appendstring

Dim Intyears, Intweeks, INTDAYS

DIM INTHOURS, INTMINUTES, INTSECONDS

Inteyears = 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 ((TimeInseconds / 604800) MOD 52) <> 0) THEN INTWEEKS = INT (TimeInseconds / 604800) MOD 52

IF ((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 TEN 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 THENIF INTDAYS = 1 TEN 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 (INTYEEKS = 0) and (intWeeks = 0) and (inthaours = 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

%>

IT is going to take it

<% = DownloadTime (123456, Cable)%> To Download this file.

转载请注明原文地址:https://www.9cbs.com/read-8328.html

New Post(0)