Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,64 @@
|
|||
INCLUDE "H6:REALMATH.ACT"
|
||||
DEFINE PTR="CARD"
|
||||
|
||||
TYPE Time=[BYTE s,m,h,d,w]
|
||||
CARD ARRAY units(5)
|
||||
|
||||
PROC Convert(REAL POINTER seconds Time POINTER t)
|
||||
BYTE ARRAY b,duration=[60 60 24 7]
|
||||
BYTE i
|
||||
REAL r,n
|
||||
|
||||
b=t
|
||||
FOR i=0 TO 3
|
||||
DO
|
||||
IntToReal(duration(i),n)
|
||||
RealMod(seconds,n,r)
|
||||
b(i)=RealToInt(r)
|
||||
RealDivInt(seconds,n,r)
|
||||
RealAssign(r,seconds)
|
||||
OD
|
||||
b(4)=RealToInt(seconds)
|
||||
RETURN
|
||||
|
||||
PROC PrintTime(Time POINTER t)
|
||||
INT i
|
||||
BYTE first,n
|
||||
BYTE ARRAY b
|
||||
|
||||
b=t i=4 first=1
|
||||
WHILE i>=0
|
||||
DO
|
||||
n=b(i)
|
||||
IF n>0 THEN
|
||||
IF first=0 THEN
|
||||
Print(", ")
|
||||
ELSE
|
||||
first=0
|
||||
FI
|
||||
PrintF("%B %S",n,units(i))
|
||||
FI
|
||||
i==-1
|
||||
OD
|
||||
RETURN
|
||||
|
||||
PROC Test(CHAR ARRAY s)
|
||||
REAL seconds
|
||||
Time t
|
||||
|
||||
ValR(s,seconds)
|
||||
PrintR(seconds) Print(" -> ")
|
||||
Convert(seconds,t)
|
||||
PrintTime(t) PutE()
|
||||
RETURN
|
||||
|
||||
PROC Main()
|
||||
Put(125) PutE() ;clear the screen
|
||||
MathInit()
|
||||
units(0)="sec" units(1)="min"
|
||||
units(2)="hr" units(3)="d"
|
||||
units(4)="wk"
|
||||
Test("7259")
|
||||
Test("86400")
|
||||
Test("6000000")
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue