56 lines
1.2 KiB
Plaintext
56 lines
1.2 KiB
Plaintext
EnableExplicit
|
|
|
|
Procedure.s ConvertSeconds(NbSeconds)
|
|
Protected weeks, days, hours, minutes, seconds
|
|
Protected divisor, remainder
|
|
Protected duration$ = ""
|
|
divisor = 7 * 24 * 60 * 60 ; seconds in a week
|
|
weeks = NbSeconds / divisor
|
|
remainder = NbSeconds % divisor
|
|
divisor / 7 ; seconds in a day
|
|
days = remainder / divisor
|
|
remainder % divisor
|
|
divisor / 24 ; seconds in an hour
|
|
hours = remainder / divisor
|
|
remainder % divisor
|
|
divisor / 60 ; seconds in a minute
|
|
minutes = remainder / divisor
|
|
seconds = remainder % divisor
|
|
|
|
If weeks > 0
|
|
duration$ + Str(weeks) + " wk, "
|
|
EndIf
|
|
|
|
If days > 0
|
|
duration$ + Str(days) + " d, "
|
|
EndIf
|
|
|
|
If hours > 0
|
|
duration$ + Str(hours) + " hr, "
|
|
EndIf
|
|
|
|
If minutes > 0
|
|
duration$ + Str(minutes) + " min, "
|
|
EndIf
|
|
|
|
If seconds > 0
|
|
duration$ + Str(seconds) + " sec"
|
|
EndIf
|
|
|
|
If Right(duration$, 2) = ", "
|
|
duration$ = Mid(duration$, 0, Len(duration$) - 2)
|
|
EndIf
|
|
|
|
ProcedureReturn duration$
|
|
EndProcedure
|
|
|
|
If OpenConsole()
|
|
PrintN(ConvertSeconds(7259))
|
|
PrintN(ConvertSeconds(86400))
|
|
PrintN(ConvertSeconds(6000000))
|
|
PrintN("")
|
|
PrintN("Press any key to close the console")
|
|
Repeat: Delay(10) : Until Inkey() <> ""
|
|
CloseConsole()
|
|
EndIf
|