added optional frame correction to time_to_frames