Ok i had to set more LONG variables

by (no login)

DECLARE SUB DELAY (srt$, lag%)

TYPE srttime
hr AS LONG
mn AS LONG
sc AS LONG
msc AS INTEGER
END TYPE

DIM SHARED subt(2) AS srttime
DIM SHARED srt(2) AS STRING
DIM SHARED srtmsc(2) AS LONG

srt$ = "00:03:32,700 --> 00:03:35,603"

CLS

CALL DELAY(srt$, lag%)

END

ERRORHANDLE:
PRINT "ERROR"
RESUME NEXT


'////////////////// SUB /////////////////

SUB DELAY (srt$, lag%)

'parse the string

c% = INSTR(srt$, "-->")
srt(1) = LEFT$(srt$, c% - 2)
srt(2) = RIGHT$(srt$, LEN(srt$) - (c% + 3))


FOR i = 1 TO 2

subt(i).hr = VAL(LEFT$(srt(i), 2))
subt(i).mn = VAL(MID$(srt(i), 4, 2))
subt(i).sc = VAL(MID$(srt(i), 7, 2))
subt(i).msc = VAL(MID$(srt(i), 10, 3))

NEXT i

'converto to milisec :

ON ERROR GOTO ERRORHANDLE

FOR i = 1 TO 2

srtmsc(i) = subt(i).msc + (subt(i).sc + subt(i).mn * 60 + subt(i).hr * 3600) * 1000

PRINT srtmsc(i)

NEXT i


END SUB

Posted on May 28, 2012, 12:14 PM

Respond to this message   

Return to Index