diff unix.py @ 85:741ae3391b61

Moved clock/time detection into platform-specific modules and testcases
author Oleg Oshmyan <chortos@inbox.lv>
date Thu, 24 Feb 2011 23:59:48 +0000
parents 06356af50bf9
children 8cd7a732f2f3
line wrap: on
line diff
--- a/unix.py	Thu Feb 24 00:29:32 2011 +0000
+++ b/unix.py	Thu Feb 24 23:59:48 2011 +0000
@@ -10,17 +10,24 @@
 	import __main__
 	__main__.import_error(sys.exc_info()[1])
 
-from __main__ import clock
 from subprocess import Popen
 import os, sys
 
 try:
+	from testcases import clock
+except ImportError:
+	if sys.platform.startswith('java'):
+		from time import clock
+	else:
+		from time import time as clock
+
+try:
 	from signal import SIGTERM, SIGKILL
 except ImportError:
 	SIGTERM = 15
 	SIGKILL = 9
 
-__all__ = 'call', 'kill', 'terminate', 'pause'
+__all__ = 'call', 'kill', 'terminate', 'pause', 'clock'
 
 
 if not sys.stdin.isatty():