1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Create sleep_until

This commit is contained in:
Steffo 2019-04-08 20:30:11 +02:00
parent 23594fc4ac
commit 8d0e6d8c5c

View file

@ -0,0 +1,10 @@
import asyncio
import datetime
async def sleep_until(dt: datetime.datetime):
now = datetime.datetime.now()
if now > dt:
return
delta = dt - now
await asyncio.sleep(delta.total_seconds())