Fix frame delay calculation so we don't hog the cpu