REWRITE timetools.py