Перенос реализации лабораторной 3

This commit is contained in:
2026-10-30 19:09:55 +03:00
parent ec540a1a72
commit 5be0a6c0b4
52 changed files with 1824 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
from datetime import datetime, timezone
def to_rfc3339(value: datetime) -> str:
return value.astimezone(timezone.utc).isoformat(timespec='microseconds').replace('+00:00', 'Z')
def from_rfc3339(value: str) -> datetime:
if not isinstance(value, str) or not value.endswith('Z'):
raise ValueError('timestamp must end with Z')
return datetime.fromisoformat(value[:-1]).replace(tzinfo=timezone.utc)