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
_bz2.vcxproj -rw-r--r-- 3.8 KB
_bz2.vcxproj.filters -rw-r--r-- 1.7 KB
_ctypes.vcxproj -rw-r--r-- 4.6 KB
_ctypes.vcxproj.filters -rw-r--r-- 2.3 KB
_ctypes_test.vcxproj -rw-r--r-- 3.0 KB
_ctypes_test.vcxproj.filters -rw-r--r-- 718 bytes
_decimal.vcxproj -rw-r--r-- 5.9 KB
_decimal.vcxproj.filters -rw-r--r-- 4.3 KB
_elementtree.vcxproj -rw-r--r-- 4.4 KB
_elementtree.vcxproj.filters -rw-r--r-- 2.5 KB
_freeze_importlib.vcxproj -rw-r--r-- 4.8 KB
_freeze_importlib.vcxproj.filters -rw-r--r-- 1.1 KB
_hashlib.vcxproj -rw-r--r-- 3.7 KB
_hashlib.vcxproj.filters -rw-r--r-- 436 bytes
_lzma.vcxproj -rw-r--r-- 3.7 KB
_lzma.vcxproj.filters -rw-r--r-- 435 bytes
_msi.vcxproj -rw-r--r-- 3.1 KB
_msi.vcxproj.filters -rw-r--r-- 423 bytes
_multiprocessing.vcxproj -rw-r--r-- 3.3 KB
_multiprocessing.vcxproj.filters -rw-r--r-- 861 bytes
_overlapped.vcxproj -rw-r--r-- 3.1 KB
_overlapped.vcxproj.filters -rw-r--r-- 434 bytes
_socket.vcxproj -rw-r--r-- 3.2 KB
_socket.vcxproj.filters -rw-r--r-- 702 bytes
_sqlite3.vcxproj -rw-r--r-- 4.5 KB
_sqlite3.vcxproj.filters -rw-r--r-- 2.4 KB
_ssl.vcxproj -rw-r--r-- 3.9 KB
_ssl.vcxproj.filters -rw-r--r-- 428 bytes
_testbuffer.vcxproj -rw-r--r-- 3.0 KB
_testbuffer.vcxproj.filters -rw-r--r-- 435 bytes
_testcapi.vcxproj -rw-r--r-- 3.1 KB
_testcapi.vcxproj.filters -rw-r--r-- 439 bytes
_testembed.vcxproj -rw-r--r-- 3.0 KB
_testembed.vcxproj.filters -rw-r--r-- 948 bytes
_testimportmultiple.vcxproj -rw-r--r-- 3.1 KB
_testimportmultiple.vcxproj.filters -rw-r--r-- 444 bytes
_tkinter.vcxproj -rw-r--r-- 3.6 KB
_tkinter.vcxproj.filters -rw-r--r-- 534 bytes
build.bat -rw-r--r-- 1.5 KB
build_env.bat -rw-r--r-- 25 bytes
build_pgo.bat -rw-r--r-- 1.6 KB
clean.bat -rw-r--r-- 126 bytes
env.bat -rw-r--r-- 712 bytes
field3.py -rw-r--r-- 974 bytes
get_externals.bat -rw-r--r-- 2.4 KB
idle.bat -rw-r--r-- 296 bytes
libeay.vcxproj -rw-r--r-- 44.1 KB
openssl.props -rw-r--r-- 3.7 KB
pcbuild.proj -rw-r--r-- 3.7 KB
pcbuild.sln -rw-r--r-- 51.1 KB
prepare_ssl.bat -rw-r--r-- 258 bytes
prepare_ssl.py -rw-r--r-- 7.7 KB
pyexpat.vcxproj -rw-r--r-- 3.5 KB
pyexpat.vcxproj.filters -rw-r--r-- 1.1 KB
pylauncher.vcxproj -rw-r--r-- 3.2 KB
pylauncher.vcxproj.filters -rw-r--r-- 1.2 KB
pyproject.props -rw-r--r-- 8.8 KB
python.props -rw-r--r-- 7.0 KB
python.vcxproj -rw-r--r-- 4.2 KB
python.vcxproj.filters -rw-r--r-- 824 bytes
python3dll.vcxproj -rw-r--r-- 5.9 KB
python3dll.vcxproj.filters -rw-r--r-- 1.2 KB
pythoncore.vcxproj -rw-r--r-- 20.4 KB
pythoncore.vcxproj.filters -rw-r--r-- 31.3 KB
pythonw.vcxproj -rw-r--r-- 3.1 KB
pythonw.vcxproj.filters -rw-r--r-- 702 bytes
pywlauncher.vcxproj -rw-r--r-- 3.2 KB
pywlauncher.vcxproj.filters -rw-r--r-- 1.2 KB
readme.txt -rw-r--r-- 13.5 KB
rmpyc.py -rw-r--r-- 598 bytes
rt.bat -rw-r--r-- 1.8 KB
select.vcxproj -rw-r--r-- 3.1 KB
select.vcxproj.filters -rw-r--r-- 436 bytes
sqlite3.vcxproj -rw-r--r-- 3.1 KB
sqlite3.vcxproj.filters -rw-r--r-- 804 bytes
ssleay.vcxproj -rw-r--r-- 4.8 KB
tcl.vcxproj -rw-r--r-- 3.5 KB
tcltk.props -rw-r--r-- 3.1 KB
tix.vcxproj -rw-r--r-- 3.6 KB
tk.vcxproj -rw-r--r-- 3.7 KB
unicodedata.vcxproj -rw-r--r-- 3.2 KB
unicodedata.vcxproj.filters -rw-r--r-- 810 bytes
winsound.vcxproj -rw-r--r-- 3.1 KB
winsound.vcxproj.filters -rw-r--r-- 500 bytes
xxlimited.vcxproj -rw-r--r-- 3.2 KB
xxlimited.vcxproj.filters -rw-r--r-- 433 bytes

readme.txt

back to top