Staging
v0.5.1
https://github.com/python/cpython
Revision cb29f0177c91ebb739b89d8cc4ba223785c94d61 authored by Victor Stinner on 27 March 2015, 12:31:18 UTC, committed by Victor Stinner on 27 March 2015, 12:31:18 UTC
In practice, _PyTime_t is a number of nanoseconds. Its C type is a 64-bit
signed number. It's integer value is in the range [-2^63; 2^63-1]. In seconds,
the range is around [-292 years; +292 years]. In term of Epoch timestamp
(1970-01-01), it can store a date between 1677-09-21 and 2262-04-11.

The API has a resolution of 1 nanosecond and use integer number. With a
resolution on 1 nanosecond, 64-bit IEEE 754 floating point numbers loose
precision after 194 days. It's not the case with this API. The drawback is
overflow for values outside [-2^63; 2^63-1], but these values are unlikely for
most Python modules, except of the datetime module.

New functions:

- _PyTime_GetMonotonicClock()
- _PyTime_FromObject()
- _PyTime_AsMilliseconds()
- _PyTime_AsTimeval()

This change uses these new functions in time.sleep() to avoid rounding issues.

The new API will be extended step by step, and the old API will be removed step
by step. Currently, some code is duplicated just to be able to move
incrementally, instead of pushing a large change at once.
1 parent a766ddf
History
Tip revision: cb29f0177c91ebb739b89d8cc4ba223785c94d61 authored by Victor Stinner on 27 March 2015, 12:31:18 UTC
Issue #22117: Add a new Python timestamp format _PyTime_t to pytime.h
Tip revision: cb29f01
File Mode Size
clinic
Python-ast.c -rw-r--r-- 224.3 KB
README -rw-r--r-- 62 bytes
_warnings.c -rw-r--r-- 30.7 KB
asdl.c -rw-r--r-- 1.4 KB
ast.c -rw-r--r-- 117.4 KB
bltinmodule.c -rw-r--r-- 96.2 KB
ceval.c -rw-r--r-- 149.3 KB
ceval_gil.h -rw-r--r-- 8.9 KB
codecs.c -rw-r--r-- 45.1 KB
compile.c -rw-r--r-- 125.0 KB
condvar.h -rw-r--r-- 11.0 KB
dtoa.c -rw-r--r-- 81.3 KB
dup2.c -rw-r--r-- 705 bytes
dynamic_annotations.c -rw-r--r-- 6.6 KB
dynload_aix.c -rw-r--r-- 5.6 KB
dynload_dl.c -rw-r--r-- 509 bytes
dynload_hpux.c -rw-r--r-- 1.8 KB
dynload_next.c -rw-r--r-- 3.8 KB
dynload_shlib.c -rw-r--r-- 3.3 KB
dynload_stub.c -rw-r--r-- 186 bytes
dynload_win.c -rw-r--r-- 9.9 KB
errors.c -rw-r--r-- 30.7 KB
fileutils.c -rw-r--r-- 42.2 KB
formatter_unicode.c -rw-r--r-- 49.0 KB
frozen.c -rw-r--r-- 1.6 KB
frozenmain.c -rw-r--r-- 2.7 KB
future.c -rw-r--r-- 4.6 KB
getargs.c -rw-r--r-- 53.6 KB
getcompiler.c -rw-r--r-- 366 bytes
getcopyright.c -rw-r--r-- 511 bytes
getopt.c -rw-r--r-- 3.4 KB
getplatform.c -rw-r--r-- 130 bytes
getversion.c -rw-r--r-- 289 bytes
graminit.c -rw-r--r-- 41.4 KB
import.c -rw-r--r-- 56.8 KB
importdl.c -rw-r--r-- 3.6 KB
importdl.h -rw-r--r-- 544 bytes
importlib.h -rw-r--r-- 221.9 KB
makeopcodetargets.py -rwxr-xr-x 1.2 KB
marshal.c -rw-r--r-- 49.0 KB
modsupport.c -rw-r--r-- 14.1 KB
mysnprintf.c -rw-r--r-- 3.3 KB
mystrtoul.c -rw-r--r-- 8.1 KB
opcode_targets.h -rw-r--r-- 6.2 KB
peephole.c -rw-r--r-- 25.0 KB
pyarena.c -rw-r--r-- 5.5 KB
pyctype.c -rw-r--r-- 7.7 KB
pyfpe.c -rw-r--r-- 621 bytes
pyhash.c -rw-r--r-- 13.0 KB
pylifecycle.c -rw-r--r-- 43.2 KB
pymath.c -rw-r--r-- 1.5 KB
pystate.c -rw-r--r-- 25.7 KB
pystrcmp.c -rw-r--r-- 613 bytes
pystrtod.c -rw-r--r-- 38.2 KB
pythonrun.c -rw-r--r-- 41.3 KB
pytime.c -rw-r--r-- 17.7 KB
random.c -rw-r--r-- 10.1 KB
sigcheck.c -rw-r--r-- 529 bytes
strdup.c -rw-r--r-- 247 bytes
structmember.c -rw-r--r-- 8.7 KB
symtable.c -rw-r--r-- 55.5 KB
sysmodule.c -rw-r--r-- 63.0 KB
thread.c -rw-r--r-- 12.4 KB
thread_foobar.h -rw-r--r-- 2.2 KB
thread_nt.h -rw-r--r-- 10.3 KB
thread_pthread.h -rw-r--r-- 17.4 KB
traceback.c -rw-r--r-- 18.5 KB

README

back to top