+-- proportions
+function proportion(x,y,a,b)
+ local rc
+ if x == "x" then
+ rc = y * a / b
+ elseif y == "x" then
+ rc = x * b / a
+ elseif a == "x" then
+ rc = x * b / y
+ elseif b == "x" then
+ rc = y * a / x
+ end
+ return string.format("%d",rc)
+end
+
+-- conversion from the old db to the new one
+function convertsql(file)
+ local f = io.open(file)
+ return string.gsub(f:read("*a"),time_re,
+ function(s)
+ return s2t(s)
+ end)
+end
+