accurate_time.py 598 B

12345678910111213141516171819202122
  1. '''This file is part of AToMPM - A Tool for Multi-Paradigm Modelling
  2. Copyright 2011 by the AToMPM team and licensed under the LGPL
  3. See COPYING.lesser and README.md in the root of this project for full details'''
  4. import time as t
  5. import os
  6. global start_time
  7. def set_start_time():
  8. global start_time
  9. if os.name == 'posix':
  10. start_time = t.time()
  11. elif os.name == 'nt':
  12. start_time = t.clock()
  13. if os.name == 'posix':
  14. def time():
  15. return int((t.time() - start_time) * 1000)
  16. elif os.name == 'nt':
  17. def time():
  18. return int((t.clock() - start_time) * 1000)