~ubuntu-branches/ubuntu/karmic/pypy/karmic

« back to all changes in this revision

Viewing changes to pypy/translator/pyrex/Pyrex/Plex/Timing.py

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2007-04-13 09:33:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070413093309-yoojh4jcoocu2krz
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

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