This application provides an adaptive
time synchronization compensation method, a terminal device, a gateway device, and a
system. The adaptive
time synchronization compensation method includes: receiving a
beacon frame from a gateway;
parsing a
timestamp, an actual
beacon period value, and an over-the-air
transmission time value carried in the
beacon frame, wherein the
timestamp represents the absolute time at which the gateway begins sending the
beacon frame, and the actual
beacon period value is the actual interval between the start times of two adjacent
beacon frame transmissions, as measured by the gateway based on its hardware
clock; recording the local reception
completion time of the
beacon frame on the terminal device side; calculating a first
time deviation between the local
clock of the terminal device and the gateway
clock based on the
timestamp, the over-the-air
transmission time value, and the local reception
completion time; correcting the local clock of the terminal device according to the first
time deviation; and calculating and determining subsequent periodic reception time slots of the terminal device based on the corrected local clock, the actual
beacon period value, and predefined reception time slot parameters.