The invention relates to the technical field of synchronization in data communication, and provides a
PTP protocol-based
chip-level hardware
timestamp generation method and
system, and the method comprises the steps: 1, receiving a synchronization message and a
delay request message from a main
clock, carrying out the evaluation of a
physical layer signal, and recording a first hardware
timestamp; 2, responding to the received
delay request message, generating and sending a
delay response message, acquiring
bidirectional transmission delay data by exchanging the delay request and the delay response message, and calculating
clock skew in combination with the first hardware
timestamp and the
bidirectional transmission delay data; 3, adjusting the local
clock frequency according to the
clock skew; 4, after the synchronization is completed, associating the second hardware timestamp with the corresponding data message, and storing the associated data in a buffer area in the
chip; and 5, generating standardized timestamp information, and outputting the standardized timestamp information through a
chip interface. And high-precision
time synchronization and timestamp generation are realized.