TV96 is just TV expressed in 96ths (Internally the camera uses TV96 instead of TV so that fractional TVs are possible without floating point Math)
TV96=TV*96
To convert to seconds, remember that:
1) Tv 0 is equivalent to 1 second
2) Increasing TV by 1 halves the shutter time.
Tv sec
0 1
1 0.5
2 0.25
and vice-versa
Tv sec
0 1
-1 2
-2 4
If you have floating point math you can do:
ShutterTime = 2^-TV
Or
ShutterTime = 2^-(TV96 / 96)
My loop is a trick to approximate this with integer math.
First consideration: instead of working in 1/96th of Tv, I approximate and work in 1/8th of Tv.
Second consideration: 1.091 ^ 8 = 2 (MAGIC NUMBER!!)
Third consideration: countsec is expressed in 1/1000th of seconds (again, to simulate decimals with integer math)
My code just starts at TV 0 and shutter time of 1 second, then increases Tv in steps of 1/8th every time multiplying shutter time by 1.091, until the Tv gets to your Tv.
In that moment countsec will have the approximate equivalent of your Tv in 1/1000th of a second
commented snppet.
-- Start at Tv 0
local tv96=0
-- The time i want to convert, expressed in milliseconds
local sec1000=sec*1000
-- my "counter", in milleseconds. Start from 1 second
local countsec=1000
-- loop until countsec gets to the time I wanted to convert
while countsec<sec1000 do
-- every time multimplying countsec by 1.091
countsec=(countsec*1091)/1000
-- and increasing my Tv of 1/8th of a Tv
tv96=tv96-12
end
-- After looping, tv will have our time converted
return tv96
end
Think about the table above:
Tv sec
0 1
-1 2
-2 4
But we work in tv/96 and sec/1000
Tv sec
0 1000
-96 2000
-192 4000
My program iteratively goes through a similar table, only instead of doing
tv96=tv96-96
countsec=countsec*2
we go in smaller steps to have some more precision, in steps that are about 8 times smaller:
tv96=tv96-12 (12*8=96)
countsec=countsec*1.091 (1.091 ^ 8=2)
it's like having this conversion table from tv96 to msecs:
Tv96 msec
0 1000
-12 1091
-24 1190
-36 1299
-48 1417
-60 1546
-72 1686
-84 1840
-96 2007
-108 2190
-120 2389
-132 2607
-144 2844
-156 3103
-168 3385
-180 3693
-192 4029
follow the Tv96 column until you get to your value: the msec column has the equivalent shutter time.
As you see, it's anyway approximate because the value of -96 is 2007 (not 2000) and for -192 it's 4029, not 4000
I hope I made it clearer. If not, I blame the fever :-)