1# 2# Get time in platform-dependent way 3# 4 5import os 6from sys import platform, exit, stderr 7 8if platform == 'mac': 9 import MacOS 10 def time(): 11 return MacOS.GetTicks() / 60.0 12 timekind = "real" 13elif hasattr(os, 'times'): 14 def time(): 15 t = os.times() 16 return t[0] + t[1] 17 timekind = "cpu" 18else: 19 stderr.write( 20 "Don't know how to get time on platform %s\n" % repr(platform)) 21 exit(1) 22 23