2023-01-09 20:35:22 +08:00
|
|
|
import _time
|
|
|
|
|
|
|
|
|
|
|
|
def sleep(s: float):
|
2023-02-01 00:37:05 +08:00
|
|
|
for i in range(int(s)):
|
|
|
|
_time.sleep_s(1)
|
|
|
|
_time.sleep_ms(int((s - int(s)) * 1000))
|
2023-01-09 20:35:22 +08:00
|
|
|
|
|
|
|
|
|
|
|
def sleep_s(s: int):
|
|
|
|
return _time.sleep_s(s)
|
|
|
|
|
|
|
|
|
|
|
|
def sleep_ms(ms: int):
|
|
|
|
return _time.sleep_ms(ms)
|
|
|
|
|
|
|
|
|
|
|
|
def time() -> float:
|
|
|
|
return _time.time()
|
|
|
|
|
|
|
|
|
|
|
|
def time_ns() -> int:
|
|
|
|
return _time.time_ns()
|
|
|
|
|
|
|
|
|
|
|
|
def gmtime(unix_time: float):
|
|
|
|
return _time.gmtime(unix_time)
|
|
|
|
|
|
|
|
|
|
|
|
def localtime(unix_time: float):
|
|
|
|
return _time.localtime(unix_time)
|
|
|
|
|
|
|
|
|
|
|
|
def mktime() -> int:
|
|
|
|
return _time.mktime()
|
|
|
|
|
|
|
|
|
|
|
|
def asctime() -> str:
|
|
|
|
return _time.asctime()
|
|
|
|
|
|
|
|
|
|
|
|
def ctime(unix_time: float) -> str:
|
|
|
|
return _time.ctime(unix_time)
|