Compare commits
No commits in common. '3dbb0257ae88fa10033e7216e44797664dac98e8' and '7fbadce5587928a245e446d57b9444080cfb7e28' have entirely different histories.
3dbb0257ae
...
7fbadce558
@ -1 +0,0 @@ |
||||
from . import secondary_functions |
@ -1,20 +0,0 @@ |
||||
import time |
||||
import asyncio |
||||
from aiohttp.web_ws import WebSocketResponse |
||||
|
||||
|
||||
async def time_response(ws: WebSocketResponse, delay: int = 60): |
||||
while True: |
||||
new_time: time.gmtime = time.gmtime(time.time()) |
||||
hour = new_time.tm_hour + 3 |
||||
if hour >= 24: |
||||
hour = hour - 24 |
||||
minutes = new_time.tm_min |
||||
if minutes < 10: |
||||
minutes = f'0{minutes}' |
||||
result_response = f'Время: {hour}:{minutes}' |
||||
try: |
||||
await ws.send_str(result_response) |
||||
await asyncio.sleep(delay) |
||||
except ConnectionResetError: |
||||
await asyncio.sleep(delay) |
Loading…
Reference in new issue