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