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