Author: Amaury Forgeot d'Arc <[email protected]>
Branch: kill_ll_time
Changeset: r75288:7a213190810b
Date: 2015-01-10 17:29 +0100
http://bitbucket.org/pypy/pypy/changeset/7a213190810b/

Log:    Finally kill ll_time.py, move tests to rlib/

diff --git a/rpython/rtyper/module/test/test_ll_time.py 
b/rpython/rlib/test/test_rtime.py
rename from rpython/rtyper/module/test/test_ll_time.py
rename to rpython/rlib/test/test_rtime.py
diff --git a/rpython/rtyper/extfuncregistry.py 
b/rpython/rtyper/extfuncregistry.py
--- a/rpython/rtyper/extfuncregistry.py
+++ b/rpython/rtyper/extfuncregistry.py
@@ -12,7 +12,6 @@
 import math
 from rpython.rtyper.lltypesystem.module import ll_math
 from rpython.rtyper.module import ll_os
-from rpython.rtyper.module import ll_time
 from rpython.rlib import rfloat
 
 # the following functions all take one float, return one float
diff --git a/rpython/rtyper/module/ll_time.py b/rpython/rtyper/module/ll_time.py
deleted file mode 100644
--- a/rpython/rtyper/module/ll_time.py
+++ /dev/null
@@ -1,86 +0,0 @@
-"""
-Low-level implementations for the external functions of the 'time' module.
-"""
-
-import time, sys, math
-from errno import EINTR
-from rpython.rtyper.lltypesystem import rffi
-from rpython.rtyper.tool import rffi_platform as platform
-from rpython.rtyper.lltypesystem import lltype
-from rpython.rtyper.extfunc import BaseLazyRegistering, registering, extdef
-from rpython.rlib import rposix
-from rpython.rlib.rarithmetic import intmask, UINT_MAX
-from rpython.translator.tool.cbuild import ExternalCompilationInfo
-
-if sys.platform == 'win32':
-    TIME_H = 'time.h'
-    FTIME = '_ftime64'
-    STRUCT_TIMEB = 'struct __timeb64'
-    includes = ['winsock2.h', 'windows.h',
-                TIME_H, 'sys/types.h', 'sys/timeb.h']
-    need_rusage = False
-else:
-    TIME_H = 'sys/time.h'
-    FTIME = 'ftime'
-    STRUCT_TIMEB = 'struct timeb'
-    includes = [TIME_H, 'time.h', 'errno.h', 'sys/select.h',
-                'sys/types.h', 'unistd.h',
-                'sys/time.h', 'sys/resource.h']
-
-    if not sys.platform.startswith("openbsd"):
-        includes.append('sys/timeb.h')
-
-    need_rusage = True
-
-
-class CConfig:
-    _compilation_info_ = ExternalCompilationInfo(
-        includes=includes
-    )
-    TIMEVAL = platform.Struct('struct timeval', [('tv_sec', rffi.INT),
-                                                 ('tv_usec', rffi.INT)])
-    HAVE_GETTIMEOFDAY = platform.Has('gettimeofday')
-    HAVE_FTIME = platform.Has(FTIME)
-    if need_rusage:
-        RUSAGE = platform.Struct('struct rusage', [('ru_utime', TIMEVAL),
-                                                   ('ru_stime', TIMEVAL)])
-
-if sys.platform.startswith('freebsd') or sys.platform.startswith('netbsd'):
-    libraries = ['compat']
-elif sys.platform == 'linux2':
-    libraries = ['rt']
-else:
-    libraries = []
-
-class CConfigForFTime:
-    _compilation_info_ = ExternalCompilationInfo(
-        includes=[TIME_H, 'sys/timeb.h'],
-        libraries=libraries
-    )
-    TIMEB = platform.Struct(STRUCT_TIMEB, [('time', rffi.INT),
-                                           ('millitm', rffi.INT)])
-
-class CConfigForClockGetTime:
-    _compilation_info_ = ExternalCompilationInfo(
-        includes=['time.h'],
-        libraries=libraries
-    )
-    TIMESPEC = platform.Struct('struct timespec', [('tv_sec', rffi.LONG),
-                                                   ('tv_nsec', rffi.LONG)])
-
-constant_names = ['RUSAGE_SELF', 'EINTR', 'CLOCK_PROCESS_CPUTIME_ID']
-for const in constant_names:
-    setattr(CConfig, const, platform.DefinedConstantInteger(const))
-defs_names = ['GETTIMEOFDAY_NO_TZ']
-for const in defs_names:
-    setattr(CConfig, const, platform.Defined(const))
-
-def decode_timeval(t):
-    return (float(rffi.getintfield(t, 'c_tv_sec')) +
-            float(rffi.getintfield(t, 'c_tv_usec')) * 0.000001)
-
-class RegisterTime(BaseLazyRegistering):
-    def __init__(self):
-        self.configure(CConfig)
-        self.TIMEVALP = lltype.Ptr(self.TIMEVAL)
-
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to