功能更新 添加sleep函数
parent
1e08543e56
commit
92eff76239
@ -0,0 +1,22 @@
|
|||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
def delay(us):
|
||||||
|
end_time = time.perf_counter_ns() + us * 1000
|
||||||
|
while time.perf_counter_ns() < end_time:
|
||||||
|
print("", end="")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import threading
|
||||||
|
|
||||||
|
def test():
|
||||||
|
time.sleep(1)
|
||||||
|
print("hello")
|
||||||
|
|
||||||
|
def test_2():
|
||||||
|
delay(1000 * 1000 * 10)
|
||||||
|
|
||||||
|
threading.Thread(target=test).start()
|
||||||
|
threading.Thread(target=test_2).start()
|
||||||
|
|
@ -0,0 +1,15 @@
|
|||||||
|
import time
|
||||||
|
from dealy import delay
|
||||||
|
from mouse.logitech import Logitech
|
||||||
|
from poe.start import get_start
|
||||||
|
|
||||||
|
while True:
|
||||||
|
delay(10)
|
||||||
|
if get_start():
|
||||||
|
st = time.time()
|
||||||
|
for _ in range(300):
|
||||||
|
delay(100)
|
||||||
|
Logitech.mouse.move(1, 1)
|
||||||
|
print(int((time.time() - st) * 1000), " ms")
|
||||||
|
|
||||||
|
break
|
Loading…
Reference in New Issue