Skip to content

Instantly share code, notes, and snippets.

@julik
Created August 30, 2009 16:02
Show Gist options
  • Save julik/178018 to your computer and use it in GitHub Desktop.
Save julik/178018 to your computer and use it in GitHub Desktop.
require 'timecode'
tc = Timecode.parse("00:00:10:12", fps = 25)
tc.total #=> 262 total frames
plus_ten_hours = tc + Timecode.parse("10h", fps = 25)
plus_ten_hours #=> 10:00:10:12, one hour later
divided_by_ten = plus_ten_hours / 10
divided_by_ten #=> 01:00:01:01, one tenth
clip = (Timecode.parse("1h")..Timecode.parse("2h"))
clip.to_a.length #=> 90001 frames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment