Include time updates with Python 3.3 (#563)

* Add definitions added in Python 3.3

* Remove blanks between function stubs

* Group Unix-only functions into platform checks

* Correct get_clock_info() return type to SimpleNamespace
This commit is contained in:
Rich Li
2016-09-21 15:26:04 -07:00
committed by Guido van Rossum
parent b53e4c349d
commit 9de69f9cf2

View File

@@ -1,11 +1,12 @@
# Stubs for time
# Ron Murawski <ron@horizonchess.com>
# based on: http://docs.python.org/3.2/library/time.html#module-time
# based on: http://docs.python.org/3.3/library/time.html#module-time
# see: http://nullege.com/codes/search?cq=time
import sys
from typing import Tuple, Union
from types import SimpleNamespace
# ----- variables and constants -----
accept2dyear = False
@@ -14,6 +15,14 @@ daylight = 0
timezone = 0
tzname = ... # type: Tuple[str, str]
if sys.version_info >= (3, 3) and sys.platform != 'win32':
CLOCK_HIGHRES = 0 # Solaris only
CLOCK_MONOTONIC = 0 # Unix only
CLOCK_MONOTONIC_RAW = 0 # Linux 2.6.28 or later
CLOCK_PROCESS_CPUTIME_ID = 0 # Unix only
CLOCK_REALTIME = 0 # Unix only
CLOCK_THREAD_CPUTIME_ID = 0 # Unix only
# ----- classes/methods -----
class struct_time:
@@ -41,27 +50,30 @@ class struct_time:
def asctime(t: Union[Tuple[int, int, int, int, int, int, int, int, int],
struct_time,
None] = ...) -> str: ... # return current time
def clock() -> float: ...
def ctime(secs: Union[float, None] = ...) -> str: ... # return current time
def gmtime(secs: Union[float, None] = ...) -> struct_time: ... # return current time
def localtime(secs: Union[float, None] = ...) -> struct_time: ... # return current time
def mktime(t: Union[Tuple[int, int, int, int, int,
int, int, int, int],
struct_time]) -> float: ...
def sleep(secs: Union[int, float]) -> None: ...
def strftime(format: str, t: Union[Tuple[int, int, int, int, int,
int, int, int, int],
struct_time,
None] = ...) -> str: ... # return current time
def strptime(string: str,
format: str = ...) -> struct_time: ...
def time() -> float: ...
def tzset() -> None: ... # Unix only
if sys.platform != 'win32':
def tzset() -> None: ... # Unix only
if sys.version_info >= (3, 3):
def get_clock_info(str) -> SimpleNamespace: ...
def monotonic() -> float: ...
def perf_counter() -> float: ...
def process_time() -> float: ...
if sys.platform != 'win32':
def clock_getres(int) -> float: ... # Unix only
def clock_gettime(int) -> float: ... # Unix only
def clock_settime(int, struct_time) -> float: ... # Unix only