1import sys 2from types import SimpleNamespace 3from typing import Any, NamedTuple, Optional, Tuple, Union 4 5_TimeTuple = Tuple[int, int, int, int, int, int, int, int, int] 6 7altzone: int 8daylight: int 9timezone: int 10tzname: Tuple[str, str] 11 12if sys.version_info >= (3, 7): 13 if sys.platform == "linux": 14 CLOCK_BOOTTIME: int 15 if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": 16 CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD 17 CLOCK_UPTIME: int # FreeBSD, OpenBSD 18 19if sys.platform != "win32": 20 CLOCK_MONOTONIC: int 21 CLOCK_MONOTONIC_RAW: int 22 CLOCK_PROCESS_CPUTIME_ID: int 23 CLOCK_REALTIME: int 24 CLOCK_THREAD_CPUTIME_ID: int 25 if sys.platform != "linux" and sys.platform != "darwin": 26 CLOCK_HIGHRES: int # Solaris only 27 28if sys.version_info >= (3, 8) and sys.platform == "darwin": 29 CLOCK_UPTIME_RAW: int 30 31if sys.version_info >= (3, 9) and sys.platform == "linux": 32 CLOCK_TAI: int 33 34class _struct_time(NamedTuple): 35 tm_year: int 36 tm_mon: int 37 tm_mday: int 38 tm_hour: int 39 tm_min: int 40 tm_sec: int 41 tm_wday: int 42 tm_yday: int 43 tm_isdst: int 44 @property 45 def n_fields(self) -> int: ... 46 @property 47 def n_sequence_fields(self) -> int: ... 48 @property 49 def n_unnamed_fields(self) -> int: ... 50 51class struct_time(_struct_time): 52 def __init__( 53 self, 54 o: Union[ 55 Tuple[int, int, int, int, int, int, int, int, int], 56 Tuple[int, int, int, int, int, int, int, int, int, str], 57 Tuple[int, int, int, int, int, int, int, int, int, str, int], 58 ], 59 _arg: Any = ..., 60 ) -> None: ... 61 def __new__( 62 cls, 63 o: Union[ 64 Tuple[int, int, int, int, int, int, int, int, int], 65 Tuple[int, int, int, int, int, int, int, int, int, str], 66 Tuple[int, int, int, int, int, int, int, int, int, str, int], 67 ], 68 _arg: Any = ..., 69 ) -> struct_time: ... 70 @property 71 def tm_zone(self) -> str: ... 72 @property 73 def tm_gmtoff(self) -> int: ... 74 75def asctime(t: Union[_TimeTuple, struct_time] = ...) -> str: ... 76 77if sys.version_info < (3, 8): 78 def clock() -> float: ... 79 80def ctime(secs: Optional[float] = ...) -> str: ... 81def gmtime(secs: Optional[float] = ...) -> struct_time: ... 82def localtime(secs: Optional[float] = ...) -> struct_time: ... 83def mktime(t: Union[_TimeTuple, struct_time]) -> float: ... 84def sleep(secs: float) -> None: ... 85def strftime(format: str, t: Union[_TimeTuple, struct_time] = ...) -> str: ... 86def strptime(string: str, format: str = ...) -> struct_time: ... 87def time() -> float: ... 88 89if sys.platform != "win32": 90 def tzset() -> None: ... # Unix only 91 92def get_clock_info(name: str) -> SimpleNamespace: ... 93def monotonic() -> float: ... 94def perf_counter() -> float: ... 95def process_time() -> float: ... 96 97if sys.platform != "win32": 98 def clock_getres(clk_id: int) -> float: ... # Unix only 99 def clock_gettime(clk_id: int) -> float: ... # Unix only 100 def clock_settime(clk_id: int, time: float) -> None: ... # Unix only 101 102if sys.version_info >= (3, 7): 103 if sys.platform != "win32": 104 def clock_gettime_ns(clock_id: int) -> int: ... 105 def clock_settime_ns(clock_id: int, time: int) -> int: ... 106 def monotonic_ns() -> int: ... 107 def perf_counter_ns() -> int: ... 108 def process_time_ns() -> int: ... 109 def time_ns() -> int: ... 110 def thread_time() -> float: ... 111 def thread_time_ns() -> int: ... 112