Yes there is a little bit of maths behind, I'll include some additional explanation to make the maths more understandable/clear:
Frame rate is frame per second, so 1/frame_rate is seconds per (or between) frames. So a 60 fps rate has 1/60=0.0167 seconds between frames.
Now you can set the speed gain (to speed up out timelapse), which basically increases the seconds between frames by the specified ratio. So having a speed gain of 60, speeds up your timelapse by 60. And thus increases the time between screenshots by 60 as well: 0.0167 * 60 = 1 second between frames.
In formula form: time_between_screenshots = speed_gain / frame_rate
PS Which is exactly what the mod is using here: https://github.com/veger/TLBE/blob/2dc75a993dfa8f7082abd4c984419997453d2bef/scripts/camera.lua#L100
(minus the ticks per second as the game works with ticks not seconds)