forked from python/typeshed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime.pyi
More file actions
112 lines (94 loc) · 3.58 KB
/
time.pyi
File metadata and controls
112 lines (94 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import sys
from _typeshed import structseq
from typing import Any, Protocol
from typing_extensions import Final, Literal, TypeAlias, final
_TimeTuple: TypeAlias = tuple[int, int, int, int, int, int, int, int, int]
altzone: int
daylight: int
timezone: int
tzname: tuple[str, str]
if sys.platform == "linux":
CLOCK_BOOTTIME: int
if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
CLOCK_PROF: int # FreeBSD, NetBSD, OpenBSD
CLOCK_UPTIME: int # FreeBSD, OpenBSD
if sys.platform != "win32":
CLOCK_MONOTONIC: int
CLOCK_MONOTONIC_RAW: int
CLOCK_PROCESS_CPUTIME_ID: int
CLOCK_REALTIME: int
CLOCK_THREAD_CPUTIME_ID: int
if sys.platform != "linux" and sys.platform != "darwin":
CLOCK_HIGHRES: int # Solaris only
if sys.version_info >= (3, 8) and sys.platform == "darwin":
CLOCK_UPTIME_RAW: int
if sys.version_info >= (3, 9) and sys.platform == "linux":
CLOCK_TAI: int
# Constructor takes an iterable of any type, of length between 9 and 11 elements.
# However, it always *behaves* like a tuple of 9 elements,
# even if an iterable with length >9 is passed.
# https://github.com/python/typeshed/pull/6560#discussion_r767162532
@final
class struct_time(structseq[Any | int], _TimeTuple):
if sys.version_info >= (3, 10):
__match_args__: Final = ("tm_year", "tm_mon", "tm_mday", "tm_hour", "tm_min", "tm_sec", "tm_wday", "tm_yday", "tm_isdst")
@property
def tm_year(self) -> int: ...
@property
def tm_mon(self) -> int: ...
@property
def tm_mday(self) -> int: ...
@property
def tm_hour(self) -> int: ...
@property
def tm_min(self) -> int: ...
@property
def tm_sec(self) -> int: ...
@property
def tm_wday(self) -> int: ...
@property
def tm_yday(self) -> int: ...
@property
def tm_isdst(self) -> int: ...
# These final two properties only exist if a 10- or 11-item sequence was passed to the constructor.
@property
def tm_zone(self) -> str: ...
@property
def tm_gmtoff(self) -> int: ...
def asctime(t: _TimeTuple | struct_time = ...) -> str: ...
if sys.version_info < (3, 8):
def clock() -> float: ...
def ctime(secs: float | None = ...) -> str: ...
def gmtime(secs: float | None = ...) -> struct_time: ...
def localtime(secs: float | None = ...) -> struct_time: ...
def mktime(t: _TimeTuple | struct_time) -> float: ...
def sleep(secs: float) -> None: ...
def strftime(format: str, t: _TimeTuple | struct_time = ...) -> str: ...
def strptime(string: str, format: str = ...) -> struct_time: ...
def time() -> float: ...
if sys.platform != "win32":
def tzset() -> None: ... # Unix only
class _ClockInfo(Protocol):
adjustable: bool
implementation: str
monotonic: bool
resolution: float
def get_clock_info(name: Literal["monotonic", "perf_counter", "process_time", "time", "thread_time"]) -> _ClockInfo: ...
def monotonic() -> float: ...
def perf_counter() -> float: ...
def process_time() -> float: ...
if sys.platform != "win32":
def clock_getres(clk_id: int) -> float: ... # Unix only
def clock_gettime(clk_id: int) -> float: ... # Unix only
def clock_settime(clk_id: int, time: float) -> None: ... # Unix only
if sys.platform != "win32":
def clock_gettime_ns(clock_id: int) -> int: ...
def clock_settime_ns(clock_id: int, time: int) -> int: ...
if sys.platform == "linux":
def pthread_getcpuclockid(thread_id: int) -> int: ...
def monotonic_ns() -> int: ...
def perf_counter_ns() -> int: ...
def process_time_ns() -> int: ...
def time_ns() -> int: ...
def thread_time() -> float: ...
def thread_time_ns() -> int: ...