Port better timing code from ioq3
Merge branch 'master' into librocket