Skip to content

Instantly share code, notes, and snippets.

@flaviut
flaviut / ntp.py
Created November 2, 2023 01:56
A simple, experimental NTP client written in Python.
import socket
import struct
import time
from dataclasses import dataclass
from enum import IntEnum
from typing import Optional
NTP_SERVER = "pool.ntp.org"
NTP_PORT = 123
TIME1970 = 2208988800 # 1970-01-01 in NTP epoch