I know this patch is a pep8 change but... there is no need to cast time to int; the original version is more precise (and also quick).