From 9de69f9cf253524699afd46fb72ce58a151ce3a7 Mon Sep 17 00:00:00 2001 From: Rich Li Date: Wed, 21 Sep 2016 15:26:04 -0700 Subject: [PATCH] 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 --- stdlib/3/time.pyi | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/stdlib/3/time.pyi b/stdlib/3/time.pyi index fd6f488d4..f77f9baf9 100644 --- a/stdlib/3/time.pyi +++ b/stdlib/3/time.pyi @@ -1,11 +1,12 @@ # Stubs for time # Ron Murawski -# 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