WO2015089848A1 - 精确时钟协议同步方法和节点 - Google Patents

精确时钟协议同步方法和节点 Download PDF

Info

Publication number
WO2015089848A1
WO2015089848A1 PCT/CN2013/090159 CN2013090159W WO2015089848A1 WO 2015089848 A1 WO2015089848 A1 WO 2015089848A1 CN 2013090159 W CN2013090159 W CN 2013090159W WO 2015089848 A1 WO2015089848 A1 WO 2015089848A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
time
message
sync
delay
Prior art date
Application number
PCT/CN2013/090159
Other languages
English (en)
French (fr)
Inventor
吕京飞
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201380002819.5A priority Critical patent/CN105027489B/zh
Priority to PCT/CN2013/090159 priority patent/WO2015089848A1/zh
Publication of WO2015089848A1 publication Critical patent/WO2015089848A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0664Clock or time synchronisation among packet nodes using timestamps unidirectional timestamps

Definitions

  • the present invention relates to the field of communications, the field of power, the field of automation, and the field of medicine, and the like, and more particularly to an accurate clock protocol synchronization method and node.
  • the present invention provides an accurate clock protocol synchronization method and node, which helps to reduce the error of frequency synchronization and time synchronization of ⁇ messages, and helps to improve the accuracy of ⁇ synchronization.
  • the present invention provides an accurate clock protocol synchronization method, where the method includes: a first node sends a 0th Sync synchronization message to a second node, where the 0th Sync message carries the first The local time of the first node when the node sends the 0th Sync message ⁇ ' ⁇ ;
  • the first node sends at least one Sync message to the second node, so that the second node is according to 7 .
  • the second node receives the Nth a local time T of the second node and a frequency deviation of the second node from the first node, and causing the second node to calibrate the second node according to the frequency offset a local clock, where the at least one Sync message includes an ith Sync message, and the ith Sync message carries the first node to send the ith message to the second node
  • the local time T " and the time adjustment value ⁇ of the first node are the time when the first node sends the i-th synchronization message and the first node sends the i-th synchronization message.
  • the time adjustment value of the first node between the times where is the time when the second node receives the i-th synchronization message and the time when the second node receives the i-th synchronization message a time adjustment value of the second node, where N is a positive integer, i is all positive integers from 1 to N, and A is a time when the first node sends the 0th Sync message and the first
  • the time adjustment value of the first node between the time when the node sends the Nth Sync message is the second a time adjustment value of the second node between a time when the 0th Sync message is received and a time when the second node receives the Nth Sync message.
  • the frequency deviation between the second node and the first node is:
  • the present invention provides an accurate clock protocol synchronization method, where the method includes: a second node receives a 0th Sync synchronization message from a first node, where the 0th Sync message carries the first The local time of the first node when the node sends the 0th Sync message. ;
  • the at least one Sync message sent by the first node where the at least one Sync message includes an ith Sync message, where the ith Sync message carries the first node direction
  • the local time T " and the time adjustment value of the first node when the second node sends the ith message, ⁇ is the first node sends The time adjustment value of the first node between the time when the i-th synchronization message is sent and the time when the first node sends the i-th synchronization message; the second node is according to 7 .
  • the first node sends the Nth Sync message, the local time of the first node is ⁇ , and the second node receives the 0th
  • the time adjustment value of the second node, N is a positive integer, i is all positive integers from 1 to N, and ⁇ is the time at which the first node sends the 0th Sync message and the first node sends the a time adjustment value of the first node between times of the Nth Sync message, where the second node receives the 0th Sync message and the second node receives the Nth
  • the frequency deviation between the second node and the first node is:
  • the present invention provides an accurate clock protocol synchronization method, where the method includes: a first node sends a first Sync synchronization packet to a second node, where the first Sync packet carries the first node to send The first Sync message is in the local time of the first node; the first node receives the Delay_Req delay request message sent by the second node, and acquires the time adjustment value of the first node.
  • is the time at which the first node sends the first Sync message and the first node receives the Delay_Req a time adjustment value of the first node between the times of the message; the first node sends a Delay_Resp delay response message to the second node, where the Delay_Resp message includes the first node and a time adjustment value ⁇ ⁇ , according to the second node 4, the local time when the node receiving the first packet Sync ⁇ the second node, said second node transmitting The local time T of the second node and the time adjustment value of the second node in the Delay-Req text obtain a link delay, where is the time when the second node receives the first Sync message a time adjustment value of the second section between the time when the second node sends the Delay_Req message.
  • a link delay between the second node and the first node is:
  • the method further includes: sending, by the first node, the second node to the second node, in a second possible implementation manner of the third aspect, a Sync message, where the second Sync message carries the local time of the first node when the first node sends the second Sync message, so that the second node receives according to i, the second node
  • the fourth aspect of the present invention provides a method for synchronizing a precise clock protocol, the method comprising: receiving, by a second node, a first Sync synchronization packet sent by a first node, where the Sync packet carries the first node The local time ⁇ ⁇ of the first node when the first Sync message is sent; Sending, by the second node, a Delay-Req delay request message to the first node, and acquiring a time adjustment value of the second node, where is the time and location of the second node receiving the first Sync message a time adjustment value of the second node between the time when the second node sends the Delay_Req message; the second node receives a Delay-Resp delay response message sent by the first node, the Delay - the Resp message carries the local time
  • the second node acquires a link delay D of the second node and the first node according to ⁇ 2, ⁇ ⁇ 4 , ⁇ .
  • a link delay between the second node and the first node is:
  • the method further includes:
  • the second node receives the second Sync message sent by the first node, where the second Sync message carries the local time of the first node when the first node sends the second Sync message. T,;
  • the present invention provides an accurate clock protocol synchronization method, where the method includes: The first node sends a first Sync synchronization message to the second node, where the first Sync message carries the local time of the first node when the first node sends the first Sync message; a node sends a third Sync message to the second node, where the third Sync message carries the local time of the first node and the first node when the first node sends the third Sync message
  • the time adjustment value ⁇ ' of a node is a time adjustment of the first node between the time when the first node sends the first Sync message and the time when the first node sends the third Sync message
  • the node sends a Delay-Resp message to the second node, where the Delay-Resp message carries the local time ⁇ and ' of the first node when the first node receives the Delay-Req message, Making the second node according to 7 i, T ,
  • a link delay between the second node and the first node is:
  • the method further includes: sending, by the first node, a second Sync to the second node, in a second possible implementation manner of the fifth aspect, a message, where the second Sync message carries the first node when the second Sync message is sent The local time T'l of the node, so that the second node delays according to the i, the link
  • the sixth aspect of the present invention provides a method for synchronizing a precise clock protocol, the method comprising: receiving, by a second node, a first Sync synchronization message sent by the first node, where the first Sync message carries a local time Tr of the first node when the first node sends the first Sync message, the second node sends a Delay_Req delay request message to the first node, and acquires the second
  • the time adjustment value of the node is a time adjustment value of the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Re
  • the second node receives the third Sync message sent by the first node, where the third Sync message carries the local time and the first time when the first node sends the third Sync message.
  • a time adjustment value ⁇ ' of the node where ⁇ ′ is the first node between the time when the first node sends the first Sync message and the time when the first node sends the third Sync message time regulation value, wherein the third Sync message is the first node when the received ⁇ ⁇ Delay- Req message to the first node to the local time of transmission between the second ⁇ And the time at which the second node receives the third Sync message is later than the time when the second node sends the Delay_Req message;
  • the link delay between the second node and the first node is:
  • the method further includes:
  • the second node receives the second Sync message sent by the first node, where the second Sync message carries the local time of the first node when the first node sends the second Sync message. T,;
  • ⁇ and the second node receiving the Sync 'local time at the second node packets ⁇ ' 2 acquires the time the second node and the first node offset 0 Ff set , and calibrating the local clock of the second node according to the time offset.
  • the present invention provides a method for synchronizing a precise clock protocol, the method comprising: receiving, by a first node, a Pdelay-Req delay request message sent by a second node; The two nodes send a Pdelay-Resp delay response message, where the Pdelay-Resp delay response message carries the local time of the first node when the first node receives the Pdelay_Req ⁇ message, the first a local time of the first node and a time adjustment value ⁇ of the first node when the node sends the Pdelay_Resp text, so that the second node sends the location according to ⁇ , ⁇ , the second node The local time ⁇ ⁇ of the second node in the Pdelay-Req ⁇ ⁇ , the local time of the second node when the
  • the link delay between the second node and the first node is:
  • the method further includes: the first node sending a Sync synchronization report to the second node.
  • the Sync message carries the local time of the first node when the first node sends the Sync message, so that the second node receives according to ⁇ 1, D, and the second node. And obtaining, by the local time of the second node, the time deviation of the second node from the first node, and causing the second node to calibrate the second node according to the time offset Local clock.
  • the eighth aspect of the present invention provides an accurate clock protocol synchronization method, where the method includes:
  • the second node sends a Pdelay-Req delay request message to the first node; the second node receives the Pdelay-Resp delay response message sent by the first node, where the Pdelay-Resp message carries the The local time ⁇ of the first node when the node receives the Pdelay_Req ⁇ text, the local time of the first node when the first node sends the Pdelay_Resp text, and the first node
  • the time adjustment value ⁇ is a time adjustment value of the first node between the time when the first node receives the Pdelay_Req message and the time when the first node sends the Pdelay_Resp message;
  • the second node according to ⁇ , ⁇ ⁇ , the local time ⁇ ⁇ of the second node when the second node sends the Pdelay_Req message, and the second node when receiving the Pdelay_Resp message
  • the local time of the two nodes and the time adjustment value of the second node acquire
  • the method further includes:
  • the second node receives the Sync synchronization message sent by the first node, where the Sync message carries the local time T of the first node when the first node sends the Sync message,
  • the ninth aspect of the present invention provides a first node, including: a sending unit, configured to send a 0th Sync synchronization message to the second node, where the 0th Sync message carries the first node The local time of the first node when the node sends the 0th Sync message; the sending unit is further configured to send the at least one Sync message to the second node, so that the second node is configured according to the The first node sends the Nth Sync The local time of the first node, ⁇ , and the local time of the second node when the second node receives the 0th Sync message.
  • the second node receives the Nth Sync message, the local time of the second node, and Ay acquires a frequency deviation between the second node and the first node, and causes the second node to The frequency offset is calibrated to the local clock of the second node, where the at least one Sync message includes an ith Sync message, and the ith Sync message carries the first node to the first
  • the local time and the time adjustment value ⁇ of the first node when the second node sends the ith message is the time when the first node sends the ith first synchronization message and the first
  • the time adjustment value of the first node between the time when the node sends the ith synchronization message where is the time at which the second node receives the ith ith synchronization message and the second node receiving station
  • the time adjustment value of the second node between the times of the i-th synchronization message, N is a positive integer
  • i is all positive integers from 1 to N
  • is the first node
  • the frequency deviation between the second node and the first node is:
  • the first node includes: a receiving unit, configured to receive a 0th Sync synchronization message from the first node, where the 0th Sync message is in the tenth aspect. And carrying the local time of the first node when the first node sends the 0th Sync message.
  • the receiving unit is further configured to receive the at least one Sync message sent by the first node, where the at least one Sync message includes an ith Sync message, the ith The Sync message carries the local time T " and the time adjustment value ⁇ , ⁇ of the first node when the first node sends the ith message to the second node, where the first node sends the first node a time adjustment value of the first node between the time of the i-1 synchronous message and the time when the first node sends the ith synchronization message; the processing unit, configured to: according to the first node The local time w of the first node when the Nth Sync message is sent, the local time of the second node when the second node receives the 0th Sync message, and the second node And receiving, by the local time of the second node, the frequency deviation of the second node and the first node, and calibrating the local clock of the second node according to the frequency offset, where , ⁇ is a time adjustment value of the second no
  • the frequency deviation between the second node and the first node is:
  • the present invention provides a first node, including: a sending unit, configured to send a first Sync synchronization message to a second node, where the first Sync message carries the first node to send the a local time of the first node when the first Sync message is received; a receiving unit, configured to receive a Delay-Req delay request message sent by the second node; An acquiring unit, configured to acquire a time adjustment value ⁇ of the first node, where is a time when the first node sends the first Sync message and a time when the first node receives the Delay_Req ⁇ message a time adjustment value of the first node; the sending unit is further configured to send a Delay_Resp delay response message to the second node, where the Delay_Resp file includes
  • the sending unit is further configured to: send a second Sync message to the second node, in a second possible implementation manner of the eleventh aspect
  • the second Sync message carries the local time ' ⁇ of the first node when the first node sends the second Sync message, so that the second node is based on ' ⁇
  • the second The local time ⁇ ' 2 and D of the second node when the node receives the second Sync message acquires a time offset 0 ff set of the second node and the first node, and causes the second node to The time offset calibrates a local clock of the second node.
  • the time deviation of the second node from the first node is:
  • the present invention provides a second node, including: a receiving unit, configured to receive a first Sync synchronization message sent by the first node, where the first Sync message When the first node sends the first Sync message, the first node sends a local time of the first node; a sending unit, configured to send a Delay_Req delay request message to the first node;
  • An acquiring unit configured to acquire a time adjustment value of the second node, where is the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message a time adjustment value of the second node; the receiving unit is further configured to receive a Delay-Resp delay response message sent by the first node, where the Delay-Resp message carries the first node to receive the The local time T of the first node and the time adjustment value of the first node are the time when the first node sends the first Sync message and the first node receives the The time adjustment value of the first node between the times of the Delay-Req message;
  • a processing unit configured to acquire, according to , ⁇ 2 , ⁇ ⁇ , and a link delay D of the second node and the first node.
  • the link delay between the second node and the first node is:
  • the receiving unit is further configured to receive the second Sync sent by the first node. a message, the second Sync message carrying the local time T of the first node when the first node sends the second Sync message;
  • the processing unit is further configured to acquire a time offset 0 ff set between the second node and the first node according to a local time of the second node receiving the second Sync message, And calibrating the local clock of the second node according to the time offset 0 ff set .
  • the present invention provides a first node, including: a sending unit, configured to send a first Sync synchronization message to a second node, where the first Sync message carries The local time of the first node when the first node sends the first Sync message; the sending unit is further configured to send a third Sync message to the second node, where the third Sync message
  • the local time of the first node and the time adjustment value A ", Ax" of the first node when the first node sends the third Sync message is that the first node sends the first a time adjustment value of the first node between a time of a Sync message and a time when the first node sends the third Sync message; a receiving unit, configured to receive a Delay-Req sent by the second node Delay request message;
  • An acquiring unit configured to acquire a time adjustment value of the first node, where ⁇ is a time when the first node sends the third Sync message and a time when the first node receives the Delay_Req message a time adjustment value of the first node, where the time at which the second node receives the third Sync message is later than the time at which the second node sends the Delay_Req message;
  • the unit is further configured to send a Delay-Resp message to the second node, where the Delay-Resp message carries the local time of the first node when the first node receives the Delay-Req message.
  • the local time of the second node and the time adjustment value of the second node when the second node receives the Sync message acquires a link delay of the second node and the first node, The time adjustment value of the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message.
  • the link delay between the second node and the first node is:
  • the sending unit is further configured to: send a second Sync message to the second node, in a second possible implementation manner of the thirteenth aspect,
  • the second Sync message carries the local time of the first node when the first node sends the second Sync message, and the local time is 7 "1, so that the second node is in accordance with the link.
  • the delay time D and the local time of the second node when the second node receives the Sync' message, and the time OFF of the second node and the first node are combined with the thirteenth aspect.
  • the time deviation of the second node from the first node is:
  • the present invention provides a second node, including: a receiving unit, configured to receive a first Sync synchronization packet sent by the first node, where the first The Sync message carries the local time sending unit of the first node when the first node sends the first Sync message, and is configured to send a Delay_Req delay request message to the first node;
  • An acquiring unit configured to acquire a time adjustment value of the second node, where is the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message a time adjustment value of the second node; the receiving unit is further configured to receive a third Sync message sent by the first node, where the third Sync message carries the first node to send the The local time T' of the third Sync message and the time adjustment value ⁇ ', Ax" of the first node are the time when the first node sends the first Sync message and the first node sends the third time adjustment value Sync packets between the first node, wherein the third Sync message is the first node in the ⁇ ⁇ the received packet when the Delay- Req Transmitting to the second node between the local times of the first node, and sending, by the second node, the third Sync message is later than the second node sending the Delay_Req Time of the message; The receiving unit is further configured to receive a De
  • a processing unit for using, ⁇ 2 , ⁇ ⁇ 4 , And Ay acquires a link delay D of the second node and the first node.
  • the link delay between the second node and the first node is:
  • the receiving unit is further configured to receive the second Sync sent by the first node. a message, the second Sync message carrying the local time T of the first node when the first node sends the second Sync message;
  • the processing unit is further configured to acquire a time deviation of the second node from the first node according to a local time of the second node when the second node receives the Sync' message 0 ff set .
  • the time deviation of the second node from the first node is:
  • the present invention provides a first node, including: a receiving unit, configured to receive a Pdelay-Req delay request message sent by a second node;
  • a sending unit configured to send a Pdelay-Resp delay response message to the second node, where the Pdelay-Resp delay response message carries the first node when receiving the Pdelay_Req ⁇ message Local time of a node ⁇ , the first node sends
  • the Pdelay_Resp time is the local time of the first node and the time adjustment value ⁇ of the first node, so that the second node sends the Pdelay_Req according to ⁇ , ⁇ , the second node
  • the local time ⁇ ⁇ of the second node, the local time of the second node when the second node receives the Pdelay-Resp message, and the time adjustment value of the second node a link delay D of the second node and the first node, where ⁇ is a time when the first node receives the Pdelay_Req message and the first node sends the Pdelay-Resp message
  • the time adjustment value of the first node between the time is the time between the
  • the sending unit is further configured to send a Sync synchronization message to the second node.
  • the Sync message carries the local time of the first node when the first node sends the Sync message, so that the second node receives the according to T, D, and the second node. And obtaining, by the local time of the second node, the time deviation of the second node from the first node by a Sync message, and causing the second node to calibrate the second node according to the time offset Local clock.
  • the time deviation of the second node from the first node is:
  • the present invention provides a second node, including: a sending unit, configured to send a Pdelay-Req delay request message to the first node; and a receiving unit, configured to receive a Pdelay-Resp delay response packet sent by the first node, where the Pdelay-Resp packet carries the local time of the first node when the first node receives the Pdelay_Req ⁇ message
  • the first node sends
  • the local time of the first node and the time adjustment value ⁇ of the first node in the Pdelay-Resp context is that the time at which the first node receives the Pdelay_Req message is sent by the first node. a time adjustment value of the first node between times of the Pdelay_Resp text;
  • the processing unit when used according ⁇ , ⁇ , said second node transmitting said Pdelay- Req message to the second node of the local time ⁇ when the second node receives the second message Pdelay- Resp
  • the local time of the node and the time adjustment value of the second node acquire the link delay of the second node and the first node, where the second node sends the Pdelay-Req message
  • the link delay between the second node and the first node is:
  • the receiving unit is further configured to receive the Sync synchronization message sent by the first node.
  • the Sync message carries the local time T of the first node when the first node sends the Sync message
  • the processing unit is further configured to: according to the ⁇ 1 and the second node Receiving, by the local time of the second node, the time difference between the second node and the first node, 0 ff set , and calibrating the second node according to the time offset Local clock.
  • the time deviation of the second node from the first node is:
  • the present invention provides a first node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus
  • the physical layer chip includes receiving a time generation circuit, a transmission time generation circuit, a transceiver, a crystal oscillator, a counter, a register, and a bus, wherein: the transceiver is configured to send a 0th Sync synchronization message to the second node, where the
  • the transceiver is further configured to send at least one Sync message to the second node, So that the second node is based.
  • the local time and time adjustment value ⁇ , ⁇ of the first node when the second node sends the ith message is the time when the first node sends the ith-th synchronization message and the first node
  • the present invention provides a second node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus.
  • the physical layer chip includes a receiving time generating circuit, a transmission time generating circuit, a transceiver, a crystal oscillator, a counter, a register, and a bus, wherein: a transceiver, configured to receive a 0th Sync synchronization message from the first node, where the
  • the 0 Sync message carries the local time of the first node when the first node sends the 0th Sync message.
  • the transceiver is further configured to receive at least one Sync message sent by the first node, where the at least one Sync message includes an i-th Sync message, and the i-th Sync message includes the When the first node sends the i th message to the second node, the local time 7 ⁇ and the time adjustment value ⁇ of the first node are ⁇ , the first node sends the i-th synchronization message The time adjustment value between the time of the first section and the time when the first node sends the ith synchronization message; the central processing unit is used for the base.
  • the local time of the first node is ⁇ when the first node sends the Nth Sync message, and the local time of the second node when the second node receives the 0th Sync message. And acquiring, by the second node, the local time of the second node when acquiring the Nth Sync message, acquiring a frequency deviation between the second node and the first node, and calibrating the second according to the frequency offset a local clock of the node, where ⁇ is the second time between the time when the second node receives the i-th synchronization message and the time that the second node receives the i-th synchronization message
  • the time adjustment value of the node, N is a positive integer
  • i is all positive integers from 1 to N
  • is the time at which the first node sends the 0th Sync message and the first node sends the first a time adjustment value of the first node between times of the N Sync messages, where the second node receives the 0th Sync message and the
  • Ax ⁇ j
  • Ax i Ax l + Ax 2 + ⁇ + Ax N
  • the present invention provides a first node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus.
  • the physical layer chip includes a receiving time generating circuit and a transmission time generation.
  • the central processing unit is configured to obtain a time adjustment value ⁇ of the first node, where ⁇ is a time when the first node sends the first Sync message and a time when the first node receives the Delay_Req message a time adjustment value of the first node; the transceiver is further configured to send a Delay_Resp delay response message to the second node, where the Delay_Resp file includes the time of the first node Adjusting the values ⁇ and ⁇ , so that the second node sends the Delay according to ⁇ ⁇ , the local time of the second node when the second node receives the first Sync message, and the second node sends the Delay - the local time ⁇ of the second node in the Req message, and the time adjustment value of the second node to obtain a link delay, where is the time and location of the second node receiving the first Sync message And a time adjustment value of the second node between the time when the second node sends the Delay_Req message.
  • the transceiver is further configured to: send a second Sync message to the second node, in a second possible implementation manner of the nineteenth aspect
  • the second Sync message carries The local time ⁇ ' ⁇ of the first node when the first node sends the second Sync message, so that the second node receives the second Sync message according to the second node
  • the local time ⁇ ' 2 and D of the second node obtain the time offset 0 ff set of the second node and the first node, and cause the second node to calibrate the first according to the time offset
  • the local time of the two nodes is:
  • the present invention provides a second node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus
  • the physical layer chip includes a receiving time generating circuit, a sending time generating circuit, a transceiver, a crystal oscillator, a counter, a register, and a bus
  • the transceiver is configured to receive a first Sync synchronization message sent by the first node, where the first Sync message carries the The transceiver at the local time of the first node when the first Sync message is sent by a node is further configured to send a Delay-Req delay request message to the first node;
  • a central processing unit configured to acquire a time adjustment value of the second node, where the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req ⁇ message a time adjustment value of the second node;
  • the transceiver is further configured to receive a Delay-Resp delay response message sent by the first node, where the Delay-Resp message carries the first node to receive
  • the local time T of the first node and the time adjustment value of the first node are the time when the first node sends the first Sync message and the first node. a time adjustment value of the first node between the times when the Delay_Req message is received;
  • the central processing unit according ⁇ ⁇ , ⁇ 2, ⁇ , ⁇ link delay, and obtaining the second node and the first node).
  • the link delay between the second node and the first node is:
  • the transceiver is further configured to receive the second Sync sent by the first node, in a second possible implementation manner of the twentieth aspect.
  • a message, the second Sync message includes a local time of the first node when the first node sends the second Sync message
  • the processor is further configured to acquire a time offset 0 ff set of the second node and the first node according to i, D, and a local time ⁇ ′2 of the second node receiving the second Sync message, and And setting a local clock of the second node according to the time offset 0 ff set .
  • the time deviation of the second node from the first node is:
  • the present invention provides a first node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus.
  • the physical layer chip includes a receiving time generating circuit and transmitting a time generating circuit, a transceiver, a crystal oscillator, a counter, a register, and a bus, wherein: the transceiver is configured to send a first Sync synchronization message to the second node, where the first Sync message carries the first node The local time Tr of the first node when the first Sync message is sent, the transceiver is further configured to send a third Sync message to the second node, where the third Sync message includes The local time of the first node and the time adjustment value ⁇ ', ⁇ ' of the first node when the first node sends the third Sync message is the time when the first node sends the first Sync message a time adjustment
  • is a time adjustment value of the first node between a time when the first node sends the third Sync message and a time when the first node receives the Delay_Req message, where The time at which the second node receives the third Sync message is later than the time at which the second node sends the Delay_Req message; the transceiver is further configured to send a Delay to the second node.
  • the Delay-Resp message carries the local time of the first node when the first node receives the Delay-Req message, so that the second node is based on ⁇ ⁇ ⁇ ',
  • the local time of the second node and the time adjustment value of the second node when the second node receives the Sync message acquires a link delay between the second node and the first node, where The time adjustment value of the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message.
  • the link delay between the second node and the first node is:
  • the transceiver is further configured to send a second Sync to the second node.
  • the second Sync message includes a local time ⁇ of the first node when the first node sends the second Sync message, so that the second node is configured according to the ⁇ ,
  • the link delay L» and the local time of the second node when the second node receives the second Sync message acquire the time offset 0 ff set of the second node and the first node.
  • the time difference between the second node and the first node is:
  • the present invention provides a second node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus
  • the physical layer chip includes a time generation circuit, a transmission time generation circuit, a transceiver, a crystal oscillator, a counter, a register, and a bus
  • the transceiver is configured to receive a first Sync synchronization message sent by the first node, the first Sync The packet includes the local time T of the first node when the first node sends the first Sync message, and the transceiver is further configured to send a Delay_Req delay request message to the first node;
  • the central processing unit is configured to acquire a time adjustment value of the second node, where the second node receives the first Sync message and the second node sends the Delay_Req message. a time adjustment value of the second node between the times; the transceiver is further configured to receive a third Sync message sent by the first node, where the third Sync message includes the first node sending station The local time when the third Sync message is described and the time adjustment value ⁇ ′ of the first node are the time when the first node sends the first Sync message and the third node sends the third Sync time adjustment value between packets of the first node, wherein the third Sync message is the first node of the first node when the received ⁇ ⁇ Delay- Req message points The local time is sent to the second node, and the second node receives the third Sync message later than the second node sends the Delay_Req message; The transceiver is further configured to receive a Delay-Req sent by the first node.
  • the Delay_Resp message carrying the local time of the first node and the time adjustment value of the first node when the first node receives the Delay_Req message, and a a time adjustment value of the first node between a time when the first node sends the third Sync message and a time when the first node receives the Delay_Req message;
  • the central processing unit is configured to be based on ⁇ ⁇ , ⁇ 2, ⁇ ⁇ 4 , ⁇ and Ay obtain the link delay D of the second node and the first node.
  • the link delay between the second node and the first node is:
  • the transceiver is further configured to receive the second sent by the first node.
  • a Sync message the second Sync message includes a local time of the first node when the first node sends the second Sync message
  • the central processing unit is further configured to acquire the second node and the first node according to D, ⁇ , and the local time of the second node when the second node receives the second Sync message
  • the time offset of the node is 0 ff set and the local time of the second node is calibrated according to the time offset.
  • the time deviation of the second node from the first node is:
  • the present invention provides a first node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus
  • the physical layer chip includes a receiving time generating circuit, a sending time generating circuit, a transceiver, a crystal oscillator, a counter, a register, and a bus, wherein: the transceiver is configured to receive a Pdelay-Req delay request message sent by the second node;
  • the transceiver is further configured to send a Pdelay-Resp delay response message to the second node, where the Pdelay-Resp delay response message carries the first node to receive the Pdelay-Req ⁇ message a local time of the first node, a local time of the first node when the first node sends the Pdelay_Resp text, and a time adjustment value of the first node, so that the second node is configured according to when ⁇ 2, ⁇ ⁇ , the second node transmits a local time when the Gamma] Gen described Pdelay- Req 4 of the second node the second node receiving the Pdelay- Resp message to the second node
  • the local time and the time adjustment value of the second node acquire a link delay of the second node and the first node, where is the time and location of the first node receiving the Pdelay-Req message
  • the first node sends the Pdelay-Resp report
  • the link delay between the second node and the first node is:
  • the transceiver is further configured to send a Sync synchronization to the second node.
  • a message where the Sync message carries a local time of the first node when the first node sends the Sync message, so that the second node receives the location according to T, D, and the second node.
  • the time deviation of the second node from the first node is:
  • the present invention provides a second node, including a central processing unit, a crystal oscillator, a physical layer chip, a counter, a memory, and a bus, and the physical layer chip includes a receiving time generating circuit.
  • the transceiver is configured to send a Pdelay-Req delay request message to the first node; the transceiver is further configured to receive the a Pdelay-Resp delay response packet sent by the first node, where the Pdelay-Resp packet carries the local time of the first node when the first node receives the Pdelay_Req ⁇ The local time of the first node and the time adjustment value ⁇ of the first node when the node sends the Pdelay_Resp text, ⁇ is the time when the first node receives the Pdelay_Req message and the a time adjustment value of the first node between the time when the first node sends the Pdelay_Resp ⁇ text;
  • the central processing unit is configured to: according to 7 ⁇ ⁇ ⁇ , the local time of the second node when the second node sends the Pdelay
  • the link delay of the second node and the first node is:
  • the transceiver is further configured to receive the Sync sent by the first node. Synchronizing a message, the Sync message carrying a local time T of the first node when the first node sends the Sync message, and the central processing unit is further configured to perform according to ⁇ 1, D, and When the second node receives the Sync message, the local time of the second node is used to obtain the time offset # ⁇ of the second node and the first node, and the calibration is performed according to the time offset. The local time of the second node.
  • the time deviation of the second node from the first node is:
  • the first node during the frequency synchronization or time synchronization of the second node by the first node, the first node generates a time adjustment when a time adjustment event occurs.
  • the value is sent to the second node by using a PTP packet carrying time adjustment value, and when the second node also performs time adjustment during frequency synchronization or time synchronization, the time adjustment value is saved, and then the second The node acquires the second node according to the time adjustment value of the first node and the time adjustment value of the first node, and the sending time and the receiving time when the second node performs the PTP packet interaction with the first node.
  • the time adjustment value generated by the time adjustment event can solve the error problem of frequency synchronization or time synchronization of the PTP message, so that the frequency deviation or time deviation calculated by the second node is more accurate, which helps to improve the PTP message frequency.
  • the accuracy of synchronization or time synchronization can solve the error problem of frequency synchronization or time synchronization of the PTP message, so that the frequency deviation or time deviation calculated by the second node is more accurate, which helps to improve the PTP message frequency. The accuracy of synchronization or time synchronization.
  • FIG. 1 is a schematic flowchart of a method for synchronizing a precise clock protocol according to an embodiment of the present invention
  • FIG. 2 is a network architecture diagram according to an embodiment of the present invention
  • FIG. 3 is a PTP packet interaction diagram according to an embodiment of the present invention
  • FIG. 4 is a schematic flowchart of a method for synchronizing a precise clock protocol according to an embodiment of the present invention
  • FIG. 5 is a schematic flowchart of a method for synchronizing a precise clock protocol according to an embodiment of the present invention
  • FIG. FIG. 7 is a schematic flowchart of a method for synchronizing a precise clock protocol according to an embodiment of the present invention
  • FIG. 8 is a schematic flowchart of a method for synchronizing an accurate clock protocol according to an embodiment of the present invention
  • FIG. 10 is a schematic flowchart of a method for synchronizing a precise clock protocol according to an embodiment of the present invention
  • FIG. FIG. 11 is a schematic flowchart of a method for synchronizing a precise clock protocol according to an embodiment of the present invention.
  • FIG. 12 is a PTP packet interaction diagram according to an embodiment of the present invention.
  • FIG. 13 is an accurate clock protocol according to an embodiment of the present invention.
  • FIG. 14 is a schematic structural diagram of a first node according to an embodiment of the present invention.
  • FIG. 15 is a schematic structural diagram of a second node according to an embodiment of the present invention;
  • FIG. 17 is a schematic structural diagram of a second node according to an embodiment of the present invention;
  • FIG. 18 is a schematic structural diagram of a first node according to an embodiment of the present invention;
  • FIG. 20 is a schematic structural diagram of a first node according to an embodiment of the present invention;
  • FIG. 21 is a schematic structural diagram of a second node according to an embodiment of the present invention;
  • a schematic diagram of a node structure is provided.
  • FIG. 23 is a schematic structural diagram of a physical layer chip according to an embodiment of the present invention. detailed description
  • the “local time” in this patent application is the time displayed by the local clock device. For example, the local time of the sender when the sender sends a message. Or, the local time of the receiving end when the receiving end receives the message.
  • the “time” in this patent application is in contrast to "local time” in “contrast time”.
  • the reference time is the time displayed by other clock devices external to the local clock device.
  • the reference time may be Greenwich MeanTime (GMT), Coordinated Universal Time (English: Universal Time Coordinated, UTC) or Summer Time Saving Time (abbreviation: DST).
  • GTT Greenwich MeanTime
  • UTC Universal Time Coordinated
  • DST Summer Time Saving Time
  • the time adjustment event in this patent application refers to an event that triggers a time adjustment of a node.
  • the master clock device calibrates the local time of the slave clock device via PTP as a time adjustment event. Calibrating the local time of the slave clock device is a time adjustment event that occurs from the slave clock device.
  • the PTP-enabled node can be a router, a network switch, a packet transport network (PTN) device, or a wavelength-division multiplexing (WDM) device.
  • Synchronization is involved in PTP.
  • the Sync text in this patent application refers to the Sync text in the PTP.
  • Time adjustment or when Node B has time adjustment between the time when Node B receives two Sync messages from Node A, there is an error in the frequency deviation of Node B calculated by Node B relative to Node A.
  • the event that node A may be calibrated for example, the local clock of node A of the slave clock device is calibrated by the master clock device through PTP
  • the local clock of Node B may have an event that the local clock is calibrated (for example, the local clock of Node B as the slave clock device is calibrated by the master clock device through PTP).
  • time synchronization using PTP for example, in the scenario where Node B and Node A use PTP to maintain time synchronization, for the IEEE 1588-2008 protocol end-to-end (English: End to End, abbreviated: E2E) time synchronization mode
  • E2E End to End
  • An embodiment of the present invention provides an accurate clock protocol synchronization method, as shown in FIG. 1 , including:
  • the first node sends a 0th Sync synchronization message to the second node, where the
  • the 0 Sync message carries the local time of the first node when the first node sends the 0th Sync message.
  • the first node and the second node may be nodes in a 1588 synchronization network.
  • the first node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the first node and the second node are both devices that support PTP message communication.
  • the first node and the second node include means for recording a time adjustment value.
  • the first node and the second node are generally configured as 1588-2008. Standard E2E mode.
  • the first node and the second node may be configured as
  • the first node and the second node have a device for recording time adjustment
  • the first node points to the The second node sends the first time, that is, when the 0th Sync message is sent, A device for recording the time adjustment is started, so that the device for recording the time adjustment starts timing.
  • the 0th Sync message carries the local time of the first node when the first node sends the 0th Sync message. .
  • the second node When receiving the 0th Sync message, the second node starts a device for recording time adjustment in the second node, so that the device for recording time adjustment starts timing, and records the 0th Sync received.
  • the first node sends at least one Sync message to the second node, so that the second node is based on the second node.
  • the local time and the time adjustment value ⁇ of the first node when the second node sends the ith message is the time when the first node sends the ith first synchronization message and the first
  • the time adjustment value of the first node between the time when the node sends the ith synchronization message where is the time at which the second node receives the ith ith synchronization message and the second node receiving station
  • the time adjustment value of the second node between the times of the i-th synchronization message, N is a positive integer
  • i is all positive integer
  • the at least one Sync message does not include the 0th Sync message.
  • the at least one Syn message is the first Sync message.
  • the first Sync message is the same message as the Nth Sync message.
  • the at least one Syn ⁇ message includes a first Sync message to the Nth Sync message.
  • the first Sync message is different from the Nth Sync message.
  • the at least one Syn includes The first Sync message, the second Sync message, and the third Sync message.
  • the third Sync message is the Nth Sync message.
  • the sequence in which the first node sends the 0th Sync message to the Nth Sync message to the second node is the 0th Sync message to the Nth Sync message.
  • is the time adjustment value resulting from the time adjustment event of the first node. Between the time when the first node sends the ith Sync message and the time when the first node sends the ith Sync synchronization message, the first node only has a time adjustment event. , ⁇ is equal to the time adjustment value corresponding to the one time adjustment event.
  • a plurality of time adjustment events occur between the first node and the time when the first node sends the ith synchronization message and the first node sends the ith synchronization message.
  • is equal to the accumulated value of multiple time adjustment values corresponding to multiple time adjustment events.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • is approximately equal to the first time difference of the first node minus a second time difference, where the first time difference is the local time of the first node when the first node sends the ith synchronization message The difference between the local time of the first node when the first node sends the ith synchronization message, and the second time difference is the time when the first node sends the ith synchronization message and the first node The difference in time between the transmission of the i-th synchronization message. For example, when the first node sends the first packet to the second node according to the interval of sending the packet, the first node records that the first packet carries the first node and sends the first packet.
  • the first node, the second node, and the third node are included. All three nodes include a physical layer chip, a central processing unit, a crystal oscillator, a counter, and a memory for generating a message reception time and a message transmission time.
  • the memory includes data and instructions.
  • the third node is a primary clock device of the first node, and the first node is a primary clock device of the second node.
  • the time adjustment value is generated by the first node due to a time adjustment event during frequency synchronization or time synchronization of the second node.
  • the first node has a time adjustment event during this period.
  • the third node performs time synchronization on the first node, and the first node interacts with the third node to exchange PTP packets.
  • the first node calculates the time deviation according to the time of sending the PTP message and the receiving time of the PTP message, and adjusts the local time according to the time deviation.
  • the above time deviation is equal to the time adjustment value ⁇ of the first node.
  • the means for recording the time adjustment value in the first node may be a memory.
  • the time adjustment event of the first node may include: the first node interacts with the third node to exchange PTP packets.
  • the processor in the first node acquires the transmission time of the PTP 4 message and the reception time of the PTP 4 message from the physical layer chip.
  • the processor in the first node may calculate a time offset according to the sending time of the PTP packet and the receiving time of the PTP packet, so as to adjust the local time of the local clock of the first node according to the time offset. Adjusting the local time according to the time deviation is realized by the processor adjusting the value of the counter according to the time deviation. In this way, the processor can write the adjustment value of the counter into the memory.
  • the memory acquires a time adjustment value of the first node when the first node performs frequency synchronization on the second node.
  • the time adjustment value in the memory of the first node is carried in the Sync message and sent to the second node. For example, after the first node sends the first Sync message, the first node clears the device that records the time adjustment value in the first node to obtain the first Sync message and The adjustment time of the first node between the second Sync message.
  • is the time adjustment value resulting from the time adjustment event of the second node.
  • is equal to the time adjustment value corresponding to the time adjustment event; between the time when the second node receives the i-th synchronization message and the time that the second node receives the i-th synchronization message.
  • is equal to the accumulated value of the plurality of time adjustment values respectively corresponding to the plurality of time adjustment events.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • is approximately equal to the first time difference of the second node minus a second time difference, where the first time difference is the local time of the second node when the second node receives the ith synchronization message The difference between the local time of the second node when the second node receives the i-th synchronization message, and the second time difference is the time when the second node receives the i-th synchronization message and the second node The difference in time between receiving the i-th sync message.
  • the device for recording the time adjustment value in the second node may also be a memory.
  • the first node and the second node exchange PTP packets.
  • the processor in the second node calculates a time adjustment value of the second node according to a PTP 4 ⁇ message transmission time and a PTP 4 ⁇ message receiving time, so as to record the local time in the second node.
  • the counter is adjusted.
  • the processor in the second node stores the adjustment value of the counter as the time adjustment value of the second node in the memory of the second node.
  • is the accumulated value of the time adjustment value ⁇ of the first node between the 0th Sync message sent by the first node and the Nth Sync message sent to the second node at the time.
  • the accumulated value of the inter-adjustment value ⁇ ⁇ is the accumulated value of the ⁇ ⁇ when the i value is from 1 to N.
  • is a positive integer
  • the value of i ranges from 1 to all positive integers in ⁇
  • the transmission delay D of each Sync message is the same or varies
  • the second node calculates the second node and the first node according to the reception time generated by the second node and the received transmission time.
  • the frequency deviation is:
  • 0 local time of the first node indicating the local time of the first node when the first node sends the Nth Sync message, ⁇ .
  • indicating a local time of the second node when the second node receives the 0th Sync message indicating a local time of the second node when the second node receives the Nth Sync message.
  • the third node changes Is during a certain period of time, and the first node changes by 1.1 during the time period. s, then the frequency of the first node is 1.1 times that of the third node.
  • the time of the first node may be adjusted to make the time that the first node and the third node pass close. Thereby achieving a frequency approximate synchronization.
  • the first node may adjust -0.1 s at intervals, so that the time elapsed between the first node and the third node is close, where -0.1 s is the time adjustment value in this embodiment. ⁇ .
  • the -0.1s can be between two adjacent Sync messages. Perform a time adjustment to maintain frequency synchronization with the third node, or through multiple
  • Sync interaction adjustment -0.1 s keeps frequency synchronization with the third node.
  • the principle of the time adjustment value is similar to ⁇ and will not be described here.
  • the frequency of the first node and the third node may be equal or nearly equal by directly adjusting the frequency of the first node.
  • the first node may adjust its own frequency to the previous 1/1. 1 times to synchronize with the frequency of the third node.
  • the first node only needs to adjust the frequency once, so that the frequency of the first node is synchronized with the third node.
  • the first node will be according to itself. The small error is finely adjusted to maintain frequency synchronization with the third node.
  • the time adjustment value ⁇ between the adjacent Sync messages is 0. If the frequency deviation R calculated by the second node is greater than 1, the frequency of the second node is faster than the frequency of the first node, and the frequency value of the second node needs to be reduced; The frequency deviation R calculated by the node is less than 1, indicating that the frequency of the second node is slower than the frequency of the first node, and the frequency value of the second node needs to be increased; if the frequency deviation calculated by the second node is R Equivalent to 1 or close to 1, indicating that the frequency of the second node and the first node are already synchronized, and the second node is not required to perform frequency adjustment after receiving the sy nc message, or the two node 7 ⁇ sy nc after receiving the packet frequency can be adjusted, but the adjustment time is zero.
  • a byte may be added in the Sync message of the PTP protocol to record the time adjustment value of the first node between the two adjacent Sync message transmissions.
  • the format of the expanded Sync message is as shown in Table 1: Table 1 Extended Sync message format
  • the header indicates the Sync header of the Sync message
  • the originTimestamp indicates the start time identifier of the Sync packet, that is, the sending time of the first node to send the Sync packet
  • the timeAdjustvalue indicates that the first node sends the header.
  • the time adjustment value of the first node between the local time of the Sync message and the local time of sending a previous Sync message.
  • the time adjustment value timeAdjustvalue can be 10 bytes in length.
  • the above technical solution is to perform frequency synchronization on the ones-tep mode in the PTP protocol, as shown in FIG. 3, which is a packet interaction diagram of the first node and the second node, and the local time of the Sync message to be sent.
  • the information and the time adjustment value are carried in the Sync message and sent to the receiving node.
  • the frequency synchronization can also be performed in the two-step mode, that is, the local time information and the time adjustment value of the Sync message are carried in the Follow-Up message, for example.
  • the second node adjusts the local time information and the time according to the time in the Follow-Up message.
  • the local time and time adjustment value of the second node's own receiving Sync message calculates the frequency deviation of the second node from the first node.
  • the format of the expanded-up Follow-up message is as shown in Table 2: Table 2 Extended Follow-Up message format
  • header indicates the result of follow-Up
  • preciseOriginTimestam indicates that the follow-up time of the Follow-Up message is only i, that is, the sending time of the first node to send the Sync message
  • preciseTimeAdjustvalue indicates the first The time adjustment value of the first node between the local time when the node sends the Sync message and the local time of the last Sync message.
  • the time adjustment value preciseTimeAdjustvalue can be 10 bytes in length.
  • Embodiments of the present invention provide an accurate clock protocol synchronization method, where the first node When the Sync message is sent to the second node, the device that records the time adjustment value in the first node records the time adjustment value of the first node between the two adjacent Sync messages, where the second node When receiving the Sync message from the first node, the device that records the time adjustment value in the second node records a time adjustment value of the second node between two adjacent Sync messages, The second node is configured according to the time adjustment value of the first node, the time adjustment value of the second node, the local time when the first node sends the Sync message, and the local time when the second node sends the Sync message.
  • the first node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node receives a 0th Sync synchronization message from the first node, where the
  • the 0 Sync message carries the local time ⁇ of the first node when the first node sends the 0th Sync message. .
  • the second node receives the at least one Sync message sent by the first node, where the at least one Sync message includes an ith Sync message, where the first Sync message carries the first PDU.
  • the local time T " and the time adjustment value ⁇ , ⁇ of the first node when the node sends the i-th message to the second node is the time when the first node sends the ith-th synchronization message a time adjustment value of the first node between the time when the first node sends the ith synchronization message.
  • the second node is according to.
  • the local time of the first node is ⁇ when the first node sends the Nth Sync message, and the local time of the second node when the second node receives the 0th Sync message.
  • the second node receives the Nth Sync message, the local time of the second node, and the Ay acquires the frequency deviation between the second node and the first node, and calibrates the first according to the frequency offset.
  • is the time between the time when the second node receives the i-th synchronization message and the time that the second node receives the i-th synchronization message
  • the time adjustment value of the two nodes, N is a positive integer, i is all positive integers from 1 to N, and ⁇ is the time and location at which the first node sends the 0th Sync message.
  • the time adjustment value of the first node between the time when the first node sends the Nth Sync message is the time when the second node receives the 0th Sync message and the second node a time adjustment value of the second node between the times when the Nth Sync message is received.
  • the embodiment of the present invention provides an accurate clock protocol synchronization method, and the time synchronization mode of the PTP packet E2E is as shown in FIG. 5, including:
  • the first node sends a first Sync synchronization message to the second node, where the first Sync message carries an example of the local time ⁇ of the first node when the first node sends the first Sync message.
  • the first node is a network device, and specifically may be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the first node and the second node are devices that support ⁇ message transmission and reception.
  • the first node and the second node include means for recording a time adjustment value.
  • the intermediate node For the time synchronization manner, a plurality of intermediate nodes exist between the first node and the second node, and when an intermediate node supports the 1588-2008 standard, the intermediate node needs To perform the ⁇ ⁇ ⁇ forwarding, it is also necessary to perform time synchronization with the node of the intermediate node that supports the 1 588-2008 standard. When an intermediate node does not support the 1588-2008 standard, the intermediate node needs to forward the packet. , no time synchronization is required. Specifically, the first node sends a first Sync synchronization message to the second node, where the first node sends the first node to send the first Sync message to the second node.
  • the device for adjusting the value starts timing, and the information obtained by the second node includes ⁇ ⁇ and ⁇ . 302.
  • the first node receives a Delay-Req delay request message sent by the second node, and obtains a time adjustment value ⁇ of the first node, where the first node sends the first Sync message.
  • the second node sends a Delay_Req message to the first node, and acquires, between the second node, the first Sync message and the Delay_Req message.
  • the first node receives the
  • the time-adjusted value of the first node is obtained from the device that records the time adjustment value in the first node, and the first node is configured to receive the Delay-Req message when the first node receives the Delay-Req message.
  • the local time of the first node ⁇ .
  • the first node has a plurality of time adjustment events, ⁇ is equal to The accumulated value of the plurality of time adjustment values corresponding to the plurality of time adjustment events respectively.
  • the plurality of time adjustment events are in one-to-one correspondence with the plurality of time adjustment values.
  • the second node receives a plurality of time adjustment events between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message
  • the plurality of time adjustment events and the plurality of time adjustment values Therefore, after the second node sends the Delay_Req message to the first node, the information obtained by the second node includes, ⁇ ⁇ and .
  • the first node to the second node transmits the delayed response Delay- Resp message including the timing adjustment value Delay- Resp the first node and the second node according to, ⁇ 4,
  • the local time of the second node when the second node receives the first Sync message, and the local time T of the second node when the second node sends the Delay_Req message The time adjustment value of the second node acquires a link delay, where is the time between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message
  • the time adjustment value of the second node is described.
  • the first node After receiving the Delay_Req message, the first node carries ⁇ and ⁇ in a Delay-Resp message corresponding to the Delay-Req message, and sends the message to the second a node, the information obtained by the second node at this time includes, W
  • the recording of the time adjustment value by the first node and the recording of the time adjustment value Ay by the second node are implemented in the embodiment shown in FIG. The way is similar, not to repeat. Therefore, the second node calculates that the link delay of the second node and the first node may be:
  • D represents the link delay, indicating the local time of the first node when the first node sends the first Sync message, and ⁇ indicates that the second node receives the first Sync
  • the local time of the second node in the message ⁇ indicates the local time of the second node when the second node sends the Delay_Req message
  • indicates that the first node receives the Delay_Req local time at the first node packet, representing the first node 7 and the first time point adjustment time, represents the second node between ⁇ and ⁇ 7 the second node Adjust the time.
  • the first node sends a second Sync message to the second node, where the second Sync message carries the first node when the second Sync message is sent.
  • the local time ⁇ of the first node, the second node obtains the second time according to r, the local time ⁇ '2 and D of the second node when the second node receives the second Sync message a time offset ⁇ # ⁇ between the node and the first node, and causing the second node to calibrate the local time of the second node according to the time offset.
  • the time deviation can be:
  • Offset T 2 ' - T - D
  • ⁇ 2 ⁇ 4 ⁇ represents a time offset between the second node and the first node, and indicates that the first node sends the second Sync message
  • the local time of a node indicates the local time of the second node when the second node receives the second Sync message
  • D represents the link delay of the second node and the first node.
  • the second node needs to increase its local time value to keep synchronization with the first node; if ⁇ 3 ⁇ 4 ⁇ " is greater than 0, the second node needs to be itself The local time is reduced, and is synchronized with the first node; if the obtained 0 ff set 0 is close to 0, it indicates that the time of the second node and the first node is synchronized, and no adjustment is needed.
  • the time of the first node may be adjusted to -100s, so that the time of the first node and the third node are synchronized, where -100s is the time adjustment value of the first node.
  • the integer value may be that the first node performs the adjustment once and keeps synchronized with the time of the third node, or may be the time adjustment value that is adjusted during the packet interaction process by multiple Sync messages. Adjusting the frequency of the first node to synchronize the time of the first node with the third node. According to the above example, the frequency of the first node may be adjusted to 0.5 times of the third node, then after 200s The time of the third node is 300s, and the time of the first node is also 300s, the first section The point is synchronized with the time of the third node, and the frequency of the first node is adjusted to be the same as the frequency of the third node. At this time, the time adjustment value here is 0.
  • the time adjustment values are similar and will not be described again.
  • the interaction process between the first node and the second node in the implementation manner shown in FIG. 5 is as shown in FIG. 6.
  • a byte may be added to the Delay_Resp4 message to record the first node sending the Sync message and receiving the Delay-Req message.
  • the time adjustment value of the first node is described.
  • the format of the Delay-Resp message defined in Table 28 of IEEE 1588-2008 the format of the extended Delay-Resp message is as shown in Table 3:
  • the header represents the header of the Delay-Resp packet
  • the ReceiveTimestam indicates the local time of the first node when the first node receives the Delay-Req packet, for example, in this embodiment.
  • Request 4 requestingPortldentity indicates that the first node sends a request port identifier to the second node
  • timeAdjustvalue indicates that the first node before the first node receives the Delay_Req message
  • the time adjustment value of the first node between the sending time of the Sync message sent by the first node and the receiving time of the Delay-Req message is, for example, in this embodiment.
  • the timeAdjustvalue can be 10 bytes in length.
  • the link delay from the first node to the second node and the second node to the first node is the second node according to the TT W, and ⁇ The link delay between a node and the second node.
  • the time adjustment value is ⁇
  • the second node has time adjustment between 2 and 3
  • the time adjustment value is Ay
  • the time deviation obtained by the second node also has an error, and the error is also 2 .
  • An embodiment of the present invention provides an accurate clock protocol synchronization method, where the first node interacts with the second node to perform packet interaction, and uses the apparatus for recording a time adjustment value in the first node and the second node.
  • the device for recording the time adjustment value is timed, and the first node performs the adjustment of the first node between the first node sending the first Sync message and receiving the Delay_Req message in the Delay-Resp message by the first node.
  • the second node records an adjustment time of the second node between the second node receiving the first Sync message and sending the Delay_Req message, so that the second node Obtaining a link delay between the second node and the first node, and obtaining a time offset, so that the second node is calibrated according to the time offset, the local time of the interaction and the local time at the time of the adjustment, and the adjustment time.
  • the local clock of the second node the foregoing technical solution helps improve the time synchronization accuracy of the PTP packet.
  • the method of the technical solution shown in FIG. 5 may also be as shown in FIG.
  • the second node receives the first Sync synchronization packet sent by the first node, where The Sync packet carries the local time ⁇ of the first node when the first node sends the first Sync message.
  • the first node is a network device, and may be a router, a network switch, or a packet.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node sends a Delay-Req Delay Request message to the first node, and acquires a time adjustment value of the second node, where the second node receives the first Sync message. a time adjustment value of the second node between the time when the second node sends the Delay_Req ⁇ text.
  • the second node receives a Delay-Resp Delay Response message sent by the first node, where the Delay-Resp message carries the first node when the first node receives the Delay_Req file.
  • the local time T and the time adjustment value of the first node ⁇ , ⁇ is the time when the first node sends the first Sync message and the time when the first node receives the Delay_Req message The time adjustment value of the first node.
  • the second node acquires a link delay D of the second node and the first node according to ⁇ 2 , ⁇ ⁇ .
  • the second node receives the second Sync message sent by the first node, where the second Sync message carries the first node when the first node sends the second Sync message. Local time T,.
  • the second node acquires a time offset 0 ff set between the second node and the first node according to i, D, and a local time ⁇ ′2 of the second node receiving the second Sync message. And calibrating the local clock of the second node according to the time offset 0 ff set .
  • the implementation manner in the method flow shown in FIG. 7 is the same as the implementation manner in the method flow shown in FIG. 5, and details are not described herein again.
  • the embodiment of the present invention provides an accurate clock protocol synchronization method, in which the PTP packet E2E time synchronization mode is based on the technical solution shown in FIG. 5, if the first node sends the first node to the second node.
  • the third Sync message is sent to the second node, and the third Sync message is the second node in the direction.
  • the first node receives the Delay-Req Delay Request message and receives it. As shown in Figure 8, the method includes:
  • the first node sends a first Sync synchronization packet to the second node, where the first Sync packet carries the local time ⁇ of the first node when the first node sends the first Sync packet.
  • the first node is a network device, and specifically may be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device. The specific implementation of this step is the same as the step 301 in the embodiment shown in FIG. 5, and details are not described herein again.
  • the first node sends a third Sync message to the second node, where the third Sync message carries the locality of the first node when the first node sends the third Sync message.
  • Time 1 and the time adjustment value ⁇ ' of the first node, ⁇ ' is the time when the first node sends the first Sync message and the time when the first node sends the third Sync message The time adjustment value of the first node.
  • ⁇ ' is a time adjustment value of the first node between the seventh node
  • the third Sync message is after the first node sends the first Sync message to the second node. Sent to the second node.
  • the ⁇ ′ is obtained by the apparatus for recording the time adjustment value of the first node when the first node sends the third Sync message to the second node, and the recorded Is 7 ⁇ with the adjustment time of the first node between.
  • the first node records the local time T' of the first node when the first node sends the third Sync message. For example, only one time adjustment event occurs in the first node between the time when the first node sends the first Sync message and the time when the first node sends the third Sync message. In the scenario, ⁇ ' is equal to the time adjustment value corresponding to the one time adjustment event.
  • ⁇ ' Equal to multiple times corresponding to multiple time adjustment events Adjust the accumulated value of the value.
  • the plurality of time adjustment events are in one-to-one correspondence with the plurality of time adjustment values. For example, when the first node sends the third Sync message, after obtaining ⁇ ', the device for recording the time adjustment value in the first node may be cleared and restarted.
  • the obtained information includes 7 ⁇ , i, and the second node receives the first Sync message when the second node receives the first Sync message.
  • Local time ⁇ 2 The local time of the second node when the second node sends the Delay_Req delay request message.
  • the first node receives a Delay-Req delay request message sent by the second node, and obtains a time adjustment value ⁇ of the first node, where the first node sends the third Sync message.
  • the time adjustment value of the first node between the time when the first node receives the Delay_Req ⁇ message, and the time when the second node receives the third Sync message is late And the time at which the second node sends the Delay_Req message.
  • the second node After receiving the first Sync message sent by the first node, the second node sends a Delay_Req message to the first node, because the first node is sending the After the first Sync message, the third Sync message is sent to the second node, where the third Sync message is after the second node sends a Delay_Req message to the first node.
  • the first node After receiving the Delay_Req message, records the local time of the first node when the Delay-Req message is received.
  • the device for recording the time adjustment in the first node acquires the time adjustment value ⁇ of the first node between the first node and the second node.
  • is equal to the time adjustment value corresponding to the one time adjustment event.
  • the time at which the first node sends the third Sync message is connected to the first node.
  • is equal to the accumulated value of multiple time adjustment values corresponding to the multiple time adjustment events.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • The may be generated by a time adjustment between the first node and the first node, or may be an accumulated value of multiple time adjustments.
  • the value may also be 0, indicating that the first node has not made time adjustment.
  • ⁇ ' ⁇ , which means that the first node adjusts the time of the first node between 7 ;
  • the first node sends a Delay-Resp message to the second node, where the Delay-Resp message carries the locality of the first node when the first node receives the Delay-Req message.
  • the local time of the second node and the time adjustment value of the second node when the second node receives the Sync message acquires a link delay of the second node and the first node, The time adjustment value of the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message.
  • the information obtained by the second node includes, ⁇ ⁇ , ⁇ ', ⁇ and .
  • the second node can obtain the link delay of the second node and the first node according to the information.
  • the second node receives a plurality of time adjustment events between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message
  • the plurality of time adjustment events and the plurality of time adjustment values Taking the network architecture shown in FIG. 2 as an example, the device that records the time adjustment value of the first node records the time adjustment value and the time adjustment value, and the device adjusts the time adjustment value in the second node.
  • the record of the value is similar to the implementation shown in Figure 1, and will not be described again. Therefore, the second node calculates that the link delay of the second node and the first node may be:
  • D represents the link delay, indicating the local time of the first node when the first node sends the first Sync message, and ⁇ indicates that the second node receives the first Sync
  • the local time of the second node in the message ⁇ indicates the local time of the second node when the second node sends the Delay_Req message, and ⁇ indicates that the first node receives the Delay_Req
  • the local time of the first node in the message, ⁇ ' indicates the adjustment time between the first node and the first node, and the adjustment time of the first node between 7 and ⁇ indicates the second The adjustment time of the second node between the nodes ⁇ and ⁇ .
  • the first node sends a second Sync message to the second node, where the second Sync message carries the locality of the first node when the first node sends the second Sync message.
  • the time offset can be:
  • Offset T 2 ' - T[ - D
  • the time deviation indicates the local time of the first node when the first node sends the Sync ' message
  • indicates the second node
  • D indicates the link delay. For example, if # ⁇ is less than 0, the second node needs to adjust its own time to keep synchronization with the first node; if ⁇ is greater than 0, the second node It is necessary to slow down its own time and keep synchronized with the first node; if the obtained is equal to 0 or close to 0, it indicates that the time of the second node and the first node is synchronized, and no adjustment is needed.
  • the interaction process between the first node and the second node in the implementation manner shown in FIG. 8 is as shown in FIG. 9.
  • the format of the Delay-Resp packet in the implementation shown in FIG. 8 is similar to the format of the extended Delay-Resp packet shown in Table 3. The difference is that the extended Delay-Resp format is The time adjustment value represented by timeAdjustvalue is x'.
  • the timeAdjustvalue when the timeAdjustvalue is represented, it indicates that the first node sends the first Sync message time and receives the Delay_Req message, and does not send a new Sync message (for example, The third Sync message in this embodiment is sent to the second node; when the timeAdjustvalue is yes, the first node sends the first Sync message at the time and receives the Delay— Between the Req packets, a new Sync message (for example, the third Sync message in this embodiment) is sent to the second node, that is, the first node receives the Delay_Req message. Previously, the newly sent Sync message is the third Sync message.
  • the timeAdjustvalue when the timeAdjustvalue is represented, it indicates that the first node sends the first Sync message time and receives the Delay_Req message, and does not send a new Sync message (for example, The third Sync message in this embodiment is sent to the second node; when the timeAdjustvalue is yes,
  • the third Sync message also needs to be in an extended format to carry the first node to send the first Sync message and the first at 7 ⁇ .
  • the node adjusts the time adjustment value ⁇ ' between the third Sync message and the first node.
  • the extended format of the Sync '' message is the same as the expanded format in the onestep mode shown in Table 1, that is, the time adjustment value is carried in the timeAdjustvalue in Table 1. "Of course, it can also be carried for the twostep method.
  • the time adjustment value ⁇ ' wherein the expanded Follow-Up message has the same format as the Follow-Up message shown in Table 2.
  • An embodiment of the present invention provides an accurate clock protocol synchronization method, where the first node interacts with the second node to perform packet interaction, and uses the apparatus for recording a time adjustment value in the first node and the second node.
  • the device that records the time adjustment value performs timing
  • the first node sends a first Sync message to the second node, and after the second node sends a Delay_Req message to the first node, the first node sends the first Sync message.
  • a third Sync message carrying a time adjustment value ⁇ ' of the first node, the first node sending a Delay_Resp message to the second node, in a Delay_Resp message
  • the second node sends the third Sync message and receives the adjustment time of the first node between the Delay_Req message, and the second node acquires the second node to receive the first Sync message and Sending the adjustment time of the second node between the Delay-Req packets, so that the second node obtains the second node according to the local time when the packet interaction is sent, the local time at the time of receiving, and the adjustment time.
  • the link delay of the first node is used to obtain a time offset and the local clock of the second node is calibrated according to the time offset.
  • the foregoing technical solution helps improve the time synchronization precision of the PTP packet and improves the synchronization optimization performance.
  • the method of the technical solution shown in FIG. 8 may also be as shown in FIG.
  • the second node receives the first Sync synchronization packet sent by the first node, where the first Sync packet carries the locality of the first node when the first node sends the first Sync packet. time.
  • the first node is a network device, and specifically may be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node sends a Delay-Req delay request message to the first node, and acquires a time adjustment value of the second node, where the second node receives the first Sync message. a time adjustment value of the second node between the time when the second node sends the Delay_Req message.
  • the second node receives a third Sync message sent by the first node, where the third Sync message carries a local time when the first node sends the third Sync message, and the The time adjustment value ⁇ ' of the first node, ⁇ ' is the first time between the time when the first node sends the first Sync message and the time when the first node sends the third Sync message time adjustment value of the node, wherein the third Sync message is the first node in the ⁇ ⁇ the received packet when the Delay- Req
  • the local time of the first node is sent to the second node, and the second node receives the third Sync message later than the second node sends the Delay— The time of the Req message.
  • the second node receives a Delay-Resp delay response message sent by the first node, where the Delay-Resp message carries the first node when the first node receives the Delay_Req file.
  • the local time ⁇ and the time adjustment value ⁇ ' of the first node are the time when the first node sends the third Sync message and the time when the first node receives the Delay_Req message The time adjustment value of the first node.
  • the second node is configured according to ⁇ 2 , ⁇ ⁇ And obtaining a link delay of the second node and the first node.
  • the second node receives the second Sync message sent by the first node, where the second Sync message carries the first node when the first node sends the second Sync message.
  • FIG. 10 The implementation in the method flow shown in FIG. 10 is the same as the implementation in the method flow shown in FIG. 8, and details are not described herein again.
  • the embodiment of the present invention provides an accurate clock protocol synchronization, which is different from the time synchronization mode of the PTP 4 ⁇ text in the E2E scenario, as shown in FIG. 5 .
  • Figure 1 shows, including:
  • the first node receives a Pdelay-Req delay request message sent by the second node.
  • the first node and the second node may be nodes in a 1588 synchronization network.
  • the first node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the first node and the second node are both devices that support PTP message communication.
  • the first node and the second The node includes means for recording a time adjustment value.
  • the first node is a master clock device of the second node, and the first node is adjacent to the second node.
  • the first node receives the Pdelay-Req message sent by the second node
  • the local time of the first node is recorded when the Pdelay-Req message is received, and the first time is started.
  • a device that records time adjustment values in a node When the second node sends the Pdelay_Req message, the second node records the local time of the second node when the Pdelay_Req4 message is sent, and starts the second node at the same time.
  • a device for recording time adjustment values At this time, the information recorded by the second node includes.
  • the first node sends a Pdelay-Resp delay response packet to the second node, where the Pdelay-Resp delay response packet carries the first node when the first node receives the Pdelay-Req text.
  • the Pdelay-Resp message is sent by the first node to the second node for the received Pdelay_Req message. And when the first node sends the Pdelay_Resp message, acquiring, between the Pdelay_Req message and the sending the Pdelay-Resp message, the device that records the time adjustment value of the first node The time adjustment value of the first node is described.
  • the first node Carrying the Pdelay-Resp message, the first node returns the Pdelay - Resp 4 The local time of the first node and ⁇ . For example, only one time adjustment event occurs in the first node between the time when the first node receives the Pdelay_Req message and the time when the first node sends the Pdelay_Resp message. In the scenario, it is equal to the time adjustment value corresponding to the one time adjustment event.
  • the first node receives a plurality of time adjustment events between the time when the first node receives the Pdelay_Req message and the time when the first node sends the Pdelay-Resp message The accumulated value of the plurality of time adjustment values corresponding to the plurality of time adjustment events respectively.
  • the plurality of time adjustment events are aligned with the plurality of time adjustment values.
  • is the time adjustment value between ⁇ and ⁇ for the first node. It may be caused by multiple time adjustments between ⁇ and ⁇ , or it may be that the first node makes a time adjustment between ⁇ and ⁇ . It can be 0, indicating that the first node has not made time adjustments.
  • may be generated by other devices supporting the 1588 time synchronization protocol for time synchronization or frequency synchronization of the first node.
  • the second node acquires, from the device that records the time adjustment value, a time adjustment value between the Pdelay_Req message and the Pdelay-Resp message received by the second node.
  • a scenario in which only a time adjustment event occurs in the second node between the time when the second node sends the Pdelay_Req message and the time when the second node receives the Pdelay-Resp message Next, equal to the time adjustment value corresponding to the one time adjustment event.
  • the second node generates a plurality of time adjustment events between the time when the second node sends the Pdelay_Req message and the time when the second node receives the Pdelay-Resp message
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • the sum of the adjustment times of the plurality of time adjustments between 7 and 4 may be made for the second node. It is also possible that the second node has only made one time adjustment between and between. It may be 0, indicating that the second node has not made time adjustment.
  • the second node clears the device for recording the time adjustment value in the second node after the recording, and waits for the next Pdelay-Req message to be sent back again.
  • the device that records the time adjustment value in the first node records the time adjustment value, and the device adjusts the time adjustment value in the second node.
  • the record is similar to the implementation in the embodiment shown in FIG. 1, and will not be described again here.
  • the information obtained by the second node includes, ⁇ 2 , ⁇ ⁇ ⁇ and .
  • the second node may obtain a link delay D of the second node and the first node, which may be expressed as:
  • D represents the link delay, indicating the local time of the second node when the second node sends the Pdelay_Req 4 message, indicating that the first node receives the Pdelay-Req
  • D represents the link delay
  • indicates the local time of the first node when the first node sends the Pdelay_Resp text
  • Ay represents the second node and adjust the time between the ⁇ ⁇ .
  • the time of the first node may be adjusted to -100s, so that the time of the first node and the third node are synchronized, where -100s is the time adjustment value of the first node.
  • the time adjustment value may be that the first node performs the adjustment once and keeps synchronized with the time of the third node, or may be the Sync message interaction for the message delivery.
  • the time of the first node and the third node may also be synchronized by adjusting a frequency of the first node.
  • the frequency of the first node may be adjusted to 0.5 times of the third node, then after 200s, the time of the third node is 300s, and the time of the first node is also 300s, the first The time of one node and the third node are kept synchronized, and the frequency of the first node is adjusted to be the same as the frequency of the third node.
  • the time adjustment value here is o.
  • the time adjustment values are similar and will not be described again.
  • the first node sends a Sync synchronization message to the second node, where the Sync message carries a local time of the first node when the first node sends the Sync message, so that The second node obtains the time offset # ⁇ of the second node and the first node according to the local time of the second node when the second node receives the Sync message, and the time difference
  • the second node calibrates the local clock of the second node according to the time offset.
  • the time offset ⁇ 3 ⁇ 4 ⁇ " can be:
  • Offset T 2 ' - T[ - D
  • ⁇ 2 ⁇ 4 ⁇ " indicates the time deviation of the second node from the first node, indicating the local time when the first node sends the Sync message
  • ⁇ '2 indicates the local time when the second node receives the Sync message
  • D indicates the link delay of the second node and the first node. For example, if it is less than 0, then The second node needs to adjust its own time to keep synchronized with the first node; if ⁇ 3 ⁇ 4 ⁇ " is greater than 0, the second node needs to slow down its own time and keep with the first node. Synchronization; if the obtained is equal to 0 or close to 0, it indicates that the time of the second node and the first node is synchronized, and no adjustment is needed.
  • the interaction process between the first node and the second node in the implementation manner shown in FIG. 11 is as shown in FIG. 12 .
  • a byte may be added to the Pdelay-Resp message, and the first node is configured to receive the Pdelay-Req message and send the Pdelay-Resp message.
  • the time adjustment value of the first node between the texts is shown in Table 4: Table 4 Extended Pdelay-Resp packet format
  • the header of the Pdelay-Resp packet includes the local time of the first node when the first node sends the Pdelay_Resp message, and the time when the Pdelay-Req message is received.
  • the time difference of the local time ⁇ of the first node, ? ⁇ ⁇ - ⁇ ⁇ , said first node sends said requestReceiptTimestamp represents the local time when the packet Pdelay- Resp the first node ⁇
  • requestingPortldentity represents the first node before sending the Pdelay- Resp message Gen Port identifier, timeAdjustvalue indicating that the local time when the first node receives the Pdelay_Req file is sent by the first node
  • the timeAdjustvalue can be 10 bytes in length.
  • time synchronization for the onestep mode that is, the local time and time adjustment value when sending is carried in the Pdelay-Resp message and sent to the receiving node, or may be directed to the twoste mode.
  • Time synchronization is performed, and the local time and time adjustment value to be sent is carried in the Pdelay_Resp_Follow-Up message, for example, the first node sends the During the Pdelay-Resp message, the Pdelay-Resp_Follow-Up message is then sent to the second node, and the second node adjusts the time according to the time information and time in the Pdelay-Resp-Follow-Up message.
  • the header indicates that the Pdelay-Resp-Follow-Up message header includes the local time when the first node sends the Pdelay-Resp message and receives the Pdelay-Req message.
  • the time difference of the local time ⁇ indicates the local time of the first node when the first node sends the Pdelay_Resp message
  • timeAdjustvalue indicates that the first node receives the Pdelay – the time adjustment value of the first node between the local time of the Req text and the local time when the Pdelay-Resp message is sent.
  • the timeAdjustvalue can be 10 bytes in length.
  • the time adjustment value is ⁇
  • the second node has a time adjustment between 7; and ⁇ 4 , and the time adjustment value is Ay, then the actual link delay between the first node and the second node
  • the time deviation obtained by the second node also has an error, and the error is also ⁇ ! ⁇ .
  • the embodiment of the present invention provides a method for synchronizing a precise clock protocol.
  • the recording time adjustment value in the first node and the second node is utilized.
  • the device performs timing, and the first node carries the adjustment time of the first node between the Pdelay-Req message and the Pdelay-Resp message sent by the first node in the Pdelay-Resp message.
  • the second node records an adjustment time of the second node between the Pdelay_Req message and the Pdelay-Resp message sent by the second node, so that the second node is configured according to 4 ⁇ Obtaining a link delay between the second node and the first node, and obtaining a time delay of the second node and the first node, and adjusting the second node according to the time offset
  • the above technical solution helps to improve the time synchronization accuracy of PTP packets and improve synchronization optimization performance.
  • the process of the technical solution shown in FIG. 11 can also be performed as shown in FIG. 13 and includes:
  • the second node sends a Pdelay_Req delay request message to the first node.
  • the second node receives a Pdelay-Resp delay response packet sent by the first node, where the Pdelay-Resp packet carries the first node when receiving the Pdelay-Req
  • the local time ⁇ of a node, the local time of the first node when the first node sends the Pdelay_Resp text, and the time adjustment value ⁇ of the first node is that the first node receives the Pdelay - a time adjustment value of the first node between the time of the Req message and the time at which the first node sends the Pdelay_Resp message. 803.
  • the second node receives the Pdelay_Res according to the local time ⁇ ⁇ of the second node when the second node sends the P delay_Req message according to ⁇ , ⁇ ⁇
  • the local time of the second node and the time adjustment value of the second node obtain the link delay of the second node and the first node, where is the second node sending station
  • the time adjustment value of the second node between the time of the Pdelay_Req message and the time when the second node receives the P delay-Resp message.
  • the second node receives a Sync synchronization message sent by the first node, where the Sync message carries a local time ⁇ of the first node when the first node sends the Sync message.
  • D and the second node receives the local time of the Sync message acquisition time ⁇ second node the second node and the first node offset 0 # s And calibrating the local clock of the second node according to the time offset.
  • the implementation in the method flow shown in FIG. 13 is the same as the implementation in the method flow shown in FIG. 11, and details are not described herein again.
  • the first node is an execution entity, and the scenario for frequency synchronization is as shown in FIG. 14 is a schematic structural diagram of the first node.
  • the first node can be used to perform the method shown in FIG.
  • the first node 0 1 includes: a sending unit 0 1 1 , configured to send a 0th Sync synchronization message to the second node, where the 0th Sync message carries the first The local time T of the first node when a node sends the 0th Sync. .
  • the sending unit 0 1 1 is further configured to send at least one Sync message to the second node, so that the second node is according to the foregoing.
  • the local time of the first node is ⁇ when the first node sends the Nth Sync message, and the local time of the second node when the second node receives the 0th Sync message.
  • the second node receives the Nth Sync message, the local time of the second node, and Ay acquires a frequency deviation between the second node and the first node, and causes the second node to
  • the frequency offset calibrates a local clock of the second node, where the at least one Sync message includes an i-th Sync message, and the i-th Sync message carries
  • the local time and the time adjustment value ⁇ of the first node when the first node sends the i-th message to the second node is that the first node sends the i-1th a time adjustment value of the first node between a time when the synchronization message is sent and a time when the first node sends the ith synchronization message, where the second node receives the ith ith synchronization message
  • the first node and the second node may be nodes in a 1588 synchronization network.
  • the first node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the first node and the second node are both devices that support PTP message communication.
  • the first node and the second node include means for recording a time adjustment value.
  • the first node is a master clock device of the second node, where when there is an intermediate node that does not support the 1588-2008 standard between the first node and the second node, the first node
  • the node and the second node are generally configured in the E2E mode of the 1588-2008 standard.
  • the first node and the second node may be configured as a standard E2E mode or a P2P mode of 1588-2008. For example, it may be due to the time adjustment event of the first node The time adjustment value of the birth.
  • the first node only has a time adjustment event between the time when the first node sends the ith Sync message and the time when the first node sends the ith Sync synchronization message. In the scenario, it is equal to the time adjustment value corresponding to the one time adjustment event.
  • is equal to the accumulated value of the plurality of time adjustment values corresponding to the plurality of time adjustment events respectively.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • it may be a time adjustment value generated due to a time adjustment event of the second node.
  • the second node only has a time adjustment event between the time when the second node receives the i-th Sync message and the time when the second node receives the i-th Sync synchronization message.
  • is equal to the time adjustment value corresponding to the one time adjustment event.
  • is equal to the accumulated value of the plurality of time adjustment values corresponding to the plurality of time adjustment events respectively.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • An embodiment of the present invention provides a method for synchronizing a precise clock protocol.
  • the device that records the time adjustment value in the first node records two adjacent ones.
  • a time adjustment value of the first node between the Sync messages the second node recording the adjacent two by the device for recording the time adjustment value in the second node when receiving the Sync message from the first node.
  • the time adjustment value of the second node between the Sync messages the second node according to the time adjustment value of the first node, the time adjustment value of the second node, and the first node sending a Sync message
  • the technical solution helps improve the frequency synchronization accuracy of the PTP packet.
  • the second node 02 includes: a receiving unit 02 1 , configured to receive a 0th Sync synchronization message from the first node, where the 0th Sync message carries the first node to send The 0th Sync is the local time T 0 of the first node.
  • the receiving unit 02 1 is further configured to receive at least one Sync message sent by the first node, where the at least one Sync message includes an Nth Sync message, and the at least one Sync message includes an ith message Sync, the ith Sync message carries the local time and time adjustment value of the first node when the first node sends the ith message to the second node, ⁇ is the time adjustment value of the first node between the time when the first node sends the i-th synchronization message and the time when the first node sends the i-th synchronization message.
  • the processing unit 022 is configured to: when the first node sends the Nth Sync message, the local time of the first node is ⁇ , and when the second node receives the 0th Sync The local time T of the second node, the local time of the second node when the second node receives the second Sync message, and Ay obtain the frequency deviation of the second node from the first node, and Calibrating a local clock of the second node according to the frequency offset, where ⁇ ⁇ is a time when the second node receives the ith ith synchronization message and the second node receives the ith ith The time adjustment value of the second node between the times of the synchronization message, N is a positive integer, and i is all positive integers from 1 to N, which is the time when the first node sends the 0th Sync message.
  • the frequency deviation between the second node and the first node is:
  • Ax ⁇ j
  • Ax i Ax l + Ax 2 + ⁇ ⁇ ⁇ + Ax N
  • the first node 03 includes: a sending unit 03 1 configured to send a first Sync synchronization message to the second node, where the first Sync message carries the first node to send the The local time of the first node when the first Sync message is sent.
  • the first node and the second node may be a router, a switch, a ⁇ or a wavelength division device, and the first node and the second node are devices that support ⁇ message transmission and reception.
  • the first node and the second node include means for recording a time adjustment value.
  • a time synchronization manner a plurality of intermediate nodes exist between the first node and the second node, and when an intermediate node supports the 1588-2008 standard, the intermediate node needs To perform the ⁇ ⁇ ⁇ forwarding, it is also necessary to perform time synchronization with the node of the intermediate node that supports the 1588-2008 standard. When an intermediate node does not support the 1588-2008 standard, the intermediate node needs to forward the packet. No time synchronization is required.
  • the receiving unit 032 is configured to receive a Delay_Req delay request sent by the second node.
  • the obtaining unit 033 is configured to obtain the time adjustment value ⁇ of the first node, where is the time when the first node sends the first Sync message and the time when the first node receives the Delay_Req message A time adjustment value between the first nodes. For example, only one time adjustment event occurs in the first node between the time when the first node sends the first Sync message and the time when the first node receives the Delay_Req message. In the scenario, it is equal to the time adjustment value corresponding to the one time adjustment event.
  • the first node occurs a plurality of times between the time when the first node sends the first Sync message and the time when the first node receives the Delay_Req message
  • is equal to the accumulated value of multiple time adjustment values corresponding to multiple time adjustment events.
  • the plurality of time adjustment events are in one-to-one correspondence with the plurality of time adjustment values.
  • the sending unit 03 1 is further configured to send a Delay_Resp delay response message to the second node, where the Delay_Resp file includes a time adjustment value ⁇ of the first node to enable the second node According to ⁇ 4 , ⁇ , the local time ⁇ of the second node when the second node receives the first Sync message, and the second time when the second node sends the Delay_Req message
  • the local time T of the node and the time adjustment value of the second node acquire a link delay, where the second node receives the first Sync message and the second node sends the Delay_Req
  • a time adjustment event occurs in the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message. In the scenario, it is equal to the time adjustment value corresponding to the one time adjustment event.
  • the second node receives a plurality of time adjustment events between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message
  • the accumulated value of the plurality of time adjustment values corresponding to the plurality of time adjustment events respectively.
  • the plurality of time adjustment events are aligned with the plurality of time adjustment values.
  • the first node After receiving the Delay_Req message, the first node carries 7 ⁇ and ⁇ in the Delay-Resp message corresponding to the Delay-Req message, and sends the message to the second node.
  • the information obtained by the second node at this time includes 7 , ⁇ ⁇ ⁇ ⁇ and . Therefore, the link delay between the second node and the first node is:
  • the sending unit 03 1 is further configured to: send a second Sync message to the second node, where the second Sync message carries the first node when the second Sync message is sent
  • the local time of the first node causes the second node to be according to i
  • the second node receives the second Sync message the local time ⁇ '2 and D of the second node acquires the time H 0 ff set of the second node and the first node, and causes the second
  • the node calibrates the local clock of the second section, ⁇ according to the time offset.
  • the second node needs to adjust its own time.
  • the embodiment of the present invention provides a first node, where the first node and the second node perform packet interaction, and the device that records the time adjustment value in the first node and the recording time in the second node are used.
  • the device for adjusting the value performs timing, and the first node carries the adjustment time of the first node between the first node sending the Sync message and the receiving the Delay-Req message in the Delay-Resp message, and the first node
  • the second node records the adjustment time of the second node between the second node receiving the Sync message and the sending the Delay_Req message, so that the second node receives the local time and receives according to the message interaction.
  • the foregoing technical solutions can improve the time synchronization precision of PTP packets and improve synchronization optimization performance.
  • the second node is an execution entity
  • the time synchronization scenario is as shown in FIG. 17 is a schematic structural diagram of the second node
  • the second node 04 includes: a receiving unit 041, configured to: Receiving a first Sync synchronization message sent by the first node, where the first Sync message carries a local time ⁇ ⁇ of the first node when the first node sends the first Sync message.
  • the sending unit 042 is configured to send a Delay_Req Delay Request message to the first node.
  • An obtaining unit 043 configured to acquire a time adjustment value of the second node, where a time adjustment value of the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message.
  • the receiving unit 041 is further configured to receive a Delay-Resp Delay Response message sent by the first node, where the Delay-Resp message carries the first node when receiving the Delay-Req message.
  • a local time of a node, and a time adjustment value of the first node, ⁇ is that the first node sends the first
  • the time adjustment value of the first node between the time of the Sync message and the time when the first node receives the Delay_Req message.
  • the processing unit 044 is configured to: according to ⁇ , ⁇ ⁇ 4, and acquire a link delay between the second node and the first node).
  • the link delay between the second node and the first node is:
  • the receiving unit 041 is further configured to receive the second Sync message sent by the first node, where the second Sync message carries the first node when the second Sync message is sent by the first node.
  • the processing unit 044 is further configured to acquire the second node and the first node according to D, ⁇ , and the local time of the second node when the second node receives the second Sync message
  • the time offset of the node is G ⁇ , and the local clock of the second node is calibrated according to the time offset.
  • the first node 05 includes: a sending unit 051, configured to send a first Sync synchronization message to the second node, where the first Sync message carries the first node to send the The local time of the first node is 7 when a Sync message is sent.
  • the sending unit 051 is further configured to send a third Sync message to the second node.
  • the third Sync message carries the local time 1 of the first node and the time adjustment value ⁇ ', ⁇ ' of the first node when the first node sends the third Sync message. a time adjustment value of the first node between a time when the first node sends the first Sync message and a time when the first node sends the third Sync message.
  • ⁇ ' is a time adjustment value of the first node between the seventh node
  • the third Sync message is after the first node sends the first Sync message to the second node. Sent to the second node.
  • the ⁇ ′ is obtained by the apparatus for recording the time adjustment value of the first node when the first node sends the third Sync message to the second node, and the recorded Is 7 ⁇ with the adjustment time of the first node between.
  • the first node records the local time T' of the first node when the first node sends the third Sync message. For example, only one time adjustment event occurs in the first node between the time when the first node sends the first Sync message and the time when the first node sends the third Sync message. In the scenario, ⁇ ' is equal to the time adjustment value corresponding to the one time adjustment event.
  • ⁇ ' The accumulated value of the plurality of time adjustment values corresponding to the plurality of time adjustment events respectively.
  • the plurality of time adjustment events are in one-to-one correspondence with the plurality of time adjustment values. For example, when the first node sends the third Sync message, after obtaining ⁇ ', the device for recording the time adjustment value in the first node may be cleared and restarted.
  • the obtained information includes, ⁇ , the second node receives the first Sync message, and the second node The local time of the node, the local time of the second node when the second node sends the Delay-Req delay request message, and '.
  • the receiving unit 052 is configured to receive a Delay-Req delay sent by the second node. Request 4 documents.
  • the obtaining unit 053 is configured to acquire the time adjustment value ⁇ of the first node, where the time when the first node sends the third Sync message and the time when the first node receives the Delay_Req message a time adjustment value of the first node, where the second node receives the third Sync message later than the second node sends the Delay_Req message. For example, after receiving the first Sync message sent by the first node, the second node sends a Delay_Req message to the first node, because the first node is sending the After the first Sync message, the third Sync message is sent to the second node, where the third Sync message is after the second node sends a Delay_Req message to the first node.
  • the first node After receiving the Delay_Req message, records the local time of the first node when the Delay-Req message is received.
  • the device for recording the time adjustment in the first node acquires the time adjustment value ⁇ between the first node and the first node. For example, only one time adjustment event occurs in the first node between the time when the first node sends the third Sync message and the time when the first node receives the Delay_Req message. In the scenario, ⁇ is equal to the time adjustment value corresponding to the one time adjustment event.
  • the first node generates a plurality of time adjustment events between the time when the first node sends the third Sync message and the time when the first node receives the Delay_Req message, which is equal to The cumulative value of the plurality of time adjustment values corresponding to the time adjustment events respectively.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • the ⁇ may also be generated by a time adjustment performed by the first node between 7 and 7, or may be an accumulated value of multiple time adjustments, or may be 0. The fact that ⁇ is equal to 0 indicates that the first node has not made time adjustment.
  • the sending unit 05 1 is further configured to send a Delay_Resp message to the second node, where the Delay-Resp message carries the first node when the first node receives the Delay-Req message.
  • the local time of the second node and the time adjustment value of the second node when the second node receives the Sync message acquires a link delay between the second node and the first node, where a time adjustment value of the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message.
  • the second node only receives a time adjustment event between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message. It is equal to the time adjustment value corresponding to the one time adjustment event.
  • the second node receives a plurality of time adjustment events between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message
  • the plurality of time adjustment events are aligned with the plurality of time adjustment values.
  • the link delay between the second node and the first node is:
  • the sending unit 05 1 is further configured to: send a second Sync message to the second node, where the second Sync message carries the first node when the second Sync message is sent
  • the local time of the first node is '1', so that the second node is local to the second node according to the T, the link delay D, and the second node receives the Sync ' message Time acquiring the time offset 0 ff set of the second node and the first node.
  • the embodiment of the present invention provides a first node, the first node and the first node.
  • the device that records the time adjustment value in the first node When the two nodes perform message interaction, the device that records the time adjustment value in the first node is used.
  • the device for recording the time adjustment value in the second node performs timing, and the first node sends a first Sync message to the second node, and when the second node sends a Delay to the first node, After receiving the Req packet, the third Sync packet sent by the first node is received, where the third Sync packet carries the time adjustment value ⁇ " of the first node, and the first node is to the first node.
  • the second node sends a Delay-Resp message, and the Delay-Resp message carries the adjustment time of the first node between the first node sending the Sync message and the receiving the Delay-Req message, where the second node is Obtaining, by the second node, the adjustment time of the second node between receiving the Sync message and sending the Delay_Req message, so that the second node sends the local time according to the packet interaction and the local time when receiving the message And adjusting the time, obtaining a link delay of the second node and the first node, thereby obtaining a time offset and calibrating the local clock of the second node according to the time offset, where the foregoing technical solution helps to improve the PTP packet.
  • the second node is used as an execution subject, and the scenario for time synchronization is as shown in FIG. 19 is a schematic structural diagram of the second node.
  • the method shown in Figure 10 is performed.
  • the second node 06 includes: a receiving unit 061, configured to receive a first Sync synchronization message sent by the first node, in the first Sync message And sending, by the first node, the local time of the first node when the first Sync is sent.
  • the sending unit 062 is configured to send a Delay_Req delay request message to the first node.
  • the receiving unit 061 is further configured to receive a third Sync message sent by the first node, where the third Sync message carries the first node to send the third Sync
  • a time adjustment value ⁇ ', Ax" of the first node is between a time when the first node sends the first Sync message and a time when the first node sends the third Sync message time adjusting values of said first node, wherein the third Sync message is the first node in the received ⁇ ⁇ Delay- Req message to the And sending, by the second node, the local time T 4 of the first node to the second node, and the second node receives the third Sync message later than the second node sending station.
  • the receiving unit 061 is further configured to receive a Delay-Req Delay Request message sent by the first node, where the Delay-Resp message carries the first node when receiving the Delay-Req message.
  • the local time of the first node and the time adjustment value ⁇ of the first node are the time when the first node sends the third Sync message and the first node receives the Delay_Req message. a time adjustment value of the first node between times;
  • Processing unit 064 configured to use, according to the ⁇ ⁇ , ⁇ 2, ⁇ ⁇ ⁇ and Ay obtain a link delay D of the second node and the first node.
  • the link delay between the second node and the first node is:
  • the receiving unit 061 is further configured to receive the second Sync message sent by the first node, where the second Sync message carries the first node when the second Sync message is sent by the first node.
  • the processing unit 064 is further configured to acquire a time deviation of the second node from the first node according to D, and a local time of the second node when the second node receives the Sync′ message And calibrating the local clock of the second node according to the time offset.
  • the first node can be used to perform the method shown in FIG. Referring to FIG. 20, the first node 07 includes: a receiving unit 071, configured to receive a Pdelay-Req delay request message sent by the second node.
  • the first node and the second node may be a 1588 synchronization network.
  • the first node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the second node is a network device, and may specifically be a router, a network switch, or a packet transport network device.
  • the first node and the second node are both devices that support PTP message communication.
  • the first node and the second node include means for recording a time adjustment value.
  • the first node is an upstream node of the second node, and the first node is adjacent to the second node.
  • the first node receives the Pdelay-Req message sent by the second node
  • the local time of the first node is recorded when the Pdelay-Req message is received, and the first time is started.
  • the second node sends the Pdelay_Req message
  • the second node records and sends the Pdelay_Req4 message when the local time of the second node is ⁇ ⁇ , and starts the first
  • the information recorded by the second node includes.
  • a sending unit 072 configured to send a Pdelay-Resp delay response message to the second node, where the Pdelay-Resp delay response message carries the first node when the first node receives the Pdelay_Req file Local time ⁇ , the local time of the first node when the first node sends the Pdelay_Resp text and the time adjustment value ⁇ of the first node, so that the second node is based on ⁇ , ⁇ ⁇ , ⁇ local time when the node sending the packet Gen Pdelay- Req 4 of the second node the second node receiving the packet Pdelay- Resp the second node and the local time ⁇
  • the Pdelay-Resp message is sent by the first node to the second node for the received Pdelay_Req message.
  • Recording time adjustment value from the first node when the first node sends the Pdelay_Resp file The device obtains a time adjustment value of the first node between receiving the Pdelay_Req message and sending the Pdelay-Resp message.
  • the Pdelay-Resp message carries the local time ⁇ and ⁇ of the first node when the first node returns the Pdelay_Resp4 message. For example, only one time adjustment event occurs in the first node between the time when the first node receives the Pdelay_Req message and the time when the first node sends the Pdelay_Resp message.
  • is equal to the time adjustment value corresponding to the one time adjustment event.
  • the second node acquires, from the device that records the time adjustment value, a time adjustment value between the Pdelay_Req message and the Pdelay-Resp message received by the second node.
  • a scenario in which only a time adjustment event occurs in the second node between the time when the second node sends the Pdelay_Req message and the time when the second node receives the Pdelay-Resp message Next, equal to the time adjustment value corresponding to the one time adjustment event.
  • the second node generates a plurality of time adjustment events between the time when the second node sends the Pdelay_Req message and the time when the second node receives the Pdelay-Resp message
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • the second node clears the device for recording the time adjustment value in the second node after recording, and waits for the next Pdelay-Req message to be sent to restart timing.
  • the link delay between the second node and the first node is:
  • the sending unit 072 is further configured to send a Sync synchronization message to the second node, where the Sync message carries a local time of the first node when the first node sends the Sync message, so that Obtaining, by the second node, the time deviation ⁇ ⁇ of the second node and the first node according to i, D, and the local time of the second node when the second node receives the Sync message And causing the second node to calibrate the local clock of the second node according to the time offset.
  • the embodiment of the present invention provides a second node, where the first node and the first node When the two nodes perform the packet interaction, the device uses the first node and the second node to record the time adjustment value, and the first node carries the first node in the Pdelay-Resp packet.
  • the second node Receiving, by the second node, the adjustment time of the first node between the Pdelay_Req message and the sending of the Pdelay-Resp message, and the second node recording, by the second node, the Pdelay-Req message and receiving The adjustment time of the second node between the Pdelay-Resp packets, so that the second node obtains the second node according to the local time when the 4th message is transmitted and the local time and the adjustment time at the time of receiving The link delay with the first node, thereby obtaining a time offset and adjusting the local clock of the second node according to the time offset.
  • the foregoing technical solution helps improve the time synchronization precision of the PTP packet and improves the synchronization optimization. can.
  • the second node is used as the main body, and the time synchronization scenario is as shown in FIG. 21, which is a schematic structural diagram of the second node, where the first node 08 includes: a sending unit 081, configured to: Send a Pdelay-Req Delay Request message to the first node.
  • the receiving unit 082 is configured to receive a Pdelay-Resp delay response packet sent by the first node, where the Pdelay-Resp packet carries the first node when the first node receives the Pdelay_Req ⁇ message
  • the local time of the node ⁇ the local time of the first node when the first node sends the Pdelay_Resp text
  • the first The time adjustment value of the node is a time adjustment value of the first node between the time when the first node receives the Pdelay_Req message and the time when the first node sends the Pdelay_Resp ⁇ message.
  • the processing unit 083 is configured to: according to ⁇ 2, ⁇ ⁇ , the local time ⁇ of the second node when the second node sends the Pdelay_Req message, the second node receives the Pdelay_Resp text
  • the local time of the second node and the time adjustment value of the second node acquire the link delay Z) of the second node and the first node, where the second node sends the Pdelay
  • the time adjustment value of the second node between the time of the Req message and the time when the second node receives the Pdelay-Resp message.
  • the link delay between the second node and the first node is:
  • the receiving unit 082 is further configured to receive a Sync synchronization message sent by the first node, where the Sync message carries the locality of the first node when the first node sends the Sync message.
  • Time T The processing unit 083 is further configured to acquire the second node and the first node according to the local time of the second node when the second node receives the Sync message Time offset # ⁇ , and calibrating the local clock of the second node according to the time offset.
  • the embodiment of the present invention provides a node 09. As shown in FIG. 22, the node includes central processing.
  • Unit 091 (English: central processing unit, abbreviation: CPU), crystal oscillator 092, physical layer (English: physical layer, abbreviation: PHY) chip 093, counter 094, memory 095 and bus 096, wherein the memory 095 can include data and instructions,
  • the PHY may include a reception time generation circuit 0931, a transmission time generation circuit 0932, a transceiver 0933, a crystal oscillator 0934, a counter 0935, a register 0936, and a bus 0937.
  • the crystal oscillator 092 is coupled to the counter 094, and the counter 094 Coupled with the memory 095, the crystal oscillator 092 outputs a square wave at a certain frequency, and the counter 094 counts the number of the square waves.
  • the counter 094 performs an accumulation operation on the active edge of each square wave, and the result of the accumulation operation is stored in the memory 095.
  • the value stored in memory 095 corresponds to the local time of the node's local clock.
  • the operating voltage of the crystal oscillator 092 is related to the frequency of the crystal oscillator 092. The higher the operating voltage of the crystal oscillator 092, the higher the frequency of the crystal oscillator 092.
  • the value of the counter 0935 corresponds to the local time of the physical layer chip 093, where the counter 0935 is different from the counter 094 in the local node.
  • the receiving time generating circuit reads the value in the counter 0935, and writes the value of the counter 0935 in the physical layer chip to the register 0936, and the central processing unit 091 can access the physical layer chip 093.
  • Register 0936 in order to obtain the reception time of the PTP message; when the physical layer chip 093 sends the PTP message, the transmission time generation circuit in the physical layer chip reads the value of the counter 0935, and writes the value of the counter 0935 into the register 0936
  • the central processing unit can access the register 0936 to obtain the transmission time of the PTP message.
  • the time adjustment event in the embodiment of the present invention may be that the master clock node performs time synchronization on the slave clock node. Specifically, the central processing unit 091 in the slave clock node obtains the PTP 4 message transmission with the master clock node.
  • the central processing unit 091 can calculate the time adjustment value, that is, the time deviation according to the transmission time of the PTP message and the reception time of the PTP message, and the central processing unit 091 adjusts the local time according to the time deviation.
  • the local time of the clock may specifically adjust the value of the counter 094 of the local clock according to the time offset, and the central processing unit 091 writes the adjusted local time to the memory 095 and writes the time adjustment value to the memory 095.
  • the frequency adjustment event may be that the master clock node performs frequency synchronization on the slave clock node. Specifically, the central processor 091 in the slave clock node obtains the transmission time of the PTP message with the master clock node and the reception of the PTP message.
  • the frequency adjustment value may be calculated according to the sending time of the PTP message and the receiving time of the PTP message, and the frequency adjustment value is saved to the memory 095, and the central processing unit 091 further determines the operating voltage of the crystal oscillator 092 according to the frequency of the crystal oscillator 092.
  • the vibration 092 is adjusted to the working power of the crystal oscillator 092.
  • the first node of the first node and the second node in the foregoing embodiment is an execution entity, and the transceiver is configured to send a frequency to the second node, where the first node performs frequency synchronization on the second node.
  • the 0th Sync message includes the local node transceiver execution instruction of the first node when the transceiver sends the 0th Sync message, and is further used to the second
  • the node sends at least one Sync message to make the second node according to.
  • the local time of the first node is ⁇ when the first node sends the Nth Sync message, and the local time of the second node when the second node receives the 0th Sync message.
  • the second node receives the Nth Sync message, the local time of the second node, and Ay acquires a frequency deviation between the second node and the first node, and causes the second node to
  • the frequency offset calibrates a local clock of the second node, where the at least one Sync message includes an i-th Sync message, and the i-th Sync message carries the first node to the a local time and a time adjustment value of the first node when the second node sends the ith message, where is the time at which the first node sends the ith synchronization message and the first The time adjustment value of the first node between the time when the node sends the ith synchronization message, where is the time at which the second node receives the ith ith synchronization message and the second node receiving station
  • N is a positive integer
  • i is all positive integers from 1 to N
  • is the first node sends
  • is the time adjustment value resulting from the time adjustment event of the first node.
  • the first node only has a time adjustment event between the time when the first node sends the ith Sync message and the time when the first node sends the ith Sync synchronization message. In the scenario, it is equal to the time adjustment value corresponding to the one time adjustment event.
  • a plurality of time adjustments occur between the time when the first node sends the ith synchronization message and the time when the first node sends the ith synchronization message
  • is equal to the accumulated value of multiple time adjustment values corresponding to multiple time adjustment events.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • is the time adjustment value resulting from the time adjustment event of the second node.
  • the second node only has a time adjustment event between the time when the second node receives the i-th Sync message and the time when the second node receives the i-th Sync synchronization message.
  • is equal to the accumulated value of the plurality of time adjustment values corresponding to the plurality of time adjustment events respectively.
  • the plurality of time adjustment events correspond to the plurality of time adjustment values.
  • the frequency deviation between the second node and the first node is:
  • the 0th Sync message carries the local time of the first node when the first node sends the 0th Sync message.
  • the transceiver is further configured to execute the instruction, and is further configured to receive the at least one Sync message sent by the first node, where the at least one Sync message includes an i-th Sync message, the ith Sync message
  • the file includes the local time 7 ⁇ and the time adjustment value ⁇ of the first node when the first node sends the i-th message to the second node, where ⁇ is the first node sends the i-th
  • the time adjustment value of the first node between the time of the synchronization message and the time when the first node sends the ith synchronization message
  • the central processing unit is configured to send, according to the first node, the Nth Sync The local time TN of the first node, ⁇ , and the second node when the second node receives the 0th Sync message Time.
  • the second node receives the Nth Sync message, the local time w of the second node, and obtains a frequency deviation between the second node and the first node, and calibrates the first according to the frequency deviation.
  • a local clock of the two nodes where ⁇ is the time between the time when the second node receives the i-th synchronization message and the time that the second node receives the i-th synchronization message
  • the time adjustment value of the two nodes N is a positive integer, i is all positive integers from 1 to N, and ⁇ is the time at which the first node sends the 0th Sync message and the first node sends the a time adjustment value of the first node between times of the Nth Sync message, where the second node receives the 0th Sync message and the second node receives the Nth
  • the time adjustment value of the second node between the times of the Sync message.
  • the frequency deviation between the second node and the first node is:
  • the first node is the execution entity, and the transceiver in the first node sends the first Sync synchronization message to the second node, where the first node is in the E2E time synchronization scenario.
  • the local time transceiver of the first node is further configured to receive a Delay-Req delay request sent by the second node
  • the central processing unit is configured to obtain a time adjustment value ⁇ of the first node, where ⁇ is the time when the first node sends the first Sync message and the time when the first node receives the Delay_Req message a time adjustment value of the first node;
  • the transceiver is further configured to send a Delay-Resp delay response message to the second node, where the Delay_Resp message includes a time adjustment value of the first node and
  • the second node sends the Delay_Req message according to the local time of the second node when the second node receives the first Sync message according to the second node.
  • the local time of the second node ⁇ , and the second section The link delay time adjustment value acquisition), wherein
  • Ay is the time at which the second node receives the first Sync message and the second node The time adjustment value of the second node between the times when the Delay_Req message is sent.
  • the link delay between the second node and the first node is:
  • the transceiver is further configured to send a second Sync message to the second node, where the second Sync message carries the first node to send the second The local time T of the first node in the Sync message, so that the second node obtains the local time ⁇ and D of the second node according to i, the second node receives the second Sync message Time deviation of the second node from the first node
  • the time deviation between the second node and the first node is:
  • Offset T 2 ' - T[ - D, for the first node to the second node in the E2E time synchronization scenario, the second node is the execution subject, and the transceiver is configured to receive the first node a first Sync synchronization message sent, where the first Sync message carries the first node, and the local time transceiver of the first node is further used to send the first Sync message
  • the node sends a Delay-Req delay request message
  • the central processing unit is configured to acquire a time adjustment value of the second node, where the time at which the second node receives the first Sync message is sent by the second node.
  • the transceiver is further configured to receive a Delay-Resp delay response sent by the first node, the Delay - the Resp message carries the local time ⁇ 4 of the first node when the first node receives the Delay_Req message, and the time adjustment value ⁇ , Ax of the first node is the first node Sending the first Sync message to the first node And a time adjustment value of the first node between the times of receiving the Delay_Req message; the central processing unit is configured to acquire the chain of the second node and the first node according to 7 , ⁇ 2 , ⁇ ⁇ Road delay D.
  • the link delay between the second node and the first node is:
  • the transceiver is further configured to receive the second Sync message sent by the first node, where the second Sync message carries the first node to send the second Sync
  • the local time T of the first node is used by the processor 122 to execute the instruction for acquiring the second node according to the local time of the second node receiving the second Sync message.
  • Time 0 ff set with the first node, and calibrating the local clock of the second node according to the time offset ⁇ .
  • the time deviation between the second node and the first node is:
  • the first node performs E2E time synchronization on the second node
  • the third Sync message is sent to the second node
  • the third Sync message is after the second node sends the Delay_Req delay request message to the first node.
  • the received time synchronization may be implemented by: using the first node as an execution subject, the transceiver is configured to send a first Sync synchronization message to the second node, where the first Sync message carries the transmitter 133.
  • the local time ⁇ of the first node in the first Sync message is further configured to send a third Sync message to the second node, where the third Sync message carries a transmitter and sends a third
  • the local time 1 of the first node and the time adjustment value ⁇ ', ⁇ ' of the first node when the Sync message is the time when the first node sends the first Sync message and the first node Time adjustment of the first node between times when the third Sync message is sent
  • the transceiver is further configured to receive a Delay-Req delay request message sent by the second node, where the central processing unit acquires a time adjustment value of the first node, where the first node sends the third Sync message.
  • the transceiver is further configured to send a Delay_Resp message to the second node, the Delay - the Resp message carries the local time ⁇ and ⁇ of the first node when the first node receives the Delay_Req message, so that the second node according to the ⁇ ⁇
  • the local time of the second node and the time adjustment value of the second node when the second node receives the Sync message acquires a link delay between the second node and the first node, where a time adjustment value of the second node between the time when the second node receives the first Sync message and the time when the second node sends the Delay_Req message.
  • the link delay between the second node optionally, the link delay between the second no
  • the transceiver is further configured to send a second Sync message to the second node, where the second Sync message carries the first node when the first node sends the second Sync message
  • the local time is such that the second node acquires the second time according to the i, the link delay, and the local time of the second node when the second node receives the second Sync message.
  • the time deviation between the second node and the first node is:
  • the transceiver is configured to receive the first node a first Sync synchronization message sent, where the first Sync message carries the first node, and the local time transceiver of the first node is further used to send the first Sync message
  • the node sends a Delay-Req delay request message
  • the central processor is configured to obtain a time adjustment value of the second node, where the second node receives the first Sync message and the second node sends the The time-adjusted value of the second node between the time of the Req message;
  • the transceiver is further configured to receive the third Sync message sent by the first node, where the third Sync message carries the The local time when the node sends the third Sync message and the time adjustment value of the first node are the time when the first node sends the first Sync
  • the transceiver is further configured to receive the second Sync message sent by the first node, where the second Sync message carries the first node to send the Second Sync 4 local time of the first node
  • the central processing unit is further configured to acquire the time of the second node and the first node according to D, ⁇ , and the local time ⁇ ' 2 of the second node when the second node receives the second Sync message
  • the offset is 0 ff set and the local time of the second node is calibrated according to the time offset.
  • the time deviation between the second node and the first node is:
  • the first node is the execution subject
  • the transceiver is configured to receive the second node a Pdelay-Req delay request message
  • the transceiver is further configured to send a Pdelay-Resp delay response message to the second node, where the Pdelay-Resp delay response message carries the first node to receive the Pdelay-Req
  • the local time of the second node and the time adjustment value of the second node acquire a link delay of the second node
  • the transceiver is further configured to send a Sync synchronization message to the second node, where the Sync message carries the first node when the Sync message is sent. Decoding the local time of the first node, so that the second node acquires the second node and the local time according to T, D, and the local time of the second node when the second node receives the Sync message a time offset of the first node and causing the second node to calibrate the local time of the second node based on the time offset.
  • the time deviation between the second node and the first node is:
  • the transceiver is configured to send to the first node Pdelay-Req delay request message; the transceiver is further configured to receive the sending by the first node a Pdelay-Resp message, where the Pdelay-Resp message carries the local time of the first node when the first node receives the Pdelay-Req message, and the first node sends the Pdelay - Resp ⁇
  • the local time of the first node and the time adjustment value ⁇ of the first node, the time at which the first node receives the Pdelay_Req message and the first node sending station The time adjustment value of the first node between the times of the Pdelay-Resp message; the central processing unit according to ⁇ 2 , ⁇ ⁇ , the second node sends the Pdelay-Req message when the
  • the transceiver is further configured to receive a Sync synchronization packet sent by the first node, where the Sync packet carries the first node to send the Sync 4
  • the local processing unit is further configured to acquire the second node according to the local time of the second node when the second node receives the Sync message according to the local time of the first node. time and the first point of a deviation ° ff set, the local time offset calibration and the second node based on the time.
  • the time deviation between the second node and the first node is:
  • Offset T 2 ' - T[ - D
  • the disclosed nodes and methods may be implemented in other manners.
  • the node embodiments described above are only illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical or otherwise.
  • each functional unit may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit.
  • the above units may be implemented in the form of hardware or in the form of hardware plus software functional units.
  • All or part of the steps of implementing the above method embodiments may be performed by hardware associated with the program instructions, and the foregoing program may be stored in a computer readable storage medium.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, and a read only memory (English: read-only memory, abbreviation : ROM), random access memory (English: random-access memory, abbreviated: RAM), disk or optical disk, and other media that can store program code.
  • ROM read-only memory
  • RAM random access memory
  • disk or optical disk and other media that can store program code.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

本发明实施例提供一种精确时钟协议同步方法和节点,涉及通信领域、电力领域、自动化领域和医药领域等,有助于提高PTP报文频率同步和时间同步的精度。其方法为:第二节点在与第一节点进行频率同步或时间同步的过程中,报文交互的过程需要记录相邻报文间第一节点和第二节点的时间调整值,以根据报文发送时的本地时间和接收时的本地时间以及时间调整值获取第二节点与第一节点的频率偏差,或根据报文发送时的本地时间和接收时的本地时间以及时间调整值获取第二节点与第一节点的链路延时,并且使第二节点根据链路延时获得时间偏差,以根据时间偏差校准第二节点的本地时钟。本发明实施例用于频率同步和时间同步。

Description

精确时钟协议同步方法和节点 技术领域 本发明涉及通信领域、 电力领域、 自动化领域和医药领域等, 尤其涉及精确时钟协议同步方法和节点。
背景技术
传统的方式是使用物理层信号来达到频率同步,随着技术的发 展, 越来越多的设备使用报文进行频率同步。 在无线网络中, 设备 之间不仅可以使用报文进行频率同步,还可以使用报文进行时间同 步。 当前技术中, 电气电子工程师学会 (英文: Institute of Electrical and Electronic Engineers , 缩写: IEEE ) 1588-2008标准使用精确时钟 协议 (英文: Precision Time Protocol , 缩写: PTP ) 才艮文进行频率同 步和时间同步。 使用 ΡΤΡ进行同步可能存在一定的误差,从而影响 ΡΤΡ频率同 步和 ΡΤΡ时间同步的精度。
发明内容 本发明提供精确时钟协议同步方法和节点, 有助于减少 ΡΤΡ 报文进行频率同步和时间同步的误差问题, 有助于提高 ΡΤΡ 同步 的精度。
为达到上述目 的, 本发明釆用如下技术方案:
第一方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括: 第一节点向第二节点发送第 0个 Sync 同步报文, 所述第 0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所述第 一节点的本地时间 Γι'ΰ
所述第一节点向所述第二节点发送至少一个 Sync报文, 以使 所述第二节点根据7。、 所述第一节点发送第 N个 Sync报文时所述 第一节点的本地时间 Δ 、 所述第二节点接收所述第 0个 Sync 报文时所述第二节点的本地时间 。、 所述第二节点接收所述第 N 个 S ync报文时所述第二节点的本地时间 T 和 获取所述第二节点 与所述第一节点的频率偏差,并且使所述第二节点根据所述频率偏 差校准所述第二节点的本地时钟, 其中, 所述至少一个 Sync报文 包含第 i个 Sync报文, 所述第 i个 Sync报文中携带所述第一节点 向所述第二节点发送所述第 i个报文时所述第一节点的本地时间 T" 和时间调整值^^ , ^是所述第一节点发送第 i- 1个同步报文的时间 与所述第一节点发送第 i个同步报文的时间之间所述第一节点的时 间调整值, ^是所述第二节点接收所述第 i- 1个同步报文的时间与 所述第二节点接收所述第 i个同步报文的时间之间所述第二节点的 时间调整值, N为正整数, i是 1至 N中的所有正整数, A是所述 第一节点发送所述第 0个 Sync报文的时间与所述第一节点发送所 述第 N个 Sync报文的时间之间所述第一节点的时间调整值, 是 所述第二节点接收所述第 0个 Sync报文的时间与所述第二节点接 收所述第 N个 Sync报文的时间之间所述第二节点的时间调整值。 结合第一方面, 在第一方面的一种可能实现的方式中, 所述第 二节点与所述第一节点的频率偏差为:
T - T - Av ~ T2fi -∑Ayi
= ί
T N—T、。—f^ 其中, = Δχ:,· = + Δ¾ +… + ΑχΝ , Ay = ^ Ay. =八 + y2 +… + AyN。 第二方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括: 第二节点从第一节点接收第 0个 Sync同步报文, 所述第 0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所述第 一节点的本地时间 。;
所述第二节点接收所述第一节点发送的至少一个 Sync报文, 所述至少一个 Sync报文包含第 i个 Sync报文, 所述第 i个 Sync 报文中携带所述第一节点向所述第二节点发送所述第 i个报文时所 述第一节点的本地时间 T"和时间调整值 , ^是所述第一节点发 送第 i- 1 个同步报文的时间与所述第一节点发送第 i个同步报文的 时间之间所述第一节点的时间调整值; 所述第二节点根据7。、 所述第一节点发送第 N个 Sync报文时 所述第一节点的本地时间 ^ Δ 、 所述第二节点接收所述第 0 个
Sync 报文时所述第二节点的本地时间 。、 所述第二节点接收第 N 个 S ync报文时所述第二节点的本地时间 T 和 获取所述第二节点 与所述第一节点的频率偏差,并根据所述频率偏差校准所述第二节 点的本地时钟, 其中, ^是所述第二节点接收所述第 i- 1个同步报 文的时间与所述第二节点接收所述第 i个同步报文的时间之间所述 第二节点的时间调整值, N为正整数, i是 1至 N中的所有正整数, ^是所述第一节点发送所述第 0个 Sync报文的时间与所述第一节 点发送所述第 N个 Sync报文的时间之间所述第一节点的时间调整 值, 是所述第二节点接收所述第 0个 Sync报文的时间与所述第 二节点接收所述第 N个 Sync报文的时间之间所述第二节点的时间 调整值。
结合第二方面, 在第二方面的一种可能实现的方式中, 所述第 二节点与所述第一节点的频率偏差为:
N
R _ T 1 2 N - T 2,0 - Av W ∑ i
N N
其中, Δ = ^ Δ . = + Δ 2 + · - + AxN , Ay = ^ Ay. = + Ay2 + · - + AyN。 第三方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括: 第一节点向第二节点发送第一 Sync同步报文, 所述第一 Sync 报文中携带所述第一节点发送所述第一 Sync报文时所述第一节点 的本地时间 ι ; 所述第一节点接收所述第二节点发送的 Delay— Req 延迟请求 报文, 并获取所述第一节点的时间调整值 Α , Δ是所述第一节点发 送所述第一 Sync报文的时间与所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点的时间调整值; 所述第一节点向所述第二节点发送 Delay— Resp 延迟响应才艮 文, 所述 Delay— Resp报文包括所述第一节点的时间调整值 ^和 ^ , 以使所述第二节点根据 、 4、 、所述第二节点接收所述第一 Sync 报文时所述第二节点的本地时间 ^、 所述第二节点发送所述 Delay— Req 文时所述第二节点的本地时间 T 和所述第二节点的 时间调整值 获取链路延时 其中, 是所述第二节点接收所述第 一 Sync报文的时间与所述第二节点发送所述 Delay— Req报文的时 间之间所述第二节, 的时间调整值。 结合第三方面, 在第三方面的第一种可能实现的方式中, 所述 第二节点与所述第一节点的链路延时为:
D_(T4-Tl-Ax)-(T3-T2-Ay)
_ 2 结合第三方面的第一种可能实现的方式中,在第三方面的第二 种可能实现的方式中, 所述方法还包括: 所述第一节点向所述第二节点发送第二 Sync报文, 所述第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述第一 节点的本地时间 使所述第二节点根据 i、 所述第二节点接收所 述第二 Sync报文时所述第二节点的本地时间 ^'2和 D获取所述第二 节点与所述第一节点的时间偏差 ^¾ ^ 并且使所述第二节点根据所 述时间偏差校准所述第二节点的本地时钟。
结合第三方面的第二种可能实现的方式,在第三方面的第三种 可能实现的方式中, 所述第二节点与所述第一节点的时间偏差为: Offset = T2'-T -D 第四方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括: 第二节点接收第一节点发送的第一 Sync同步报文, 所述 Sync 报文中携带所述第一节点发送所述第一 Sync报文时所述第一节点 的本地时间 τι; 所述第二节点向所述第一节点发送 Delay— Req延迟请求报文, 并获取所述第二节点的时间调整值 , 是所述第二节点接收所 述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req报文 的时间之间所述第二节点的时间调整值; 所述第二节点接收所述第一节点发送的 Delay— Resp延迟响应 报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 ^ , 和所述第一节点的 时间调整值 ^, 是所述第一节点发送所述第一 Sync报文的时间 与所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节 点的时间调整值;
所述第二节点根据 、 τ2、 τ Τ4、 Δ 和 获取所述第二节点 与所述第一节点的链路延时 D。 结合第四方面, 在第四方面的第一种可能实现的方式中, 所述 第二节点与所述第一节点的链路延时为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2 结合第四方面的第一种可能实现的方式,在第四方面的第二种 可能实现的方式中, 所述方法还包括:
所述第二节点接收所述第一节点发送的第二 Sync报文, 所述 第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述 第一节点的本地时间 T、;
所述第二节点根据 ή、 )以及所述第二节点接收所述第二 Sync 报文的本地时间 获取所述第二节点与所述第一节点的时间偏差 °ffset , 并根据所述时间偏差 °ffset校准所述第二节点的本地时钟。 结合第四方面的第二种可能实现的方式,在第四方面的第三种 可能实现的方式中, 所述第二节点与所述第一节点的时间偏差为: Offset = T2' - T - D 第五方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括: 第一节点向第二节点发送第一 Sync同步报文, 所述第一 Sync 报文中携带所述第一节点发送所述第一 Sync报文时所述第一节点 的本地时间 ; 所述第一节点向所述第二节点发送第三 Sync报文, 所述第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时所述第一 节点的本地时间 和所述第一节点的时间调整值 Δ '是所述第 一节点发送所述第一 Sync报文的时间与所述第一节点发送所述第 三 Sync报文的时间之间所述第一节点的时间调整值; 所述第一节点接收所述第二节点发送的 Delay— Req 延迟请求 报文, 并获取所述第一节点的时间调整值 ^是所述第一节点 发送所述第 三 Sync 报文的 时 间 与 所述第 一节点接收所述 Delay— Req ^文的时间之间所述第一节点的时间调整值, 其中, 所 述第二节点接收到所述第三 S y n c报文的时间晚于所述第二节点发 送所述 Delay— Req报文的时间; 所述第一节点向所述第二节点发送 Delay— Resp 报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req报文时 所述第一节点的本地时间 ^和 ', 以使所述第二节点根据7 i、 T
Δ '、 所述第二节点接收所述 Sync 4艮文时所述第二节点的本地 时间 ^以及所述第二节点的时间调整值 获取所述第二节点与所 述第一节点的链路延时 Z) , 其中, Ay是所述第二节点接收所述第一
Sync报文的时间与所述第二节点发送所述 Delay— Req报文的时间 之间所述第二节点的时间调整值。 结合第五方面, 在第五方面的第一种可能实现的方式中, 所述 第二节点与所述第一节点的链路延时为:
D (H A _ Δ ') _ (Γ3 _ Γ2 _ Δ
_ 2 结合第五方面的第一种可能实现的方式,在第五方面的第二种 可能实现的方式中, 所述方法还包括: 所述第一节点向所述第二节点发送第二 Sync报文, 所述第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述第一 节点的本地时间 T'l , 以使所述第二节点根据所述 i、 所述链路延时
D以及所述第二节点接收所述 Sync '报文时所述第二节点的本地时 间 获取所述第二节点与所述第一节点的时间 ¾ 0ffset。 结合第五方面的第二种可能实现的方式,在第五方面的第三种 可能实现的方式中, 所述第二节点与所述第一节点的时间偏差为: Offset = T2' - T - D 第六方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括: 第二节点接收所述第一节点发送的第一 Sync 同步报文, 所述 第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述 第一节点的本地时间 Tr, 所述第二节点向所述第一节点发送 Delay— Req延迟请求报文, 并获取所述第二节点的时间调整值 , 是所述第二节点接收所述 第 ― Sync报文的时间与所述第二节点发送所述 Delay— Req报文的 时间之间所述第二节点的时间调整值;
所述第二节点接收所述第一节点发送的第三 Sync报文, 所述 第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时的本 地时间 和所述第一节点的时间调整值 Δ ' , Δ '是所述第一节点发 送所述第一 Sync 报文的时间与所述第一节点发送所述第三 Sync 报文的时间之间所述第一节点的时间调整值, 其中, 所述第三 Sync 报文是所述第一节点在 τι与接收到所述 Delay— Req报文时所述第一 节点的本地时间 ^之间发送至所述第二节点的, 且所述第二节点接 收到所述第三 Sync 报文的时间晚于所述第二节点发送所述 Delay— Req报文的时间;
所述第二节点接收所述第一节点发送的 Delay— Resp延迟响应 报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 ^和所述第一节点的时 间调整 是所述第一节点发送所述第三 Sync报文的时间与 所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点 的时间调整值; 所述第二节点根据 、 Τι、 Τ Τ
Figure imgf000009_0001
Δ 以及 获取所述第 二节点与所述第一节点的链路延时 )。 结合第六方面, 在第六方面的第一种可能实现的方式中, 所述 第二节点与所述第一节点的链路延时为:
D (H A _Δ ') _(Γ32
_ 2 结合第六方面的第一种可能实现的方式,在第六方面的第二种 可能实现的方式中, 所述方法还包括:
所述第二节点接收所述第一节点发送的第二 Sync报文, 所述 第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述 第一节点的本地时间 T、;
所述第二节点根据 )、 ^以及所述第二节点接收所述 Sync '报 文时所述第二节点的本地时间 ^ ' 2获取所述第二节点与所述第一节 点的时间偏差 0ffset,并且根据所述时间偏差校准所述第二节点的本 地时钟。 结合第六方面的第二种可能实现的方式,在第六方面的第三种 可能实现的方式中, 所述第二节点与所述第一节点的时间偏差为: Offset = T2' - T[ - D 第七方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括: 第一节点接收第二节点发送的 Pdelay— Req延迟请求报文; 所述的第一节点向所述第二节点发送 Pdelay— Resp延迟响应报 文, 所述 Pdelay— Resp延迟响应报文中携带所述第一节点接收所述 Pdelay— Req ^艮文时所述第一节点的本地时间 ^、 所述第一节点发送 所述 Pdelay— Resp 文时所述第一节点的本地时间 ^以及所述第一 节点的时间调整值 Α , 以使所述第二节点根据 ^、 τ 、 所述第 二节点发送所述 Pdelay— Req ^艮文时所述第二节点的本地时间 τι、 所述第二节点接收所述 Pdelay— Resp报文时所述第二节点的本地时 间 ^以及所述第二节点的时间调整值 获取所述第二节点与所述 第一节点的链路延时 D , 其中 , Δ 是所述第一节点接收所述
Pdelay— Req 报文的时间与所述第一节点发送所述 Pdelay— Resp 报 文的时间之间所述第一节点的时间调整值, 是所述第二节点发 送所述 Pdelay— Req 报文的 时 间 与 所述第 二节 点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整值。 结合第七方面, 在第七方面的第一种可能实现的方式中, 所述 第二节点与所述第一节点的链路延时为:
D _ (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 结合第七方面的第一种可能实现的方式,在第七方面的第二种 可能实现的方式中, 所述方法还包括: 所述第一节点向所述第二节点发送 Sync同步报文, 所述 Sync 报文中携带所述第一节点发送所述 Sync报文时所述第一节点的本 地时间 ^, 以使所述第二节点根据 ^1、 D以及所述第二节点接收所 述 Sync报文时所述第二节点的本地时间 ^'2获取所述第二节点与所 述第一节点的时间偏差 并且使所述第二节点根据所述时间偏 差校准所述第二节点的本地时钟。 结合第七方面的第二种可能实现的方式,在第七方面的第三种 可能实现的方式中, 所述第二节点与所述第一节点的时间偏差为: Offset = T2' - T - D 第八方面, 本发明提供一种精确时钟协议同步方法, 所述方法 包括:
第二节点向第一节点发送 Pdelay— Req延迟请求 4艮文; 所述第二节点接收所述第一节点发送的 Pdelay— Resp延迟响应 报文, 所述 Pdelay— Resp 报文中携带所述第一节点接收所述 Pdelay— Req ^艮文时所述第一节点的本地时间 τ 所述第一节点发送 所述 Pdelay— Resp 文时所述第一节点的本地时间 ^以及所述第一 节点的时间调整值 Α , 是所述第一节点接收所述 Pdelay— Req报 文的时间与所述第一节点发送所述 Pdelay— Resp 文的时间之间所 述第一节点的时间调整值; 所述第二节点根据 ^、 Τ Δ 、 所述第二节点发送所述 Pdelay_Req报文时所述第二节点的本地时间 τι、 所述第二节点接收 所述 Pdelay— Resp 文时所述第二节点的本地时间 ^以及所述第二 节点的时间调整值 获取所述第二节点与所述第一节点的链路延 时 ) , 其中, 是所述第二节点发送所述 Pdelay— Req 报文的时间 与所述第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节 点的时间调整值。 结合第八方面, 在第八方面的第一种可能实现的方式中, 所述 第二节点与所述第一节点的链路延时为:
D _ (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 结合第八方面的第一种可能实现的方式,在第八方面的第二种 可能实现的方式中, 所述方法还包括:
所述第二节点接收所述第一节点发送的 Sync 同步报文, 所述 Sync报文中携带所述第一节点发送所述 Sync报文时所述第一节点 的本地时间 T、
所述第二节点根据 Γ 、 以及所述第二节点接收所述 Sync报 文时所述第二节点的本地时间 ^ ' 2获取所述第二节点与所述第一节 点的时间偏差 0ffset,并根据所述时间偏差校准所述第二节点的本地 时钟。 结合第八方面的第二种可能实现的方式,在第八方面的第三种 可能实现的方式中, 所述第二节点与所述第一节点的时间偏差为: Offset = T2' - T[ - D 第九方面, 本发明提供一种第一节点, 包括: 发送单元, 用于向第二节点发送第 0个 Sync 同步报文, 所述 第 0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时 所述第一节点的本地时间 ; 所述发送单元还用于向所述第二节点发送至少一个 Sync 报 文,以使所述第二节点根据所述 、所述第一节点发送第 N个 Sync 报文时所述第一节点的本地时间 ^、 Δ 、 所述第二节点接收所述 第 0个 Sync报文时所述第二节点的本地时间 。、 所述第二节点接 收所述第 N个 Sync报文时所述第二节点的本地时间 和 Ay获取所 述第二节点与所述第一节点的频率偏差,并且使所述第二节点根据 所述频率偏差校准所述第二节点的本地时钟, 其中, 所述至少一个 Sync报文包含第 i个 Sync报文, 所述第 i个 Sync报文中携带所述 第一节点向所述第二节点发送所述第 i个报文时所述第一节点的本 地时间 ^和时间调整值^^ , ^是所述第一节点发送第 i- 1个同步报 文的时间与所述第一节点发送第 i个同步报文的时间之间所述第一 节点的时间调整值, ^是所述第二节点接收所述第 i- 1个同步报文 的时间与所述第二节点接收所述第 i个同步报文的时间之间所述第 二节点的时间调整值, N为正整数, i是 1至 N中的所有正整数, ^是所述第一节点发送所述第 0个 Sync报文的时间与所述第一节 点发送所述第 N个 Sync报文的时间之间所述第一节点的时间调整 值, 是所述第二节点接收所述第 0个 Sync报文的时间与所述第 二节点接收所述第 N个 Sync报文的时间之间所述第二节点的时间 调整值。
结合第九方面, 在第九方面的一种可能实现的方式中, 所述第 二节点与所述第一节点的频率偏差为:
T2,N ~ T2fi -∑Ayi
fi - Ay
R
Τ - Τ - Αχ
其中, Δ = Δ ; = + Δ¾ + · · · + ΑχΝ , Ay = Ay; = y{ + Ay2 +■·■ + AyN
!•=1 !·=1 第十方面, 本发明提供一种第二节点, 包括: 接收单元, 用于从第一节点接收第 0个 Sync 同步报文, 所述 第 0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时 所述第一节点的本地时间 ^。; 所述接收单元还用于接收所述第一节点发送的至少一个 Sync 报文, 所述至少一个 Sync报文包含第 i个 Sync报文, 所述第 i个 Sync 报文中携带所述第一节点向所述第二节点发送所述第 i 个报 文时所述第一节点的本地时间 T"和时间调整值 ^ , ^是所述第一 节点发送第 i- 1 个同步报文的时间与所述第一节点发送第 i个同步 报文的时间之间所述第一节点的时间调整值; 处理单元, 用于根据^。、 所述第一节点发送第 N个 Sync报文 时所述第一节点的本地时间 w、 Λ 、 所述第二节点接收所述第 0 个 Sync报文时所述第二节点的本地时间 。、 所述第二节点接收第 N个 Sync报文时所述第二节点的本地时间 和 获取所述第二节 点与所述第一节点的频率偏差,并根据所述频率偏差校准所述第二 节点的本地时钟, 其中, ^是所述第二节点接收所述第 i- 1个同步 报文的时间与所述第二节点接收所述第 i个同步报文的时间之间所 述第二节点的时间调整值, N为正整数, i是 1至 N中的所有正整 数, A是所述第一节点发送所述第 0个 Sync报文的时间与所述第 一节点发送所述第 N个 S y n c报文的时间之间所述第一节点的时间 调整值, 是所述第二节点接收所述第 0个 Sync报文的时间与所 述第二节点接收所述第 N个 S y n c报文的时间之间所述第二节点的 时间调整值。
结合第十方面, 在第十方面的一种可能实现的方式中, 所述第 二节点与所述第一节点的频率偏差为:
N
T - T - Av T2,N ~ T2fi -∑Ayi
R _ 1 2 N 2,0
N N
其中, Ax = ^i Axi = Ax^ Ax2 +… + AxN, Ay = ^ Ay. = Ayl + Ay2 +… + AyN。 第十一方面, 本发明提供一种第一节点, 包括: 发送单元, 用于向第二节点发送第一 Sync 同步报文, 所述第 ― Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第 一节点的本地时间 ; 接收单元,用于接收所述第二节点发送的 Delay— Req延迟请求 报文; 获取单元, 用于获取所述第一节点的时间调整值 Δ , Λ是所述 第一节点发送所述第一 Sync报文的时间与所述第一节点接收所述 Delay— Req ^文的时间之间所述第一节点的时间调整值; 所述发送单元还用于向所述第二节点发送 Delay— Resp延迟响 应才艮文, 所述 Delay— Resp 文包括所述第一节点的时间调整值 ^ 和 ^, 以使所述第二节点根据 τ Δ 、 所述第二节点接收所述 第一 Sync 报文时所述第二节点的本地时间 、 所述第二节点发送 所述 Delay— Req报文时所述第二节点的本地时间 ^ , 和所述第二节 点的时间调整值 获取链路延时 其中, 是所述第二节点接 收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第二节点的时间调整值。 结合第十一方面, 在第十一方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2 结合第十一方面的第一种可能实现的方式,在第十一方面的第 二种可能实现的方式中, 所述发送单元还用于: 向所述第二节点发送第二 Sync报文,所述第二 Sync报文中携 带所述第一节点发送所述第二 Sync报文时所述第一节点的本地时 间 'ι , 使所述第二节点根据 'ι、 所述第二节点接收所述第二 Sync 报文时所述第二节点的本地时间 ^ ' 2和 D获取所述第二节点与所述 第一节点的时间偏差 0ffset,并且使所述第二节点根据所述时间偏差 校准所述第二节点的本地时钟。 结合第十一方面的第二种可能实现的方式,在第十一方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为:
Offset = T2' - T[ - D 第十二方面, 本发明提供一种第二节点, 包括: 接收单元, 用于接收第一节点发送的第一 Sync 同步报文, 所 述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所 述第一节点的本地时间 ; 发送单元, 用于向所述第一节点发送 Delay— Req 延迟请求报 文;
获取单元, 用于获取所述第二节点的时间调整值 , 是所 述第二节点接收所述第一 Sync报文的时间与所述第二节点发送所 述 Delay— Req报文的时间之间所述第二节点的时间调整值; 所述接收单元还用于接收所述第一节点发送的 Delay— Resp延 迟响应报文, 所述 Delay— Resp报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 T 和所述第一节点的 时间调整值 ^, 是所述第一节点发送所述第一 Sync报文的时间与 所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点 的时间调整值;
处理单元, 用于根据 、 τ2 , τ ^、 和 获取所述第二节 点与所述第一节点的链路延时 D。 结合第十二方面, 在第十二方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D _ (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2 结合第十二方面的第一种可能实现的方式,在第十二方面的第 二种可能实现的方式中, 所述接收单元, 还用于接收所述第一节点 发送的第二 Sync报文,所述第二 Sync报文中携带所述第一节点发 送所述第二 Sync ^艮文时所述第一节点的本地时间 T、;
所述处理单元, 还用于根据 ^1、 D以及所述第二节点接收所述 第二 Sync报文的本地时间 ^获取所述第二节点与所述第一节点的 时间偏差 0ffset,并根据所述时间偏差 0ffset校准所述第二节点的本地 时钟。
结合第十二方面的第二种可能实现的方式,在第十二方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为: Offset = Τ - Τ[ - Ό 第十三方面, 本发明提供一种第一节点, 包括: 发送单元, 用于向第二节点发送第一 Sync 同步报文, 所述第 ― Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第 一节点的本地时间 ; 所述发送单元, 还用于向所述第二节点发送第三 Sync报文, 所述第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时 所述第一节点的本地时间 和所述第一节点的时间调整值 A " , Ax" 是所述第一节点发送所述第一 Sync报文的时间与所述第一节点发 送所述第三 Sync报文的时间之间所述第一节点的时间调整值; 接收单元,用于接收所述第二节点发送的 Delay— Req延迟请求 报文;
获取单元, 用于获取所述第一节点的时间调整值 , Δ 是所 述第一节点发送所述第三 Sync报文的时间与所述第一节点接收所 述 Delay— Req报文的时间之间所述第一节点的时间调整值, 其中, 所述第二节点接收到所述第三 Sync报文的时间晚于所述第二节点 发送所述 Delay— Req报文的时间; 所述发送单元,还用于向所述第二节点发送 Delay— Resp报文, 所述 Delay— Resp报文中携带所述第一节点接收所述 Delay— Req报 文时所述第一节点的本地时间 ^和 , 以使所述第二节点根据所述 τ Τ τ Δ '、
Figure imgf000016_0001
所述第二节点接收所述 Sync报文时所述第二 节点的本地时间 ^以及所述第二节点的时间调整值 获取所述第 二节点与所述第一节点的链路延时 ) , 其中, 是所述第二节点接 收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第二节点的时间调整值。
结合第十三方面, 在第十三方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D (H A _Α ") _ (Γ32 _ Δ
_ 2 结合第十三方面的第一种可能实现的方式,在第十三方面的第 二种可能实现的方式中, 所述发送单元还用于: 向所述第二节点发送第二 Sync报文,所述第二 Sync报文中携 带所述第一节点发送所述第二 Sync报文时所述第一节点的本地时 间 7" 1 , 以使所述第二节点根据所述 、 所述链路延时 D以及所述第 二节点接收所述 S y n c '报文时所述第二节点的本地时间 ^ ' 2获取所述 第二节点与所述第一节点的时间 Off 结合第十三方面的第二种可能实现的方式,在第十三方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为:
Offset = T2' - T[ - D 第十四方面, 本发明提供一种第二节点, 包括: 接收单元,用于接收所述第一节点发送的第一 Sync同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时 所述第一节点的本地时间 发送单元, 用于向所述第一节点发送 Delay— Req 延迟请求报 文;
获取单元, 用于获取所述第二节点的时间调整值 , 是所述 第二节点接收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req ^文的时间之间所述第二节点的时间调整值; 所述接收单元, 还用于接收所述第一节点发送的第三 Sync报 文, 所述第三 Sync 报文中携带所述第一节点发送所述第三 Sync 才艮文时的本地时间 T'、和所述第一节点的时间调整值 Λ ' , Ax"是所述 第一节点发送所述第一 Sync报文的时间与所述第一节点发送所述 第三 Sync报文的时间之间所述第一节点的时间调整值, 其中, 所 述第三 Sync报文是所述第一节点在 Γι与接收到所述 Delay— Req报 文时所述第一节点的本地时间 之间发送至所述第二节点的, 且所 述第二节点接收到所述第三 S y n c报文的时间晚于所述第二节点发 送所述 Delay— Req报文的时间; 所述接收单元, 还用于接收所述第一节点发送的 Delay— Req 延迟请求报文, 所述 Delay— Resp报文中携带所述第一节点接收所 述 Delay— Req报文时所述第一节点的本地时间 ^和所述第一节点的 时间调整值 ^', 是所述第一节点发送所述第三 Sync报文的时间 与所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节 点的时间调整值;
处理单元, 用于根据所述 、 τ2 , τ Γ4 ,
Figure imgf000018_0001
以及 Ay获取 所述第二节点与所述第一节点的链路延时 D。 结合第十四方面, 在第十四方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D (Τ,-Τ,-Αχ'-Αχ'^-^-Τ,-Αγ)
_ 2 结合第十四方面的第一种可能实现的方式,在第十四方面的第 二种可能实现的方式中, 所述接收单元, 还用于接收所述第一节点 发送的第二 Sync报文,所述第二 Sync报文中携带所述第一节点发 送所述第二 Sync ^艮文时所述第一节点的本地时间 T、;
所述处理单元, 还用于根据 £»、 以及所述第二节点接收所述 Sync'报文时所述第二节点的本地时间 ^获取所述第二节点与所述 第一节点的时间偏差 0ffset
结合第十四方面的第二种可能实现的方式,在第十四方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为:
Offset = T2'-T -D 第十五方面, 本发明提供一种第一节点, 包括: 接收单元, 用于接收第二节点发送的 Pdelay— Req延迟请求报 文;
发送单元, 用于向所述第二节点发送 Pdelay— Resp延迟响应才艮 文, 所述 Pdelay— Resp延迟响应报文中携带所述第一节点接收所述 Pdelay— Req ^艮文时所述第一节点的本地时间 ^、 所述第一节点发送 所述 Pdelay— Resp 文时所述第一节点的本地时间 以及所述第一 节点的时间调整值 Α , 以使所述第二节点根据 ^、 τ 、 所述第 二节点发送所述 Pdelay— Req ^艮文时所述第二节点的本地时间 τι、 所述第二节点接收所述 Pdelay— Resp报文时所述第二节点的本地时 间 ^以及所述第二节点的时间调整值 获取所述第二节点与所述 第一节点的链路延时 D , 其中 , ^是所述第一节点接收所述 Pdelay— Req 报文的时间与所述第一节点发送所述 Pdelay— Resp 报 文的时间之间所述第一节点的时间调整值, 是所述第二节点发 送所述 Pdelay— Req 报文的 时 间 与 所述第 二节 点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整值。 结合第十五方面, 在第十五方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 结合第十五方面的第一种可能实现的方式,在第十五方面的第 二种可能实现的方式中, 所述发送单元, 还用于向所述第二节点发 送 Sync 同步报文, 所述 Sync 报文中携带所述第一节点发送所述 Sync 报文时所述第一节点的本地时间 , 以使所述第二节点根据 T、、 D以及所述第二节点接收所述 Sync 报文时所述第二节点的本 地时间 获取所述第二节点与所述第一节点的时间偏差 <¾ ^^并且 使所述第二节点根据所述时间偏差校准所述第二节点的本地时钟。 结合第十五方面的第二种可能实现的方式,在第十五方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为:
Offset = T2' - T[ - D 第十六方面, 本发明提供一种第二节点, 包括: 发送单元, 用于向第一节点发送 Pdelay— Req延迟请求报文; 接收单元, 用于接收所述第一节点发送的 Pdelay— Resp延迟响 应报文, 所述 Pdelay— Resp 报文中携带所述第一节点接收所述 Pdelay— Req ^艮文时所述第一节点的本地时间 ^、 所述第一节点发送 所述 Pdelay— Resp 文时所述第一节点的本地时间 以及所述第一 节点的时间调整值 Α , 是所述第一节点接收所述 Pdelay— Req报 文的时间与所述第一节点发送所述 Pdelay— Resp 文的时间之间所 述第一节点的时间调整值;
处理单元, 用于根据 ^、 Τ 、 所述第二节点发送所述 Pdelay— Req报文时所述第二节点的本地时间 τ 所述第二节点接收 所述 Pdelay— Resp 文时所述第二节点的本地时间 ^以及所述第二 节点的时间调整值 获取所述第二节点与所述第一节点的链路延 时 ) , 其中, 是所述第二节点发送所述 Pdelay— Req 报文的时间 与所述第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节 点的时间调整值。 结合第十六方面, 在第十六方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 结合第十六方面的第一种可能实现的方式,在第十六方面的第 二种可能实现的方式中, 所述接收单元, 还用于接收所述第一节点发送的 Sync 同步报 文,所述 Sync报文中携带所述第一节点发送所述 Sync报文时所述 第一节点的本地时间 T、; 所述处理单元, 还用于根据 ^1、 以及所述第二节点接收所述 Sync 报文时所述第二节点的本地时间 ^ ' 2获取所述第二节点与所述 第一节点的时间偏差 0ffset,并根据所述时间偏差校准所述第二节点 的本地时钟。 结合第十六方面的第二种可能实现的方式,在第十六方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为:
Offset = T2' - T[ - D 第十七方面, 本发明提供一种第一节点, 包括中央处理器、 晶 振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接收 时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄存 器以及总线, 其中: 收发器, 用于向第二节点发送第 0个 Sync 同步报文, 所述第
0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所 述第一节点的本地时间 所述收发器还用于向所述第二节点发送至少一个 Sync报文, 以使所述第二节点根据 。、 所述第一节点发送第 N个 Sync报文时 所述第一节点的本地时间 ^ Δ 、 所述第二节点接收所述第 0 个
Sync 报文时所述第二节点的本地时间 。、 所述第二节点接收所述 第 N个 Sync报文时所述第二节点的本地时间 和 Ay获取所述第二 节点与所述第一节点的频率偏差,并且使所述第二节点根据所述频 率偏差校准所述第二节点的本地时钟, 其中, 所述至少一个 Sync 报文包含第 i个 Sync报文, 所述第 i个 Sync报文中携带所述第一 节点向所述第二节点发送所述第 i个报文时所述第一节点的本地时 间 和时间调整值^^ , ^是所述第一节点发送第 i- 1个同步报文的 时间与所述第一节点发送第 i个同步报文的时间之间所述第一节点 的时间调整值, ^是所述第二节点接收所述第 i- 1个同步报文的时 间与所述第二节点接收所述第 i个同步报文的时间之间所述第二节 点的时间调整值, N为正整数, i是 1 至 N中的所有正整数, A是 所述第一节点发送所述第 0个 Sync报文的时间与所述第一节点发 送所述第 N个 Sync报文的时间之间所述第一节点的时间调整值, 是所述第二节点接收所述第 0个 Sync报文的时间与所述第二节 点接收所述第 N个 Sync报文的时间之间所述第二节点的时间调整 值。 结合第十七方面, 在第十七方面的一种可能实现的方式中, 所 述第二节点与所述第一节点的频率偏差为:
R
Τ、 Γ1 0 - Αχ
其中, Ax = ^ Axt = Δ ; + Δ 2 + · · · + ΑχΝ , Ay = ^ Ayt = Ay{ + Ay2 + · · · + Αγ 第十八方面, 本发明提供一种第二节点, 包括中央处理器、 晶 振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接收 时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄存 器以及总线, 其中: 收发器, 用于从第一节点接收第 0个 Sync 同步报文, 所述第
0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所 述第一节点的本地时间 。; 所述收发器还用于接收所述第一节点发送的至少一个 Sync报 文,所述至少一个 Sync才艮文包含第 i个 Sync才艮文,所述第 i个 Sync 报文包括所述第一节点向所述第二节点发送所述第 i个报文时所述 第一节点的本地时间 7 ^和时间调整值 ^ , ^是所述第一节点发送 第 i- 1 个同步报文的时间与所述第一节点发送第 i个同步报文的时 间之间所述第一节, ^的时间调整值; 中央处理单元, 用于根据 。、 所述第一节点发送第 N个 Sync 报文时所述第一节点的本地时间 ^ Δ 、 所述第二节点接收所述 第 0个 Sync报文时所述第二节点的本地时间 。、 所述第二节点接 收第 N个 Sync报文时所述第二节点的本地时间 和 获取所述第 二节点与所述第一节点的频率偏差,并根据所述频率偏差校准所述 第二节点的本地时钟, 其中, ^是所述第二节点接收所述第 i- 1个 同步报文的时间与所述第二节点接收所述第 i个同步报文的时间之 间所述第二节点的时间调整值, N为正整数, i是 1至 N中的所有 正整数, ^是所述第一节点发送所述第 0个 Sync报文的时间与所 述第一节点发送所述第 N个 Sync报文的时间之间所述第一节点的 时间调整值, 是所述第二节点接收所述第 0个 Sync报文的时间 与所述第二节点接收所述第 N个 Sync报文的时间之间所述第二节 点的时间调整值。 结合第十八方面, 在第十八方面的一种可能实现的方式中, 所 述第二节点与所述第一节点的频率偏差为:
Figure imgf000022_0001
其中, Ax = ^jAxi =Axl + Ax2 + ··· + AxN , Ay = ^ Ayt = Ayl + Ay2 + ··· + AyN
!•=1 i=l 第十九方面, 本发明提供一种第一节点, 包括中央处理器、 晶 振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接收 时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄存 器以及总线, 其中: 收发器, 用于向第二节点发送第一 Sync 同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第一 节点的本地时间 Τι 所述收发器,还用于接收所述第二节点发送的 Delay— Req延迟 请求 4艮文;
中央处理单元用于获取所述第一节点的时间调整值 Α , Δ是所 述第一节点发送所述第一 Sync报文的时间与所述第一节点接收所 述 Delay— Req报文的时间之间所述第一节点的时间调整值; 所述收发器, 还用于向所述第二节点发送 Delay— Resp延迟响 应才艮文, 所述 Delay— Resp 文包括所述第一节点的时间调整值 ^ 和 ^, 以使所述第二节点根据 τ Δ 、 所述第二节点接收所述 第一 Sync 报文时所述第二节点的本地时间 ^、 所述第二节点发送 所述 Delay— Req报文时所述第二节点的本地时间 ^ , 和所述第二节 点的时间调整值 获取链路延时 其中, 是所述第二节点接 收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第二节点的时间调整值。 结合第十九方面, 在第十九方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D (T4 -Tl -Ax)-(T3 -T2 -Ay)
_ 2 结合第十九方面的第一种可能实现的方式,在第十九方面的第 二种可能实现的方式中, 所述收发器还用于: 向所述第二节点发送第二 Sync报文,所述第二 Sync报文中携 带所述第一节点发送所述第二 Sync报文时所述第一节点的本地时 间 Τ'ι , 使所述第二节点根据 Τ'ι、 所述第二节点接收所述第二 Sync 报文时所述第二节点的本地时间 ^ ' 2和 D获取所述第二节点与所述 第一节点的时间偏差 0ffset,并且使所述第二节点根据所述时间偏差 校准所述第二节点的本地时间。 结合第十九方面的第二种可能实现的方式,在第十九方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为:
Offset = T2' - T[ - D 第二十方面, 本发明提供一种第二节点, 包括中央处理器、 晶 振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接收 时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄存 器以及总线, 其中: 所述收发器, 用于接收第一节点发送的第一 Sync 同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时 所述第一节点的本地时间 所述收发器,还用于向所述第一节点发送 Delay— Req延迟请求 报文;
中央处理单元,用于获取所述第二节点的时间调整值 , 是 所述第二节点接收所述第一 Sync报文的时间与所述第二节点发送 所述 Delay— Req ^文的时间之间所述第二节点的时间调整值; 所述收发器, 还用于接收所述第一节点发送的 Delay— Resp延 迟响应报文, 所述 Delay— Resp报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 T 和所述第一节点的 时间调整值 ^, 是所述第一节点发送所述第一 Sync报文的时间 与所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节 点的时间调整值;
所述中央处理单元, 用于根据 Γι、 Γ2、 τ 、 Δ 和 获取所 述第二节点与所述第一节点的链路延时 )。 结合第二十方面, 在第二十方面的第一种可能实现的方式中, 所述第二节点与所述第一节点的链路延时为:
D (T4-Tl-Ax)-(T3-T2-Ay)
_ 2 结合第二十方面的第一种可能实现的方式,在第二十方面的第 二种可能实现的方式中, 所述收发器, 还用于接收所述第一节点发 送的第二 Sync报文,所述第二 Sync报文包括所述第一节点发送所 述第二 Sync 4艮文时所述第一节点的本地时间
Figure imgf000025_0001
所述处理器还用于根据 i、 D以及所述第二节点接收所第二 Sync 报文的本地时间 ^'2获取所述第二节点与所述第一节点的时间 偏差 0ffset , 并根据所述时间偏差 0ffset 准所述第二节点的本地时 钟。
结合第二十方面的第二种可能实现的方式,在第二十方面的第 三种可能实现的方式中,所述第二节点与所述第一节点的时间偏差 为:
Offset = T2-T -D 第二十一方面, 本发明提供一种第一节点, 包括中央处理器、 晶振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接 收时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄 存器以及总线, 其中: 所述收发器, 用于向第二节点发送第一 Sync 同步报文, 所述 第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述 第一节点的本地时间 Tr, 所述收发器, 还用于向所述第二节点发送第三 Sync报文, 所 述第三 Sync报文包括所述第一节点发送第三 Sync报文时所述第一 节点的本地时间 和所述第一节点的时间调整值 Α ', Δ '是所述第 一节点发送所述第一 Sync报文的时间与所述第一节点发送所述第 三 Sync报文的时间之间所述第一节点的时间调整值; 所述收发器,还用于接收所述第二节点发送的 Delay— Req延迟 请求 4艮文; 所述中央处理单元, 还用于获取所述第一节点的时间调整值
Δ , Δ 是所述第一节点发送所述第三 Sync报文的时间与所述第一 节点接收所述 Delay— Req 报文的时间之间所述第一节点的时间调 整值, 其中, 所述第二节点接收到所述第三 Sync报文的时间晚于 所述第二节点发送所述 Delay— Req报文的时间; 所述收发器, 还用于向所述第二节点发送 Delay— Resp报文, 所述 Delay— Resp报文中携带所述第一节点接收所述 Delay— Req报 文时所述第一节点的本地时间 ^和 , 以使所述第二节点根据 、 Τ τ Δ '、
Figure imgf000026_0001
所述第二节点接收所述 Sync 报文时所述第二节 点的本地时间 ^以及所述第二节点的时间调整值 获取所述第二 节点与所述第一节点的链路延时 其中, 是所述第二节点接收 所述第 ― Sync报文的时间与所述第二节点发送所述 Delay— Req报 文的时间之间所述第二节点的时间调整值。
结合第二十一方面, 在第二十方面的第一种可能实现的方式 中, 所述第二节点与所述第一节点的链路延时为:
D (Τ, - Τ, - Αχ' -Αχ'^ - ^ -Τ, - Αγ)
_ 2 结合第二十一方面的第一种可能实现的方式,在第二十方面的 第二种可能实现的方式中, 所述收发器, 还用于向所述第二节点发 送第二 Sync报文,所述第二 Sync报文包括所述第一节点发送所述 第二 Sync报文时所述第一节点的本地时间 Τ、 , 以使所述第二节点 根据所述 Τ\、所述链路延时 L»以及所述第二节点接收所述第二 Sync 报文时所述第二节点的本地时间 ^获取所述第二节点与所述第一 节点的时间偏差 0ffset
结合第二十一方面的第二种可能实现的方式,在第二十方面的 第三种可能实现的方式中,所述第二节点与所述第一节点的时间偏 差为:
Offset = T2' - T[ - D 第二十二方面, 本发明提供一种第二节点, 包括中央处理器、 晶振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接 收时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄 存器以及总线, 其中: 所述收发器, 用于接收所述第一节点发送的第一 Sync 同步报 文,所述第一 Sync报文包括所述第一节点发送所述第一 Sync报文 时所述第一节点的本地时间 T\ 所述收发器,还用于向所述第一节点发送 Delay— Req延迟请求 报文;
所述中央处理单元, 用于获取所述第二节点的时间调整值 , 是所述第二节点接收所述第一 Sync报文的时间与所述第二节点发 送所述 Delay— Req报文的时间之间所述第二节点的时间调整值; 所述收发器,还用于接收所述第一节点发送的第三 Sync报文, 所述第三 Sync报文包括所述第一节点发送所述第三 Sync报文时的 本地时间 和所述第一节点的时间调整值 Δ '是所述第一节点 发送所述第一 Sync报文的时间与所述第一节点发送所述第三 Sync 报文的时间之间所述第一节点的时间调整值, 其中, 所述第三 Sync 报文是所述第一节点在 τι与接收到所述 Delay— Req报文时所述第一 节点的本地时间 ^之间发送至所述第二节点的, 且所述第二节点接 收到所述第三 Sync 报文的时间晚于所述第二节点发送所述 Delay— Req报文的时间; 所述收发器,还用于接收所述第一节点发送的 Delay— Req延迟 请求报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 ^和所述第一节点的时 间调整值 ^' , A 是所述第一节点发送所述第三 Sync报文的时间与 所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点 的时间调整值;
所述中央处理单元, 用于根据 Γι、 Γ2、 τ Τ4
Figure imgf000027_0001
Δ 以及 Ay获 取所述第二节点与所述第一节点的链路延时 D。
结合第二十二方面,在第二十二方面的第一种可能实现的方式 中, 所述第二节点与所述第一节点的链路延时为: 2 结合第二十二方面的第一种可能实现的方式,在第二十二方面 的第二种可能实现的方式中, 所述收发器, 还用于接收所述第一节 点发送的第二 Sync报文,所述第二 Sync报文包括所述第一节点发 送所述第二 Sync ^艮文时所述第一节点的本地时间
Figure imgf000028_0001
所述中央处理单元, 还用于根据 D、 ή以及所述第二节点接收 所述第二 Sync报文时所述第二节点的本地时间 ^'2获取所述第二节 点与所述第一节点的时间偏差 0ffset,并且根据所述时间偏差校准所 述第二节点的本地时间。 结合第二十二方面的第二种可能实现的方式,在第二十二方面 的第三种可能实现的方式中,所述第二节点与所述第一节点的时间 偏差为:
Offset = T2' - T - D 第二十三方面, 本发明提供一种第一节点, 包括中央处理器、 晶振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接 收时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄 存器以及总线, 其中: 所述收发器, 用于接收第二节点发送的 Pdelay— Req延迟请求 报文;
所述收发器, 还用于向所述第二节点发送 Pdelay— Resp延迟响 应报文, 所述 Pdelay— Resp延迟响应报文中携带所述第一节点接收 所述 Pdelay— Req ^艮文时所述第一节点的本地时间 ^、 所述第一节 点发送所述 Pdelay— Resp 文时所述第一节点的本地时间 以及所 述第一节点的时间调整值 ^, 以使所述第二节点根据 Γ2、 τ Δ 、 所述第二节点发送所述 Pdelay— Req 4艮文时所述第二节点的本地时 间 Γ 所述第二节点接收所述 Pdelay— Resp报文时所述第二节点的 本地时间 ^以及所述第二节点的时间调整值 获取所述第二节点 与所述第一节点的链路延时 其中, 是所述第一节点接收所述 Pdelay— Req 报文的时间与所述第一节点发送所述 Pdelay— Resp 报 文的时间之间所述第一节点的时间调整值, 是所述第二节点发 送所述 Pdelay— Req 报文的 时 间 与 所述第 二节 点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整值。
结合第二十三方面,在第二十三方面的第一种可能实现的方式 中, 所述第二节点与所述第一节点的链路延时为:
D (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 结合第二十三方面的第一种可能实现的方式,在第二十三方面 的第二种可能实现的方式中, 所述收发器, 还用于向所述第二节点 发送 Sync同步报文,所述 Sync报文中携带所述第一节点发送所述 Sync 报文时所述第一节点的本地时间 以使所述第二节点根据 T、、 D以及所述第二节点接收所述 Sync 报文时所述第二节点的本 地时间 获取所述第二节点与所述第一节点的时间偏差 ^¾ ^"并且 使所述第二节点根据所述时间偏差校准所述第二节点的本地时间。
结合第二十三方面的第二种可能实现的方式,在第二十三方面 的第三种可能实现的方式中,所述第二节点与所述第一节点的时间 偏差为:
Offset = T2' - T[ - D 第二十四方面, 本发明提供一种第二节点, 包括中央处理器、 晶振、 物理层芯片、 计数器、 存储器以及总线, 物理层芯片包括接 收时间生成电路、 发送时间生成电路、 收发器、 晶振、 计数器、 寄 存器以及总线, 其中: 所述收发器, 用于向第一节点发送 Pdelay— Req延迟请求报文; 所述收发器, 还用于接收所述第一节点发送的 Pdelay— Resp延 迟响应报文, 所述 Pdelay— Resp报文中携带所述第一节点接收所述 Pdelay— Req ^艮文时所述第一节点的本地时间 ^、 所述第一节点发送 所述 Pdelay— Resp 文时所述第一节点的本地时间 以及所述第一 节点的时间调整值 Α , Δ是所述第一节点接收所述 Pdelay— Req报 文的时间与所述第一节点发送所述 Pdelay— Resp ^文的时间之间所 述第一节点的时间调整值; 所述中央处理单元, 用于根据7^ Τ Δ 、 所述第二节点发送 所述 Pdelay— Req ^艮文时所述第二节点的本地时间 、所述第二节点 接收所述 Pdelay— Resp报文时所述第二节点的本地时间 ^以及所述 第二节点的时间调整值 获取所述第二节点与所述第一节点的链 路延时 其中, 是所述第二节点发送所述 Pdelay— Req 报文的 时间与所述第二节点接收所述 Pdelay— Resp ^文的时间之间所述第 二节点的时间调整值。
结合第二十四方面,在第二十四方面的第一种可能实现的方式 中, 所述第二节点与所述第一节点的链路延时为:
D (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 结合第二十四方面的第一种可能实现的方式,在第二十四方面 的第二种可能实现的方式中, 所述收发器, 还用于接收所述第一节 点发送的 Sync同步报文,所述 Sync报文中携带所述第一节点发送 所述 Sync ^艮文时所述第一节点的本地时间 T、; 所述中央处理单元, 还用于根据 ^1、 D以及所述第二节点接收 所述 S y n c报文时所述第二节点的本地时间 ^ ' 2获取所述第二节点与 所述第一节点的时间偏差 #^,并根据所述时间偏差校准所述第二 节点的本地时间。
结合第二十四方面的第二种可能实现的方式,在第二十四方面 的第三种可能实现的方式中 ,所述第二节点与所述第一节点的时间 偏差为:
Offset = T2' - T - D 上述技术方案中,在所述第一节点对所述第二节点进行频率同 步或时间同步的过程中,所述第一节点在发生时间调整事件时产生 时间调整值, 并通过 PTP 报文携带时间调整值发送至所述第二节 点, 当所述第二节点在频率同步或时间同步过程中也发生时间调整 时, 保存该时间调整值, 而后所述第二节点根据所述第一节点的时 间调整值和自身的时间调整值,以及所述第二节点与所述第一节点 进行 PTP 报文交互时的发送时间和接收时间获取所述第二节点与 所述第一节点的频率偏差或时间偏差, 当所述第二节点在计算与所 述第一节点的频率偏差或时间偏差时, 由于考虑了所述第一节点和 所述第二节点可能发生的时间调整事件所产生的时间调整值,能够 解决 PTP 报文进行频率同步或时间同步的误差问题, 使得所述第 二节点计算的频率偏差或时间偏差更精确, 有助于提高 PTP 报文 频率同步或者时间同步的精度。
附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施 例描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述 中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来 讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他 的附图。 图 1 为本发明实施例提供的一种精确时钟协议同步方法流程 示意图; 图 2为本发明实施例提供的一种网络架构图; 图 3为本发明实施例提供的一种 PTP报文交互图; 图 4 为本发明实施例提供的一种精确时钟协议同步方法流程 示意图; 图 5 为本发明实施例提供的一种精确时钟协议同步方法流程 示意图; 图 6为本发明实施例提供的一种 PTP报文交互图; 图 7 为本发明实施例提供的一种精确时钟协议同步方法流程 示意图; 图 8 为本发明实施例提供的一种精确时钟协议同步方法流程 示意图; 图 9为本发明实施例提供的一种 PTP报文交互图; 图 10为本发明实施例提供的一种精确时钟协议同步方法流程 示意图; 图 1 1 为本发明实施例提供的一种精确时钟协议同步方法流程 示意图 图 12为本发明实施例提供的一种 PTP报文交互图; 图 13 为本发明实施例提供的一种精确时钟协议同步方法流程 示意图 图 14为本发明实施例提供的一种第一节点结构示意图; 图 1 5为本发明实施例提供的一种第二节点结构示意图; 图 1 6为本发明实施例提供的一种第一节点结构示意图; 图 17为本发明实施例提供的一种第二节点结构示意图; 图 1 8为本发明实施例提供的一种第一节点结构示意图; 图 19为本发明实施例提供的一种第二节点结构示意图; 图 20为本发明实施例提供的一种第一节点结构示意图; 图 21为本发明实施例提供的一种第二节点结构示意图; 图 22为本发明实施例提供的一种节点结构示意图; 图 23为本发明实施例提供的一种物理层芯片结构示意图。 具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术 方案进行清楚地描述, 显然, 所描述的实施例仅仅是本发明一部分 实施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普 通技术人员在没有作出创造性劳动前提下所获得的所有其他实施 例, 都属于本发明保护的范围。 本专利申请中的 "本地时间 " 是本地时钟设备显示的时间。 例 如, 发送端发送报文时发送端的本地时间。 或者, 接收端接收报文 时接收端的本地时间。 本专利申请中的 "时间 " 是与 "本地时间 " 相对独立的 ( in contrast to ) "参考时间 "。 所述参考时间是位于所述本地时钟设备 外部的其他时钟设备显示的时间。 举例来说, 所述参考时间可以是 格林尼治标准时间 (英文: Greenwich MeanTime , 缩写: GMT )、 协调世界时间(英文: Universal Time Coordinated , 缩写: UTC)或 者 夏日节约时间 (英文: Daylight Saving Time,缩写: D. S.T. )。 本专利申请中的时间调整事件是指触发节点发生时间调整的 事件。 例如, 主时钟装置通过 PTP 对从时钟装置的本地时间进行 校准是一种时间调整事件。对从时钟装置的本地时间进行校准是所 述从时钟装置发生的时间调整事件。
IEEE提出的 IEEE 1588-2008标准, 该标准定义了使用 PTP报 文进行频率同步和时间同步的实现方式。 其中, 支持 PTP 的节点 可以为路由器、 网络交换机、 分组传送网 (英文: packet transport network ,缩写: PTN )设备或者波分复用(英文: wavelength-division multiplexing , 缩写: WDM ) 设备。 PTP 中涉及到同步 ( Sync ) 才艮 文。 本专利申请中的 Sync才艮文是指 PTP 中的 Sync才艮文。 使用 PTP进行频率同步的实现方式中, 譬如在节点 B与节点 A使用 PTP进行频率同步的场景中, 如果在节点 A向节点 B发送 两个 Sync ( 同步) 报文的时间之间节点 A发生了时间调整, 或者 在节点 B从节点 A接收两个 Sync报文的时间之间节点 B发生了时 间调整, 那么节点 B计算出的节点 B相对于节点 A的频率偏差会 存在误差。 具体来说, 在节点 A发送两个 Sync报文的时间之间, 节点 A 可能发生本地时钟被校准的事件 (例如作为从时钟设备的 节点 A的本地时钟被主时钟设备通过 PTP校准 ) 的事件。 又例如 , 在节点 B接收两个 Sync 4艮文的时间之间, 节点 B的本地时钟可能 发生本地时钟被校准的事件 (例如作为从时钟设备的节点 B 的本 地时钟被主时钟设备通过 PTP校准)。 使用 PTP进行时间同步的实现方式中, 譬如在节点 B与节点 A使用 PTP保持时间同步的场景中, 对于 IEEE 1588-2008协议中 端到端 (英文: End to End , 缩写: E2E ) 时间同步方式, 如果在 节点 A向节点 B发送 Sync报文和接收 Delay— Req报文之间节点 A 发生了时间调整, 或者在节点 B 从节点 A接收 Sync报文和发送 Delay— Req报文之间节点 B发生了时间调整,那么节点 B计算出的 节点 B 相对于节点 A 的链路延时会存在误差。 同理, 对于 IEEE 1588-2008协议中点到点 (英文: Peer to Peer , 缩写: P2P ) 时间 同步方式, 如果在节点 A 从节点 B 接收 Pdelay— Req 报文和发送 Pdelay_Res 报文期间节点 A发生了时间调整, 或者在节点 B在向 节点 A发送 Pdelay— Req报文和接收 Pdelay— Resp报文期间节点 B 发生了时间调整, 那么节点 B计算出的节点 B相对于节点 A 的链 路延时会存在误差。 这样, 在频率偏差存在误差时, 就使得节点 B与节点 A的频 率同步存在误差。 在链路延时存在误差时, 节点 B与节点 A 的时 间同步就会存在误差, 从而影响 PTP频率同步和 PTP 时间同步的 精度。
本发明实施例提供一种精确时钟协议同步方法, 如图 1 所示, 包括:
101、 第一节点向第二节点发送第 0个 Sync 同步报文, 所述第
0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所 述第一节点的本地时间 。。 举例来说, 所述第一节点和所述第二节点可以是 1588 同步网 中的节点。 所述第一节点是网络装置, 具体可以为路由器、 网络交 换机或者分组传送网设备。 所述第二节点是网络装置, 具体可以是 路由器、 网络交换机或者分组传送网设备。 所述第一节点和所述第 二节点都为支持 PTP 报文通信的设备。 所述第一节点和所述第二 节点包括记录时间调整值的装置。 举例来说,当在所述第一节点与所述第二节点中间存在不支持 1588-2008标准的中间节点时的情况下, 所述第一节点与所述第二 节点一般配置为 1588-2008标准的 E2E方式。当所述第一节点与所 述第二节点为相邻节点,所述第一节点与所述第二节点可以配置为
1588-2008标准的 E2E方式或者 P2P方式。 其中,在所述第一节点和所述第二节点中有记录时间调整的装 置的情况下, 在所述第二节点与所述第一节点进行频率同步时, 所 述第一节点向所述第二节点首次发送,即发送第 0个 Sync报文时, 启动记录时间调整的装置, 从而使该记录时间调整的装置开始计 时。 所述第 0个 Sync报文携带所述第一节点发送所述第 0个 Sync 报文时所述第一节点的本地时间 。。所述第二节点在接收到所述第 0 个 Sync报文时, 启动第二节点中记录时间调整的装置, 从而使 该记录时间调整的装置开始计时, 并记录接收到所述第 0 个 Sync 报文时所述第二节点的本地时间 ^。。
1 02、 所述第一节点向所述第二节点发送至少一个 Sync报文, 以使所述第二节点根据 。、 所述第一节点发送第 N个 Sync报文时 所述第一节点的本地时间 ^ Δ 、 所述第二节点接收所述第 0 个
Sync 报文时所述第二节点的本地时间 。、 所述第二节点接收所述 第 N个 Sync报文时所述第二节点的本地时间 和 Ay获取所述第二 节点与所述第一节点的频率偏差,并且使所述第二节点根据所述频 率偏差校准所述第二节点的本地时钟, 其中, 所述至少一个 Sync 报文包含第 i个 Sync报文, 所述第 i个 Sync报文中携带所述第一 节点向所述第二节点发送所述第 i个报文时所述第一节点的本地时 间 ^和时间调整值^^ , ^是所述第一节点发送第 i- 1个同步报文的 时间与所述第一节点发送第 i个同步报文的时间之间所述第一节点 的时间调整值, ^是所述第二节点接收所述第 i- 1个同步报文的时 间与所述第二节点接收所述第 i个同步报文的时间之间所述第二节 点的时间调整值, N为正整数, i是 1 至 N中的所有正整数, A是 所述第一节点发送所述第 0个 Sync报文的时间与所述第一节点发 送所述第 N个 Sync报文的时间之间所述第一节点的时间调整值, 是所述第二节点接收所述第 0个 Sync报文的时间与所述第二节 点接收所述第 N个 Sync报文的时间之间所述第二节点的时间调整 值。 所述至少一个 Sync报文不包括所述第 0个 Sync报文。举例来 说, 当 N等于 1 时, 所述至少一个 Syn报文是第 1个 Sync报文。 所述第 1 个 Sync报文与所述第 N个 Sync报文是同一个报文。当 N 大于 1 时, 所述至少一个 Syn ^艮文包括第 1个 Sync 4艮文至所述第 N个 Sync报文。 所述第 1个 Sync报文与所述第 N个 Sync报文是 不同的才艮文。 例如, 当 N等于 3 时, 所述至少一个 Syn才艮文包括 第 1个 Sync报文、 第 2个 Sync报文以及第 3个 Sync报文。 所述 第 3个 Sync才艮文是所述第 N个 Sync才艮文。 所述第一节点向所述第二节点发送所述第 0个 Sync报文至第 N个 Sync报文的时间的先后顺序依次为所述第 0个 Sync报文至所 述第 N个 Sync报文。 本领域的技术人员可以理解, 由于报文在传 输过程中可能发生延迟, 所述第二节点接收所述第 0个 Sync报文 至所述第 N个 Sync 4艮文的时间的先后顺序可以依次为所述第 0个 Sync 4艮文至所述第 N个 Sync 4艮文, 也可以为其它顺序。 举例来说, ^是由于所述第一节点发生时间调整事件产生的 时间调整值。 在所述第一节点发送第 i- 1 个 Sync报文的时间与所 述第一节点发送第 i个 Sync 同步报文的时间之间所述第一节点只 发生了一个时间调整事件的场景下, ^等于所述一个时间调整事 件对应的时间调整值。 举例来说, 在所述第一节点发送第 i- 1个同步报文的时间与所 述第一节点发送第 i个同步报文的时间之间所述第一节点发生了多 个时间调整事件的场景下, ^等于多个时间调整事件分别对应的 多个时间调整值的累加值。所述多个时间调整事件与所述多个时间 调整值——对应。
举例来说, ^近似等于所述第一节点的第一时间差减去第二 时间差, 第一时间差是所述第一节点发送第 i个同步报文时所述第 一节点的本地时间 与所述第一节点发送第 i- 1个同步报文时所述 第一节点的本地时间的差,第二时间差是所述第一节点发送所述第 i 个同步报文的时间与所述第一节点发送所述第 i- 1 个同步报文的 时间的差。 举例来说,所述第一节点根据发包间隔时间向所述第二节点发 送第 1个报文时,所述第一节点记录该第 1个报文携带所述第一节 点发送第 1个报文时所述第一节点的本地时间 ,和所述第一节点 中记录时间调整值的装置中的时间调整值 , 该 ^表示所述第一 节点向所述第二节点发送第 0 个 Sync报文的时间和第 1 个 Sync 的时间之间所述第一节点的时间调整值,如果在此期间所述第一节 点没有进行时间调整, 那么 ^等于 0。 举例来说, 在如图 2所示的网络架构中, 包括所述第一节点、 所述第二节点和第三节点。这三个节点都包括用于产生报文接收时 间和报文发送时间的物理层芯片、 中央处理器、 晶振、 计数器和存 储器。 存储器包括数据和指令。 其中, 第三节点是所述第一节点的 主时钟设备, 所述第一节点是所述第二节点的主时钟设备。 对于第 一节点来说, 时间调整值 ^是所述第一节点对所述第二节点进行 频率同步或时间同步期间所述第一节点由于发生时间调整事件产 生的。 其中, 第一节点在此期间发生时间调整事件。 具体来说, 所 述第三节点对所述第一节点进行时间同步,所述第一节点与所述第 三节点交互 PTP报文。 所述第一节点要根据 PTP报文发送的时间 和 PTP 4艮文的接收时间计算时间偏差, 并 居时间偏差对本地时 间进行调整。 上述时间偏差等于第一节点的时间调整值 ^。 所述第一节点中记录时间调整值的装置可以为存储器。 具体 的, 所述第一节点的时间调整事件具体可以包括: 所述第一节点与 所述第三节点交互 PTP 报文。 所述第一节点中的处理器从物理层 芯片中获取 PTP 4艮文的发送时间和 PTP 4艮文的接收时间。 所述第 一节点中的处理器可以根据 PTP报文的发送时间和 PTP报文的接 收时间计算时间偏差,从而根据时间偏差调整所述第一节点本地时 钟的本地时间。而根据时间偏差调整本地时间是处理器根据时间偏 差调整计数器的值来实现的。 这样, 处理器就可以将计数器的调整 值写入存储器中。存储器就获取了所述第一节点对所述第二节点进 行频率同步时所述第一节点的时间调整值。所述第一节点在对所述 第二节点进行频率同步时,便将所述第一节点的存储器中的时间调 整值携带在 Sync报文中发送至所述第二节点。 举例来说, 在所述第一节点发送了第 1 个 Sync报文后, 所述 第一节点将所述第一节点中记录时间调整值的装置清零,以获取第 1个 Sync报文和第 2个 Sync报文之间所述第一节点的调整时间。 所述第二节点在接收到第 1个 Sync时, 获取接收所述第 0个 Sync 报文和第 1 个 Sync报文之间所述第二节点中记录时间调整值的装 置中记录的时间调整值 ι , 如果在此期间第二节点没有进行时间 调整, 那么 Δ 等于 0。 举例来说, ^是由于所述第二节点发生时间调整事件产生的 时间调整值。 在所述第二节点接收第 i- 1 个 Sync报文的时间与所 述第二节点接收第 i个 Sync 同步报文的时间之间所述第二节点只 发生了一个时间调整事件的场景下, ^等于所述时间调整事件对 应的时间调整值; 在所述第二节点接收第 i- 1个同步报文的时间与所述第二节点 接收第 i个同步报文的时间之间所述第二节点发生了多个时间调整 事件的场景下, ^等于所述多个时间调整事件分别对应的多个时 间调整值的累加值。所述多个时间调整事件与所述多个时间调整值 ——对应。 举例来说, ^近似等于所述第二节点的第一时间差减去第二 时间差, 第一时间差是所述第二节点接收第 i个同步报文时所述第 二节点的本地时间与所述第二节点接收第 i- 1个同步报文时所述第 二节点的本地时间的差, 第二时间差是所述第二节点接收所述第 i 个同步报文的时间与所述第二节点接收所述第 i- 1个同步报文的时 间的差。 举例来说, 与所述第一节点记录第一节点的时间调整值类似, 所述第二节点中记录时间调整值的装置也可以为存储器。 具体的, 在所述第一节点对所述第二节点进行频率同步的过程中,所述第一 节点与所述第二节点交互 PTP 报文。 所述第二节点中的处理器根 据 PTP 4艮文发送时间和 PTP 4艮文的接收时间, 计算所述第二节点 的时间调整值,从而对所述第二节点中用于记录本地时间的计数器 进行调整。所述第二节点中的处理器便将计数器的调整值作为所述 第二节点的时间调整值存储在所述第二节点的存储器中。 举例来说, ^为所述第一节点在^时间向第二节点发送第 0 个 Sync报文和 时间发送第 N个 Sync报文之间所述第一节点的 时间调整值^的累加值, 即为所述 i取值从 1 至 N时所述^的累 加值, 所述 为所述第二节点在 ^。时间从第一节点接收第 0 个 Sync报文和 T 时间接收第 Ν个 Sync报文之间所述第二节点的时 间调整值 Δ^·的累加值, 即为所述 i取值从 1 至 N时所述 Δ^的累加 值。 其中, Ν为正整数, i的 值范围是 1至 Ν中的所有正整数
Ax : Δ , + Δ +··· + Δχ:Λ
Ax
由此, ^可以表示为 y可以表示为八3 = 八 =Δ + Δ¾ + ·.· + Δ 举例来说, 当 Ν等于 1 时, 表示第二节点接收到第一节点发 送的每一个 Sync报文都会进行频率偏差的计算, 并进行频率同步 调整。 因此, 假设每个 Sync报文的传输延时 D相同或者变化 ^艮小, 所述第二节点根据自身产生的接收时间和收到的发送时间计算所 述第二节点与所述第一节点的频率偏差为:
Figure imgf000039_0001
其中, w表示所述频率偏差, ^。表示所述第一节点发送所述第
0个 Sync ^艮文时所述第一节点的本地时间, 表示所述第一节点 发送所述第 N个 Sync 4艮文时所述第一节点的本地时间, ^。表示所 述第二节点接收所述第 0个 Sync报文时所述第二节点的本地时间, 表示所述第二节点接收所述第 N个 Sync报文时所述第二节点的 本地时间。 举例来说, 对于频率同步的场景, 假设所述第一节点和第三节 点的频率不同步, 第三节点在某一时间段变化了 Is, 所述第一节 点在该时间段内变化了 1.1s,那么此时所述第一节点的频率是第三 节点的 1.1倍。为了使得所述第一节点与第三节点的频率达到同步, 可以通过调整所述第一节点的时间,使得所述第一节点与所述第三 节点经过的时间接近。 从而达到频率近似同步。 具体的, 所述第一节点可以在每隔一段时间调整 -0.1s, 从而使 得所述第一节点和第三节点经过的时间接近, 这里的 -0.1s 就为本 实施例中的时间调整值 ^。该 -0.1s可以是在两个相邻 Sync报文间 进行一次时间调整与第三节点保持频率同步, 也可以是通过多个
Sync交互调整 -0.1 s与第三节点保持频率同步。 时间调整值 的原 理与 Δ 类似, 这里不再赘述。 可替换的, 也可以通过直接调整所述第一节点的频率, 使得所 述第一节点与第三节点的频率相等或者接近相等。 根据上面的举 例, 所述第一节点可以将自身的频率调整为之前的 1/1. 1倍, 从而 与第三节点的频率达到同步。 这时, 理论上, 所述第一节点只需要 调整一次频率就可以使得所述第一节点的频率与第三节点同步,在 实际当中, 做出初次调整后, 所述第一节点会根据自身的微小误差 进行微小调整, 以与第三节点保持频率同步。 这种情况下, 相邻 S y n c报文间的时间调整值 ^和 就为 0。 若所述第二节点计算得到的频率偏差 R大于 1 , 则说明第二节 点的频率比所述第一节点的频率快,需要将所述第二节点的频率值 调小; 若所述第二节点计算得到的频率偏差 R小于 1 , 则说明第二 节点的频率比所述第一节点的频率慢,需要将第二节点的频率值调 大; 若所述第二节点计算得到的频率偏差 R等于 1或者接近于 1 , 则说明所述第二节点和所述第一节点的频率已经同步,不需要所述 第二节点在 接收到所述 sync报文后进行频率调整, 或者所述第 二节点在7^接收到所述 sync报文后也进行频率调整, 但是时间调 整值为 0。 上述技术方案中, 可以在 PTP协议的 Sync 4艮文中增加字节, 用来记录相邻的两个 Sync报文发送之间第一节点的时间调整值。 根据当前 IEEE 1588-2008表 26定义的 Sync才艮文的格式, 增加字 节即扩充后的 Sync报文格式如表 1 所示: 表 1 扩充后的 Sync报文格式
Figure imgf000041_0001
其中 , header表示 Sync才艮文的才艮文头, originTimestamp表示 S y n c报文的起始时间标识, 即所述第一节点发送 S yn c报文的发送 时间, timeAdjustvalue表示所述第一节点发送该 Sync报文的本地 时间和发送上一个 Sync 4艮文的本地时间之间所述第一节点的时间 调整值。 这里该时间调整值 timeAdjustvalue的长度可以为 10个字 节。
上述技术方案是针对 PTP 协议中的 ones-tep 方式进行频率同 步的,如图 3所示,为所述第一节点和所述第二节点的报文交互图, 即将发送 Sync报文的本地时间信息和时间调整值携带在 Sync报文 中发送至接收节点的, 也可以针对 two-step方式进行频率同步, 即 将 Sync报文的本地时间信息和时间调整值携带在 Follow— Up报文 中, 例如在所述第一节点发送 Sync报文时, 随后向所述第二节点 发送 Follow— Up报文,那么所述第二节点就根据 Follow— Up报文中 的本地时间信息和时间调整值以及第二节点自身的接收 Sync报文 的本地时间和时间调整值计算所述第二节点与所述第一节点的频 率偏差。 才艮据当前 IEEE 1 588-2008表 27定义的 Follow— Up才艮文的 格式, 增加字节即扩充后的 Follow— Up报文格式如表 2所示: 表 2 扩充后的 Follow— Up报文格式
Figure imgf000042_0002
其 中 , header 表 示 Follow— Up 才艮 文 的 才艮 文 头 , preciseOriginTimestam 表示 Follow— Up才艮文的 奇确起始时间标 i只 , 即第一节点发送 Sync报文的发送时间, preciseTimeAdjustvalue表 示第一节点发送该 Sync 4艮文时的本地时间和发送上一个 Sync 4艮文 的本地时间之间第一节点的时间调整值。 这里该时间调整值 preciseTimeAdjustvalue的长度可以为 10个字节。
这样一来, 假设通常的 PTP Sync报文的发送间隔时间为 T , 所述第一节点和所述第二节点此时的频率已经同步。在所述第一节 点 二节点发送了第 N个报文后, 点相对于所述第一节点的频率偏差 R 为
Figure imgf000042_0001
如果 Δ = Δ , 那么频率偏差 R等于 1 , 所述第二节点与所述第一节 点的频率相同, 此时计算结果正确, 如果 fx≠4y, 那么得到的频率偏差
R就会有误差, 误差项就为 , 此为现有技术中 PTP报文频率同步
NT + Ax 的一个缺陷。 本发明实施例提供一种精确时钟协议同步方法,所述第一节点 在向所述第二节点发送 Sync报文时, 通过所述第一节点中记录时 间调整值的装置记录相邻的两个 Sync报文之间第一节点的时间调 整值, 所述第二节点在从所述第一节点接收 Sync报文时, 通过所 述第二节点中的记录时间调整值的装置记录相邻的两个 Sync报文 之间所述第二节点的时间调整值,所述第二节点根据所述第一节点 的时间调整值、 所述第二节点的时间调整值、 所述第一节点发送 Sync报文时的本地时间和所述第二节点发送 Sync报文时的本地时 间获取所述第二节点与所述第一节点的频率偏差,有助于提高 P TP 报文的频率同步精度。 所述第一节点是网络装置, 具体可以为路由器、 网络交换机或 者分组传送网设备。所述第二节点是网络装置,具体可以是路由器、 网络交换机或者分组传送网设备。 以所述第二节点为执行主体, 上 述技术方案的方法流程如图 4所示, 包括:
20 1、 第二节点从第一节点接收第 0个 Sync 同步报文, 所述第
0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所 述第一节点的本地时间 τ。。
202、 所述第二节点接收所述第一节点发送的至少一个 Sync 报文, 所述至少一个 Sync报文包含第 i个 Sync报文, 所述第 i个 Sync 报文中携带所述第一节点向所述第二节点发送所述第 i 个报 文时所述第一节点的本地时间 T"和时间调整值 ^ , ^是所述第一 节点发送第 i- 1 个同步报文的时间与所述第一节点发送第 i个同步 报文的时间之间所述第一节点的时间调整值。
203、 所述第二节点根据 。、 所述第一节点发送第 N 个 Sync 报文时所述第一节点的本地时间 ^ Δ 、 所述第二节点接收所述 第 0个 Sync报文时所述第二节点的本地时间 。、 所述第二节点接 收第 N个 Sync报文时所述第二节点的本地时间 和 Ay获取所述第 二节点与所述第一节点的频率偏差,并根据所述频率偏差校准所述 第二节点的本地时钟, 其中, ^是所述第二节点接收所述第 i- 1个 同步报文的时间与所述第二节点接收所述第 i个同步报文的时间之 间所述第二节点的时间调整值, N为正整数, i是 1至 N中的所有 正整数, ^是所述第一节点发送所述第 0个 Sync报文的时间与所 述第一节点发送所述第 N个 Sync报文的时间之间所述第一节点的 时间调整值, 是所述第二节点接收所述第 0个 Sync报文的时间 与所述第二节点接收所述第 N个 Sync报文的时间之间所述第二节 点的时间调整值。 图 4所示的方法流程中的实现方式与图 1所示的方法流程中的 实现方式相同, 这里不再赘述。 本发明实施例提供一种精确时钟协议同步方法, 针对 PTP 报 文 E2E时间同步方式, 如图 5所示, 包括:
301、 第一节点向第二节点发送第一 Sync同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第一 节点的本地时间 τ 举例来说, 所述第一节点是网络装置, 具体可以为路由器、 网 络交换机或者分组传送网设备。 所述第二节点是网络装置, 具体可 以是路由器、 网络交换机或者分组传送网设备。 所述第一节点和所 述第二节点为支持 ΡΤΡ 报文发送和接收的设备。 所述第一节点和 所述第二节点包括记录时间调整值的装置。 举例来说, 针对所述 ΡΤΡ 4艮文 Ε2Ε 时间同步方式, 所述第一 节点与所述第二节点之间存在多个中间节点, 当某一中间节点支持 1588-2008标准时, 该中间节点需要进行 ΡΤΡ ^艮文转发, 还需要与 该中间节点的最近的一个支持 1 588-2008 标准的节点进行时间同 步, 当某一中间节点不支持 1588-2008标准时, 该中间节点需要进 行 ΡΤΡ报文转发, 不需要进行时间同步。 具体的, 针对所述 ΡΤΡ ^艮文 Ε2Ε时间同步方式, 所述第一节 点向所述第二节点发送第一 Sync同步报文,所述第一 Sync报文包 括所述第一节点发送该第一 Sync报文时所述第一节点的本地时间 Γι , 所述第一节点同时启动所述第一节点中记录时间调整值的装置 开始计时, 所述第二节点在收到所述第一 Sync报文时, 提取第一 Sync报文中的 τ 并记录所述第二节点接收所述第一 Sync报文时 所述第二节点的本地时间 ^ , 同时启动所述第二节点中记录时间调 整值的装置开始计时, 所述第二节点得到的信息包括 Τι和 ^。 302、 所述第一节点接收所述第二节点发送的 Delay— Req延迟 请求报文, 并获取所述第一节点的时间调整值 Δ , Λ是所述第一节 点发送所述第一 Sync 报文的时间与所述第一节点接收所述 Delay— Req ^文的时间之间所述第一节点的时间调整值。 具体的, 所述第二节点向所述第一节点发送 Delay— Req报文, 并获取所述第二节点在接收到所述第一 Sync 报文和发送所述 Delay— Req 报文之间所述第二节点中记录时间调整值的装置中的 时间调整值 Δ > , 并记录所述第二节点发送所述 Delay— Req 报文时 所述第二节点 的本地时间 ^。 所述第一节点在接收到所述
Delay— Req报文时, 从所述第一节点中记录时间调整值的装置中获 取所述第一节点的时间调整值 , 并记录所述第一节点接收所述 Delay— Req报文时所述第一节点的本地时间 ^。 其中, 在所述第一节点发送所述第一 Sync报文的时间与所述 第一节点接收所述 Delay— Req 报文的时间之间所述第一节点只发 生了一个时间调整事件的场景下, 等于所述一个时间调整事件对 应的时间调整值。 在所述第一节点发送第一 Sync报文的时间与所述第一节点接 收所述 Delay— Req 报文的时间之间所述第一节点发生了多个时间 调整事件的场景下, Δ 等于多个时间调整事件分别对应的多个时间 调整值的累加值。所述多个时间调整事件与所述多个时间调整值一 一对应。 在所述第二节点接收所述第一 Sync报文的时间与所述第二节 点发送所述 Delay— Req 报文的时间之间所述第二节点只发生了一 个时间调整事件的场景下, 等于所述一个时间调整事件对应的 时间调整值。
在所述第二节点接收所述第一 Sync报文的时间与所述第二节 点发送所述 Delay— Req 报文的时间之间所述第二节点发生了多个 时间调整事件的场景下, 等于多个时间调整事件分别对应的多 个时间调整值的累加值。所述多个时间调整事件与所述多个时间调 整值 对 „ 由此, 所述第二节点在向所述第一节点发送所述 Delay— Req 报文后, 所述第二节点得到的信息包括 、 τ ^以及 。
303、所述第一节点向所述第二节点发送 Delay— Resp延迟响应 报文, 所述 Delay— Resp 包括所述第一节点的时间调整值 和 以使所述第二节点根据 、 Γ4、 ^、所述第二节点接收所述第一 Sync 报文时所述第二节点的本地时间 ^、 所述第二节点发送所述 Delay— Req 文时所述第二节点的本地时间 T 和所述第二节点的 时间调整值 获取链路延时 其中, 是所述第二节点接收所 述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req报文 的时间之间所述第二节点的时间调整值。 举例来说, 所述第一节点在接收到所述 Delay— Req报文后, 将 ^和 ^携带在与所述 Delay— Req报文对应的 Delay— Resp报文中, 发送至所述第二节点,所述第二节点此时得到的信息包括 、 W
、 A 以及 。 其中, 以图 2所示的网络架构来说, 所述第一节点对时间调整 值 的记录,和所述第第二节点对时间调整值 Ay的记录与图 1所示 的实施例中的实现方式类似, 不在赘述。 因此,所述第二节点计算所述第二节点与所述第一节点的链路 延时可以为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2 其中, D表示所述链路延时, 表示所述第一节点发送所述第 ― Sync 报文时所述第一节点的本地时间, ^表示所述第二节点接 收所述第一 Sync 报文时所述第二节点的本地时间, ^表示所述第 二节点发送所述 Delay— Req报文时所述第二节点的本地时间, ^表 示所述第一节点接收所述 Delay— Req 报文时所述第一节点的本地 时间, 表示所述第一节点在 7和 时间所述第一节点的调整时间, 表示所述第二节点在 7 ^和 ^之间所述第二节点的调整时间。
304、 所述第一节点向所述第二节点发送第二 Sync报文, 所述 第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述 第一节点的本地时间 τ、, 使所述第二节点根据 r 、 所述第二节点接 收所述第二 Sync报文时所述第二节点的本地时间 ^'2和 D获取所述 第二节点与所述第一节点的时间偏差 σ#^,并且使所述第二节点根 据所述时间偏差校准所述第二节点的本地时间。 举例来说, 所述时间偏差 可以为:
Offset = T2' - T - D 其中, 所述 ^¾ ^ 表示所述第二节点与所述第一节点的时间偏 差, 表示所述第一节点发送所述第二 Sync报文时所述第一节点 的本地时间, 表示所述第二节点接收所述第二 S y n c报文时所述 第二节点的本地时间, D表示所述第二节点与所述第一节点的链路 延时。 举例来说, 若 小于 0 , 则所述第二节点需要将自身的本地 时间值调大, 与所述第一节点保持同步; 若^¾ ^"大于 0 , 则所述第 二节点需要将自身的本地时间调小, 与所述第一节点保持同步; 若 得到的 0ffset 0或者接近于 0 , 则说明所述第二节点与所述第一 节点的时间已同步, 不需要作出调整。 举例来说, 针对时间同步的场景, 假设第三节点是所述第一节 点的上游节点, 所述第一节点和第三节点的频率已经同步, 但是所 述第一节点与第三节点的时间不同步, 比如第三节点的时间为 100s , 所述第一节点的时间为 200s , 那么所述第一节点与第三节点 的时间相差 100s , 为了使得所述第一节点与第三节点的时间同步, 可以将所述第一节点的时间调整 - 100s , 使得所述第一节点与第三 节点的时间达到同步, 这里的 - 100s 就为所述第一节点的时间调整 值 。这里的时间调整值 可以是所述第一节点一次进行调整与第 三节点的时间保持同步, 也可以是多次 Sync报文交互进行报文交 互过程中进行调整的时间调整值。 可替换的,也可以通过调整所述第一节点的频率来使得所述第 一节点与第三节点的时间同步。 根据上述举例, 可以将所述第一节 点的频率调整为第三节点的 0.5 倍, 那么在经过 200s之后, 第三 节点的时间为 300s , 所述第一节点的时间也为 300s , 所述第一节 点与第三节点的时间保持了同步,再将所述第一节点的频率调整为 与第三节点的频率相同。 此时, 这里的时间调整值 就为 0。 针对 时间调整值 与 类似, 不再赘述。 通过上述说明,图 5所示的实现方式中所述第一节点与所述第 二节点的 4艮文交互过程如图 6所示。 在图 5 所示的实现方法中, 可以在所述 Delay— Resp 4艮文中增 加字节, 用来记录所述第一节点发送所述 Sync 报文与接收所述 Delay— Req 报文之间所述第一节点的时间调整值。 根据当前 IEEE 1588-2008表 28定义的 Delay— Resp报文的格式, 增加字节即扩充 后的 Delay— Resp才艮文格式如表 3所示:
表 3 扩充后的 Delay— Resp 4艮文格式
Figure imgf000048_0001
其 中 , header 表示 所述 Delay— Resp 才艮文 的 才艮文头 , receiveTimestam 表示所述第一节点接收所述 Delay— Req报文时所 述 第 一 节 点 的 本 地 时 间 , 例 如 为 本 实 施 例 中 的 Τ4 , requestingPortldentity表示所述第一节点向所述第二节点发送 4艮文 的请求端口标识, timeAdjustvalue表示所述第一节点在所述第一节 点在收到所述 Delay— Req报文之前,所述第一节点最新发送的 Sync 报文的发送时间和所述 Delay— Req报文的接收时间之间,所述第一 节点的时间调整值, 例如为本实施例中的 。 举例来说, 该 timeAdjustvalue的长度可以为 10个字节。 通常情况下,假设所述第一节点到所述第二节点及所述第二节 点到所述第一节点的链路延时为 所述第二节点根据 、 T TW、 及 ^得到所述第一节点与所述第二节点之间的链路延时。
D, = (r4— 7;)— (Γ32), 这样, 假设所述第一节点在 Γ^Γ之间发生了时
2 间调整, 时间调整值为 Δ , 所述第二节点在 23之间发生了时间调整, 时间调整值为 Ay , 那么所述第一节点与所述第二节点之间的实际链路延 时 ) = (Γ4_Γι)_(Γ3_Γ2) = )' +^^, 如果 Ax = Ay, 那么所述第二节点得到
2 2 的链路延时没有误差, 从而使得得到的时间偏差也没有误差。 如果 lx≠ Ay, 那么所述第二节点得到的链路延时有误差, 误差项为^^ , 从而使
Ax- y
得所述第二节点得到的时间偏差也有误差, 误差也为 2 。 本发明实施例提供一种精确时钟协议同步方法,所述第一节点 与所述第二节点进行报文交互时,利用所述第一节点中记录时间调 整值的装置和所述第二节点中记录时间调整值的装置进行计时,通 过所述第一节点在 Delay— Resp报文中携带所述第一节点发送第一 Sync报文和接收 Delay— Req报文之间所述第一节点的调整时间, 和所述第二节点记录所述第二节点接收第一 Sync 报文和发送 Delay— Req报文之间所述第二节点的调整时间, 使得所述第二节点 才艮据 4艮文交互的发送时的本地时间和接收时的本地时间以及调整 时间, 获得所述第二节点与所述第一节点的链路延时, 从而获得时 间偏差,使得所述第二节点根据时间偏差校准所述第二节点的本地 时钟, 上述技术方案有助于提高 PTP报文的时间同步精度。 以所述第二节点为执行主体,图 5所示的技术方案的方法流程 也可以如图 7所示, 包括:
401、 第二节点接收第一节点发送的第一 Sync同步报文, 所述 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第一 节点的本地时间 τ 举例来说, 所述第一节点是网络装置, 具体可以为路由器、 网 络交换机或者分组传送网设备。 所述第二节点是网络装置, 具体可 以是路由器、 网络交换机或者分组传送网设备。
402、 所述第二节点向所述第一节点发送 Delay— Req延迟请求 报文, 并获取所述第二节点的时间调整值 , 是所述第二节点 接收所述第 一 Sync 报文的 时 间 与 所述第二节点发送所述 Delay— Req ^文的时间之间所述第二节点的时间调整值。
403、所述第二节点接收所述第一节点发送的 Delay— Resp延迟 响应报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 T 和所述第一节点的 时间调整值 ^, ^是所述第一节点发送所述第一 Sync报文的时间 与所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节 点的时间调整值。
404、 所述第二节点根据 τ2 , τ τ 和 获取所述第二 节点与所述第一节点的链路延时 D。
405、 所述第二节点接收所述第一节点发送的第二 Sync报文, 所述第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时 所述第一节点的本地时间 T、。
406、 所述第二节点根据 i 、 D以及所述第二节点接收所述第 二 Sync报文的本地时间 ^'2获取所述第二节点与所述第一节点的时 间偏差 0ffset,并根据所述时间偏差 0ffset校准所述第二节点的本地时 钟。 图 7所示的方法流程中的实现方式与图 5所示的方法流程中的 实现方式相同, 这里不再赘述。 本发明实施例提供一种精确时钟协议同步方法, 针对 PTP 报 文 E2E 时间同步方式, 在图 5 所示的技术方案的基础上, 若所述 第一节点在向所述第二节点发送第一 Sync报文后, 又向所述第二 节点发送第三 Sync文,且所述第三 Sync报文是所述第二节点在向 所述第一节点发送 Delay— Req 延迟请求报文后接收到的。 如图 8 所示, 该方法包括:
501、 第一节点向第二节点发送第一 Sync同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第一 节点的本地时间 τ 举例来说, 所述第一节点是网络装置, 具体可以为路由器、 网 络交换机或者分组传送网设备。 所述第二节点是网络装置, 具体可 以是路由器、 网络交换机或者分组传送网设备。 本步骤的具体实现方式与图 5 所示的实施例中的步骤 301 相 同, 这里不再赘述。
502、 所述第一节点向所述第二节点发送第三 Sync报文, 所述 第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时所述 第一节点的本地时间 1和所述第一节点的时间调整值 Δ ' , Δ '是所 述第一节点发送所述第一 Sync报文的时间与所述第一节点发送所 述第三 Sync报文的时间之间所述第一节点的时间调整值。
举例来说, Δ '为 与 7 之间所述第一节点的时间调整值, 所述 第三 Sync 报文是在所述第一节点向所述第二节点发送所述第一 Sync报文之后发送给所述第二节点的。
举例来说, 所述 Δ '是在所述第一节点向所述第二节点发送所 述第三 Sync报文时, 从所述第一节点的记录时间调整值的装置中 获取的, 记录的是7 ^与 之间所述第一节点的调整时间。 所述第一 节点并记录了所述第一节点发送所述第三 Sync报文时所述第一节 点的本地时间 T'、。 举例来说, 在所述第一节点发送所述第一 Sync报文的时间与 所述第一节点发送所述第三 Sync报文的时间之间所述第一节点只 发生了一个时间调整事件的场景下, Δ '等于所述一个时间调整事 件对应的时间调整值。 在所述第一节点发送第一 Sync报文的时间与所述第一节点发 送所述第三 Sync报文的时间之间所述第一节点发生了多个时间调 整事件的场景下, Δ '等于多个时间调整事件分别对应的多个时间 调整值的累加值。所述多个时间调整事件与所述多个时间调整值一 一对应。 举例来说, 所述第一节点在发送所述第三 Sync报文时, 在获 得了 Δ '后, 可以将所述第一节点中记录时间调整值的装置清零并 重新开始计时。 所述第二节点在接收到所述第一节点发送的第三 Sync 报文 后, 得到的信息包括7^、 i、 所述第二节点接收所述第一 Sync 报 文时所述第二节点的本地时间 τ2、 所述第二节点发送 Delay— Req延 迟请求 文时所述第二节点的本地时间 以及 。
503、 所述第一节点接收所述第二节点发送的 Delay— Req延迟 请求报文, 并获取所述第一节点的时间调整值 Δ , 是所述第一 节点发送所述第三 Sync 报文的时间与所述第一节点接收所述 Delay— Req ^文的时间之间所述第一节点的时间调整值, 其中, 所 述第二节点接收到所述第三 S y n c报文的时间晚于所述第二节点发 送所述 Delay— Req报文的时间。 举例来说, 所述第二节点在接收到所述第一节点发送的第一 Sync报文后, 便向所述第一节点发送 Delay— Req报文, 由于所述 第一节点在发送所述第一 Sync报文后, 又向所述第二节点发送了 第三 Sync报文,所述第三 Sync报文是在所述第二节点向所述第一 节点发送 Delay— Req报文之后, 从所述第一节点接收到的, 这样, 所述第一节点在接收到所述 Delay— Req 报文后, 记录接收所述 Delay— Req报文时所述第一节点的本地时间为 ^。 当所述第一节点在 与 ^之间发生了时间调整值时, 所述第一 节点中记录时间调整的装置获取 与 ^之间所述第一节点的时间 调整值 Δ 。 举例来说, 在所述第一节点发送所述第三 Sync报文的时间与 所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点 只发生了一个时间调整事件的场景下, Δ 等于所述一个时间调整 事件对应的时间调整值。 在所述第一节点发送第三 Sync报文的时间与所述第一节点接 收所述 Delay— Req 报文的时间之间所述第一节点发生了多个时间 调整事件的场景下, Λ 等于多个时间调整事件分别对应的多个时 间调整值的累加值。所述多个时间调整事件与所述多个时间调整值 ——对应。
所述 可以是所述第一节点在 Τ、与 之间进行的一次时间调 整产生的, 也可以是多次时间调整的累加值。 所述 也可以为 0 , 表示所述第一节点没有进行时间调整。
这里相当于 与 Δ '之和为 ^ , 即表示所述第一节点在7;和 ^ 之间所述第一节点的调整时间。
504、 所述第一节点向所述第二节点发送 Delay— Resp报文, 所 述 Delay— Resp报文中携带所述第一节点接收所述 Delay— Req报文 时所述第一节点的本地时间 7 ^和 , 以使所述第二节点根据所述 τ Τ Γ4、
Figure imgf000053_0001
所述第二节点接收所述 Sync报文时所述第二 节点的本地时间 ^以及所述第二节点的时间调整值 获取所述第 二节点与所述第一节点的链路延时 ) , 其中, 是所述第二节点接 收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第二节点的时间调整值。 举例来说,所述第一节点向所述第二节点发送所述 Delay— Resp 报文后, 所述第二节点得到的信息包括 、 τ Τ 、 Δ '、 Δ 以 及 。 这样, 所述第二节点便可以根据这些信息得到所述第二节点 与所述第一节点的链路延时。 其中 , 在所述第二节点接收所述第一 Sync报文的时间与所述 第二节点发送所述 Delay— Req 报文的时间之间所述第二节点只发 生了一个时间调整事件的场景下, 等于所述一个时间调整事件 对应的时间调整值。 在所述第二节点接收所述第一 Sync报文的时间与所述第二节 点发送所述 Delay— Req 报文的时间之间所述第二节点发生了多个 时间调整事件的场景下, 等于多个时间调整事件分别对应的多 个时间调整值的累加值。所述多个时间调整事件与所述多个时间调 整值 对 „ 以图 2所示的网络架构为例,所述第一节点的记录时间调整值 的装置对时间调整值 和时间调整值 的记录, 和所述第二节点 中记录时间调整值的装置对时间调整值 的记录,与图 1所示的实 现方式类似, 不再赘述。 因此,所述第二节点计算所述第二节点与所述第一节点的链路 延时可以为:
D (H A _Δ ') _(Γ32
_ 2 其中, D表示所述链路延时, 表示所述第一节点发送所述第 ― Sync 报文时所述第一节点的本地时间, ^表示所述第二节点接 收所述第一 Sync 报文时所述第二节点的本地时间, ^表示所述第 二节点发送所述 Delay— Req报文时所述第二节点的本地时间, ^表 示所述第一节点接收所述 Delay— Req 报文时所述第一节点的本地 时间, Α^'表示在 与 之间所述第一节点的调整时间, 表示在 7 与 ^之间所述第一节点的调整时间 , 表示所述第二节点在 ^和 ^ 之间所述第二节点的调整时间。
505、 所述第一节点向所述第二节点发送第二 Sync报文, 所述 第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述 第一节点的本地时间 以使所述第二节点根据 i、 D以及所述第 二节点接收所述第二 Sync报文时所述第二节点的本地时间 ^获取 所述第二节点与所述第一节点的时间偏差 #^,并且使所述第二节 点根据所述时间偏差校准所述第二节点的本地时钟。 举例来说, 所述时间偏差 可以为:
Offset = T2' - T[ - D 其中, 所述 表示所述时间偏差, 表示所述第一节点发送 所述 Sync '报文时所述第一节点的本地时间 , ^表示所述第二节点 接收所述 Sync '报文时所述第二节点的本地时间, D表示所述链路 延时。 举例来说, 若 #^小于 0 , 则所述第二节点需要将自身的时间 调快, 与所述第一节点保持同步; 若^^ ^大于 0 , 则所述第二节点 需要将自身的时间调慢, 与所述第一节点保持同步; 若得到的 等于 0或者接近于 0 , 则说明所述第二节点与所述第一节点的时间 已同步, 不需要作出调整。 通过上述说明,图 8所示的实现方式中所述第一节点与所述第 二节点的 4艮文交互过程如图 9所示。 图 8所示的实现方式中所述 Delay— Resp报文的报文格式与表 3 所示的扩充后的 Delay— Resp 报文格式类似, 不同的是, 扩充后 的 Delay— Resp才艮文格式中, timeAdjustvalue表示的时间调整值为 x'。 举例来说, 当 timeAdjustvalue 表示的为 时, 说明所述第一 节点发送所述第一 Sync报文时间与接收到所述 Delay— Req报文之 间, 并没有发送新的 Sync ^文 (例如为本实施例中的第三 Sync 报文) 给所述第二节点; 当所述 timeAdjustvalue表示的为 时, 说明所述第一节点在 发送所述第一 Sync报文时间与接收到所述 Delay— Req报文之间, 有发送新的 Sync报文(例如为本实施例中的第三 Sync报文)给所 述第二节点, 即所述第一节点在接收到所述 Delay— Req报文之前, 最新发送的 Sync报文为所述第三 Sync报文。
可以理解的是, 当 timeAdjustvalue表示的为 时, 所述第三 Sync 报文也需要为扩充后的格式来携带所述第一节点在7^时发送 所述第一 Sync报文与所述第一节点在 时发送所述第三 Sync报文 之间, 所述第一节点的时间调整值 Α '的。 其中, 所述 Sync ' '报文扩充后的格式与表 1 所示的 onestep方 式中扩充后的格式相同, 即用表 1 中的 timeAdjustvalue 来携带时 间调整值 "。 当然, 也可以针对 twostep方式携带时间调整值 Δ ' , 其中扩充后的 Follow— Up报文与表 2所示的 Follow— Up报文格式相 同。
本发明实施例提供一种精确时钟协议同步方法,所述第一节点 与所述第二节点进行报文交互时,利用所述第一节点中记录时间调 整值的装置和所述第二节点中记录时间调整值的装置进行计时,通 过所述第一节点向所述第二节点发送第一 Sync报文, 当所述第二 节点在向所述第一节点发送 Delay— Req报文后,又接收到所述第一 节点发送的第三 Sync报文,所述第三 Sync报文携带所述第一节点 的时间调整值 Δ ' , 所述第一节点向所述第二节点发送 Delay— Resp 报文, 在 Delay— Resp报文中携带所述第一节点发送第三 Sync报文 和接收 Delay— Req 报文之间所述第一节点的调整时间 , 所述第 二节点并获取所述第二节点接收第一 Sync报文和发送 Delay— Req 报文之间所述第二节点的调整时间 , 使得所述第二节点根据报 文交互的发送时的本地时间和接收时的本地时间以及调整时间,获 得所述第二节点与所述第一节点的链路延时,从而获得时间偏差并 根据时间偏差校准所述第二节点的本地时钟,上述技术方案有助于 提高 PTP报文的时间同步精度, 提升同步优化性能。 以所述第二节点为执行主体,图 8所示的技术方案的方法流程 也可以如图 10所示, 包括:
601、 第二节点接收所述第一节点发送的第一 Sync 同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时 所述第一节点的本地时间 。 举例来说, 所述第一节点是网络装置, 具体可以为路由器、 网 络交换机或者分组传送网设备。 所述第二节点是网络装置, 具体可 以是路由器、 网络交换机或者分组传送网设备。
602、 所述第二节点向所述第一节点发送 Delay— Req延迟请求 报文, 并获取所述第二节点的时间调整值 , 是所述第二节点接 收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第二节点的时间调整值。
603、 所述第二节点接收所述第一节点发送的第三 Sync报文, 所述第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时 的本地时间 和所述第一节点的时间调整值 Δ ' , Λ '是所述第一节 点发送所述第一 Sync 报文的时间与所述第一节点发送所述第三 Sync 报文的时间之间所述第一节点的时间调整值, 其中, 所述第 三 Sync报文是所述第一节点在 Γι与接收到所述 Delay— Req报文时 所述第一节点的本地时间 ^之间发送至所述第二节点的, 且所述第 二节点接收到所述第三 S y n c报文的时间晚于所述第二节点发送所 述 Delay— Req报文的时间。
604、所述第二节点接收所述第一节点发送的 Delay— Resp延迟 响应报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 ^和所述第一节点的时 间调整值 ^' , 是所述第一节点发送所述第三 Sync报文的时间与 所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点 的时间调整值。
605、 所述第二节点根据 Γ τ2 , τ τ
Figure imgf000057_0001
Λ 以及 获取所 述第二节点与所述第一节点的链路延时 )。
606、 所述第二节点接收所述第一节点发送的第二 Sync报文, 所述第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时 所述第一节点的本地时间 Τ'ι。
607、 所述第二节点根据 D、 以及所述第二节点接收所述第 二 Sync报文时所述第二节点的本地时间 获取所述第二节点与所 述第一节点的时间偏差 0ffset,并且根据所述时间偏差校准所述第二 节点的本地时钟。 图 10所示的方法流程中的实现方式与图 8所示的方法流程中 的实现方式相同, 这里不再赘述。 本发明实施例提供一种精确时钟协议同步 , 与图 5所示的针 对 PTP 4艮文在 E2E场景下时间同步方式不同, 本实施例针对 PTP 才艮文在 P2P场景下的时间同步方式, 如图 1 1所示, 包括:
701、 第一节点接收第二节点发送的 Pdelay— Req 延迟请求报 文。 举例来说, 所述第一节点与所述第二节点可以为 1588 同步网 中的节点。 所述第一节点是网络装置, 具体可以为路由器、 网络交 换机或者分组传送网设备。 所述第二节点是网络装置, 具体可以是 路由器、 网络交换机或者分组传送网设备。 所述第一节点和所述第 二节点都为支持 PTP 报文通信的设备。 所述第一节点和所述第二 节点包括记录时间调整值的装置。 举例来说, 针对所述 PTP 4艮文 P2P 时间同步方式, 所述第一 节点是所述第二节点的主时钟设备,所述第一节点与所述第二节点 相邻。 具体的, 当所述第一节点在接收到所述第二节点发送的 Pdelay— Req报文时, 记录接收 Pdelay— Req报文时所述第一节点的 本地时间为 , 同时启动所述第一节点中记录时间调整值的装置。 在所述第二节点发送所述 Pdelay— Req报文时, 所述第二节点并记 录发送所述 Pdelay— Req 4艮文时所述第二节点的本地时间为 ,同时 启动所述第二节点中的记录时间调整值的装置。 此时, 所述第二节 点记录到的信息包括 。
702、 所述第一节点向所述第二节点发送 Pdelay— Resp 延迟响 应报文, 所述 Pdelay— Resp延迟响应报文中携带所述第一节点接收 所述 Pdelay— Req 文时所述第一节点的本地时间 ^、 所述第一节 点发送所述 Pdelay— Resp 文时所述第一节点的本地时间 以及所 述第一节点的时间调整值 ^, 以使所述第二节点根据 Γ2、 τ Λ 、 所述第二节点发送所述 Pdelay— Req 4艮文时所述第二节点的本地时 间 τ 所述第二节点接收所述 Pdelay— Resp报文时所述第二节点的 本地时间 ^以及所述第二节点的时间调整值 获取所述第二节点 与所述第一节点的链路延时 其中, A是所述第一节点接收所述 Pdelay— Req 报文的时间与所述第一节点发送所述 Pdelay— Resp 报 文的时间之间所述第一节点的时间调整值, 是所述第二节点发 送所述 Pdelay— Req 报文的 时 间 与 所述第 二节 点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整值。 举例来说, 所述 Pdelay— Resp报文是所述第一节点针对接收到 的所述 Pdelay— Req报文发送至所述第二节点的。 在所述第一节点 发送所述 Pdelay— Resp 文时, 从所述第一节点的记录时间调整值 的装置中获取在接收到 Pdelay— Req 报文与发送所述 Pdelay— Resp 报文之间所述第一节点的时间调整值 。
所述 Pdelay— Resp 报文携带 、 所述第一节点返回所述 Pdelay— Resp 4艮文时所述第一节点的本地时间 以及 ^。 举例来说, 在所述第一节点接收所述 Pdelay— Req报文的时间 与所述第一节点发送所述 Pdelay— Resp报文的时间之间所述第一节 点只发生了一个时间调整事件的场景下, 等于所述一个时间调整 事件对应的时间调整值。 在所述第一节点接收所述 Pdelay— Req报文的时间与所述第一 节点发送所述 Pdelay— Resp报文的时间之间所述第一节点发生了多 个时间调整事件的场景下, 等于多个时间调整事件分别对应的多 个时间调整值的累加值。所述多个时间调整事件与所述多个时间调 整值 对 。
^为所述第一节点在 ^与 ^之间的时间调整值。 可能是在 与 ^之间进行了多次时间调整产生的, 也可能是所述第一节点在 ^ 与 ^之间进行了一次时间调整。 可以是 0 , 表示所述第一节点没 有进行时间调整。
^可以是由于其他支持 1588 时间同步协议的设备对所述第一 节点进行时间同步或频率同步而产生的。
所述第二节点在接收到所述第一节点发送的 P de lay— Re sp报文 时, 并记录接收所述 Pdelay— Resp报文时所述第二节点的本地时间
Γ4 , 这时, 所述第二节点从记录时间调整值的装置获取所述第二节 点在发送 Pdelay— Req报文与接收所述 Pdelay— Resp 报文之间的时 间调整值 。
举例来说, 在所述第二节点发送所述 Pdelay— Req报文的时间 与第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节点只 发生了一个时间调整事件的场景下, 等于所述一个时间调整事 件对应的时间调整值。 在所述第二节点发送所述 Pdelay— Req报文的时间与所述第二 节点接收所述 Pdelay— Resp报文的时间之间所述第二节点发生了多 个时间调整事件的场景下, 等于多个时间调整事件分别对应的 多个时间调整值的累加值。所述多个时间调整事件与所述多个时间 调整值——对应。 可以为所述第二节点在7与 4之间进行多次时间调整的调整 时间之和。 也可能是所述第二节点在 与 之间只进行了一次时间 调整。 可以是 0 , 表示所述第二节点没有进行时间调整。
所述第二节点在记录完 后将所述第二节点中记录时间调整 值的装置清零, 等待下一个 Pdelay— Req报文发送时重新开始计时。 其中, 以图 2所示的网络架构为例, 所述第一节点中记录时间 调整值的装置对时间调整值 ^的记录,和所述第二节点中记录时间 调整值的装置对时间调整值 的记录,与图 1 所示的实施例中的实 现方式类似, 这里不再赘述。
此时, 所述第二节点得到的信息包括 、 τ2 , τ τ Δ 以及 。 这样, 所述第二节点在接收到所述 Pdelay— Resp报文后, 便可以得 到所述第二节点与所述第一节点的链路延时 D可以表示为:
D (T4 - Tl - Ay) - (T3 - T2 - Ax)
_ 2 其中, D表示所述链路延时, 表示所述第二节点发送所述 Pdelay— Req 4艮文时所述第二节点的本地时间, 表示所述第一节点 接收所述 Pdelay— Req 报文时所述第一节点的本地时间, ^表示所 述第一节点发送所述 Pdelay— Resp 文时所述第一节点的本地时 间, 表示所述第二节点接收所述 Pdelay— Resp报文时所述第二节 点的本地时间, 表示所述第一节点在 与 ^之间的调整时间, Ay 表示所述第二节点在 Γι与 之间的调整时间。 举例来说, 针对时间同步的场景, 假设第三节点是所述第一节 点的上游节点, 所述第一节点和第三节点的频率已经同步, 但是所 述第一节点与第三节点的时间不同步, 比如第三节点的时间为 100s , 所述第一节点的时间为 200s , 那么所述第一节点与第三节点 的时间相差 100s , 为了使得所述第一节点与第三节点的时间同步, 可以将所述第一节点的时间调整 - 100s , 使得所述第一节点与第三 节点的时间达到同步, 这里的 - 100s 就为所述第一节点的时间调整 值 。这里的时间调整值 可以是所述第一节点一次进行调整与第 三节点的时间保持同步, 也可以是多次 Sync报文交互进行报文交 互过程中进行调整的时间调整值。 可选的,也可以通过调整所述第一节点的频率来使得所述第一 节点与第三节点的时间同步。 根据上述举例, 可以将所述第一节点 的频率调整为第三节点的 0.5 倍, 那么在经过 200s之后, 第三节 点的时间为 300s , 所述第一节点的时间也为 300s , 所述第一节点 与第三节点的时间保持了同步,再将所述第一节点的频率调整为与 第三节点的频率相同。 此时, 这里的时间调整值 就为 o。 针对时 间调整值 与 类似, 不再赘述。
703、 所述第一节点向所述第二节点发送 Sync同步报文, 所述 Sync报文中携带所述第一节点发送所述 Sync报文时所述第一节点 的本地时间 , 以使所述第二节点根据 、 D以及所述第二节点接 收所述 Sync报文时所述第二节点的本地时间 ^获取所述第二节点 与所述第一节点的时间偏差 #^,并且使所述第二节点根据所述时 间偏差校准所述第二节点的本地时钟。 举例来说, 所述时间偏差 ^¾ ^"可以为:
Offset = T2' - T[ - D 其中, 所述 ^¾ ^"表示所述第二节点与所述第一节点的时间偏 差, 表示所述第一节点发送所述 Sync报文时的本地时间, ^'2表 示所述第二节点接收所述 Sync报文时的本地时间, D表示所述第 二节点与所述第一节点的链路延时。 举例来说, 若 小于 0 , 则所述第二节点需要将自身的时间 调快, 与所述第一节点保持同步; 若^¾ ^"大于 0 , 则所述第二节点 需要将自身的时间调慢, 与所述第一节点保持同步; 若得到的 等于 0或者接近于 0 , 则说明所述第二节点与所述第一节点的时间 已同步, 不需要作出调整。
通过上述说明, 图 1 1 所示的实现方式中所述第一节点与所述 第二节点的 ^艮文交互过程如图 12所示。 在图 1 1 所示的实现方法中, 可以在所述 Pdelay— Resp报文中 增加字节, 用来记录所述第一节点在接收所述 Pdelay— Req报文和 发送所述 Pdelay— Resp报文之间所述第一节点的时间调整值。 根据 当前 IEEE 1588-2008表 30定义的 Pdelay— Resp才艮文的格式, 字节即扩充后的 Pdelay— Resp报文格式如表 4所示: 表 4 扩充后的 Pdelay— Resp报文格式
Figure imgf000062_0001
其中, header表示所述 Pdelay— Resp报文的报文头, 包括所述 第一节点发送所述 Pdelay— Resp 文时所述第一节点的本地时间 ^ 与接收所述 Pdelay— Req 报文时所述第一节点的本地时间 ^的时间 差值, ? Τί - Τι , 所述 requestReceiptTimestamp表示所述第一节点发 送所述 Pdelay— Resp 报文时所述第 一节 点 的本地时 间 ^ , requestingPortldentity表示所述第一节点发送所述 Pdelay— Resp 才艮 文的端 口 标识, timeAdjustvalue 表示所述第一节点接收所述 Pdelay— Req 文 时 的 本地 时 间 与 所述第 一节 点发送所述
Pdelay— Resp ^文时的本地时间之间所述第一节点的时间调整值
Ax。 举例来说, 该 timeAdjustvalue的长度可以为 10个字节。
可以理解的是, 本实施例提供的技术方案是针对 onestep方式 进行时间同步的, 即将发送时的本地时间和时间调整值携带在 Pdelay— Resp 报文中发送至接收节点的, 也可以针对 twoste 方式 进行时间 同步, 即将发送时的本地时间和时间调整值携带在 Pdelay— Resp— Follow— Up 报文中, 例如在所述第一节点发送所述 Pdelay— Resp 报 文 时 , 随 后 向 所 述 第 二 节 点 发 送 Pdelay— Resp— Follow— Up 报文 , 那 么 所 述第 二 节 点 就根据 Pdelay— Resp— Follow— Up 4艮文中的时间信息和时间调整值以及所述 第二节点自身的接收时的本地时间计算所述第二节点与所述第一 节点的时间偏差。 根据当 前 IEEE 1588-2008 表 3 1 定义的 Pdelay— Resp— Follow— Up 4艮文的格式, 增加字节后即扩充后的 Pdelay— Resp— Follow— Up才艮文 ^口表 5所示: 表 5 扩充后的 Pdelay— Resp— Follow— Up才艮文格式
Figure imgf000063_0001
其中, header表示所述 Pdelay— Resp— Follow— Up才艮文的才艮文头, 包括所述第一节点发送所述 Pdelay— Resp报文的本地时间 ^与接收 所述 Pdelay— Req 4艮文的本地时间 ^的 时间差值, 即 ^ - ^ , re sponseOriginTime stam 表示所述第一节点发送所述 Pdelay— Resp 报文时所述第一节点的本地时间 , timeAdjustvalue表示所述第一 节点接收 Pdelay— Req 文时的本地时间与发送所述 Pdelay— Resp 报文时的本地时间之间所述第一节点的时间调整值 。 举例来说, 该 timeAdjustvalue的长度可以为 10个字节。
这样一来, 在现有技术中, 假设所述第一节点到所述第二节点 及所述第二节点到所述第一节点的链路延时为 所述节点根据
T Τ2 , 以及 ^得到所述第一节点与所述第二节点之间的链路延时
D ' = ^ ~ ) - (Τ, - Τ2 ),假设所述第一节点在 ΓΓ之间发生了时间调整,
2 时间调整值为 Δ , 所述第二节点在 7;与 Γ4之间发生了时间调整, 时间调 整值为 Ay , 那么所述第一节点与所述第二节点之间的实际链路延时
D = (Τ4 - ) - ( - Τ2 ) = D, + ^ - Ax ^ 如果 Ax = Ay, 那么所述第二节点得到的
2 2 链路延时没有误差, 从而使得得到的时间偏差也没有误差。 如果 fx≠4y, 那么所述第二节点得到的链路延时有误差, 误差项为 ^, 从而使得所
2 述第二节点得到的时间偏差也有误差, 误差也为^!^。
2 本发明实施例提供一种精确时钟协议同步方法,所述第一节点 与所述第二节点进行报文交互时,利用所述第一节点和所述第二节 点中的记录时间调整值的装置进行计时, 通过所述第一节点在 Pdelay— Resp报文中携带所述第一节点接收所述 Pdelay— Req报文和 发送所述 Pdelay— Resp报文之间所述第一节点的调整时间, 和所述 第二节点记录所述第二节点发送所述 Pdelay— Req报文和接收所述 Pdelay— Resp报文之间所述第二节点的调整时间, 使得所述第二节 点根据 4艮文交互发送时的本地时间和接收时的本地时间以及调整 时间, 获得所述第二节点与所述第一节点的链路延时, 从而获得时 间偏差并根据时间偏差调整所述第二节点的本地时钟,上述技术方 案有助于提高 PTP报文的时间同步精度, 提升同步优化性能。 以所述第二节点为执行主体, 图 1 1 所示的技术方案的方法流 程也可以如图 13所示, 包括:
801、 第二节点向第一节点发送 Pdelay— Req延迟请求报文。
802、 所述第二节点接收所述第一节点发送的 Pdelay— Resp 延 迟响应报文, 所述 Pdelay— Resp报文中携带所述第一节点接收所述 Pdelay— Req ^艮文时所述第一节点的本地时间 τ 所述第一节点发送 所述 Pdelay— Resp 文时所述第一节点的本地时间 ^以及所述第一 节点的时间调整值 Α , 是所述第一节点接收所述 Pdelay— Req报 文的时间与所述第一节点发送所述 Pdelay— Resp 文的时间之间所 述第一节点的时间调整值。 803、 所述第二节点根据 ^、 τ Α^、 所述第二节点发送所述 P delay_Req报文时所述第二节点的本地时间 τι、 所述第二节点接收 所述 Pdelay— Re sp 文时所述第二节点的本地时间 ^以及所述第二 节点的时间调整值 获取所述第二节点与所述第一节点的链路延 时 ) , 其中, 是所述第二节点发送所述 Pdelay— Req 报文的时间 与所述第二节点接收所述 P delay— Re sp报文的时间之间所述第二节 点的时间调整值。
804、 所述第二节点接收所述第一节点发送的 Sync 同步报文, 所述 Sync报文中携带所述第一节点发送所述 Sync报文时所述第一 节点的本地时间 τ、。
805、所述第二节点根据 、 D以及所述第二节点接收所述 Sync 报文时所述第二节点的本地时间 ^获取所述第二节点与所述第一 节点的时间偏差 0 #s 并根据所述时间偏差校准所述第二节点的本 地时钟。 图 1 3所示的方法流程中的实现方式与图 1 1所示的方法流程中 的实现方式相同, 这里不再赘述。
可选的, 以所述第一节点为执行主体, 针对频率同步的场景, 如图 1 4所示为所述第一节点的结构示意图。 所述第一节点可以用 于执行图 1 所示的方法。 参见图 1 4 , 所述第一节点 0 1 , 包括: 发送单元 0 1 1 , 用于向第二节点发送第 0个 Sync 同步 4艮文, 所述第 0 个 Sync报文中携带所述第一节点发送所述第 0 个 Sync 才艮文时所述第一节点的本地时间 T。。 所述发送单元 0 1 1 还用于向所述第二节点发送至少一个 Sync 报文, 以使所述第二节点根据所述 。、 所述第一节点发送第 N 个 Sync报文时所述第一节点的本地时间 ^ Δ 、 所述第二节点接收 所述第 0个 Sync ^艮文时所述第二节点的本地时间 。、 所述第二节 点接收所述第 N个 Sync报文时所述第二节点的本地时间 和 Ay获 取所述第二节点与所述第一节点的频率偏差,并且使所述第二节点 根据所述频率偏差校准所述第二节点的本地时钟, 其中, 所述至少 一个 Sync才艮文包含第 i个 Sync才艮文, 所述第 i个 Sync才艮文中携 带所述第一节点向所述第二节点发送所述第 i个报文时所述第一节 点的本地时间 ^和时间调整值^^ , ^是所述第一节点发送第 i- 1个 同步报文的时间与所述第一节点发送第 i个同步报文的时间之间所 述第一节点的时间调整值, ^是所述第二节点接收所述第 i- 1个同 步报文的时间与所述第二节点接收所述第 i个同步报文的时间之间 所述第二节点的时间调整值, N为正整数, i是 1 至 N中的所有正 整数, ^是所述第一节点发送所述第 0个 Sync报文的时间与所述 第一节点发送所述第 N个 Sync报文的时间之间所述第一节点的时 间调整值, 是所述第二节点接收所述第 0个 Sync报文的时间与 所述第二节点接收所述第 N个 Sync报文的时间之间所述第二节点 的时间调整值。 举例来说, 所述第二节点与所述第一节点的频率偏差为:
N
T —T - Av W ∑ i
N N
其中, Ax = ^i Axi = Axl + Ax2 +… + AxN, Ay = ^ Ay. = Ayl + Ay2 +… + AyN。 举例来说, 所述第一节点和所述第二节点可以是 1588 同步网 中的节点。 所述第一节点是网络装置, 具体可以为路由器、 网络交 换机或者分组传送网设备。 所述第二节点是网络装置, 具体可以是 路由器、 网络交换机或者分组传送网设备。 所述第一节点和所述第 二节点都为支持 PTP 报文通信的设备。 所述第一节点和所述第二 节点包括记录时间调整值的装置。 举例来说, 所述第一节点为所述第二节点的主时钟设备, 这里 当所述第一节点与所述第二节点中间存在不支持 1588-2008标准的 中间节点时, 所述第一节点与所述第二节点一般配置为 1588-2008 标准的 E2E 方式。 当所述第一节点与所述第二节点为相邻节点, 所述第一节点与所述第二节点可以配置为 1588-2008 标准的 E2E 方式或者 P2P方式。 举例来说, 可以是由于所述第一节点发生时间调整事件产 生的时间调整值。 例如, 在所述第一节点发送第 i- 1 个 Sync报文 的时间与所述第一节点发送第 i个 Sync 同步报文的时间之间所述 第一节点只发生了一个时间调整事件的场景下, 等于所述一个 时间调整事件对应的时间调整值。 在所述第一节点发送第 i- 1个同步报文的时间与所述第一节点 发送第 i个同步报文的时间之间所述第一节点发生了多个时间调整 事件的场景下, ^等于多个时间调整事件分别对应的多个时间调 整值的累加值。所述多个时间调整事件与所述多个时间调整值—— 对应。
举例来说, 可以是由于所述第二节点发生时间调整事件产 生的时间调整值。 例如, 在所述第二节点接收第 i- 1 个 Sync报文 的时间与所述第二节点接收第 i个 Sync 同步报文的时间之间所述 第二节点只发生了一个时间调整事件的场景下, ^等于所述一个 时间调整事件对应的时间调整值。 在所述第二节点接收第 i- 1个同步报文的时间与所述第二节点 接收第 i个同步报文的时间之间所述第二节点发生了多个时间调整 事件的场景下, ^等于多个时间调整事件分别对应的多个时间调 整值的累加值。所述多个时间调整事件与所述多个时间调整值—— 对应。
本发明实施例提供一种精确时钟协议同步方法,所述第一节点 在向所述第二节点发送 Sync报文时, 通过所述第一节点中记录时 间调整值的装置记录相邻的两个 Sync报文之间第一节点的时间调 整值, 所述第二节点在从所述第一节点接收 Sync报文时, 通过所 述第二节点中的记录时间调整值的装置记录相邻的两个 Sync报文 之间所述第二节点的时间调整值,所述第二节点根据所述第一节点 的时间调整值、 所述第二节点的时间调整值、 所述第一节点发送 Sync报文时的本地时间和所述第二节点发送 Sync报文时的本地时 间获取所述第二节点与所述第一节点的频率偏差,上述技术方案有 助于提高 PTP报文的频率同步精度, 提升同步优化性能。 以所述第二节点为执行主体, 如图 15所示为所述第二节点的 结构示意图。 所述第二节点可以用于执行图 4所示的方法。 参见图 1 5 , 所述第二节点 02 , 包括: 接收单元 02 1 , 用于从第一节点接收第 0个 Sync 同步报文, 所述第 0 个 Sync报文中携带所述第一节点发送所述第 0 个 Sync 才艮文时所述第一节点的本地时间 T 0。 所述接收单元 02 1 还用于接收所述第一节点发送的至少一个 Sync报文, 所述至少一个 Sync报文包括第 N个 Sync报文, 所述 至少一个 Sync才艮文包含第 i个 Sync才艮文, 所述第 i个 Sync才艮文 中携带所述第一节点向所述第二节点发送所述第 i个报文时所述第 一节点的本地时间 ^和时间调整值 ^ , ^是所述第一节点发送第 i- 1 个同步报文的时间与所述第一节点发送第 i 个同步报文的时间 之间所述第一节点的时间调整值。 处理单元 022 , 用于根据 、 所述第一节点发送所述第 N 个 Sync报文时所述第一节点的本地时间 ^ Δ 、 所述第二节点接收 所述第 0个 Sync ^艮文时所述第二节点的本地时间 T 、 所述第二节 点接收第 Ν个 Sync报文时所述第二节点的本地时间 和 Ay获取所 述第二节点与所述第一节点的频率偏差,并根据所述频率偏差校准 所述第二节点的本地时钟, 其中, Δ^是所述第二节点接收所述第 i- 1 个同步报文的时间与所述第二节点接收所述第 i 个同步报文的 时间之间所述第二节点的时间调整值, N为正整数, i是 1 至 N中 的所有正整数, 是所述第一节点发送所述第 0个 Sync报文的时 间与所述第一节点发送所述第 N个 Sync报文的时间之间所述第一 节点的时间调整值, 是所述第二节点接收所述第 0个 Sync报文 的时间与所述第二节点接收所述第 N个 Sync报文的时间之间所述 第二节点的时间调整值。 举例来说, 所述第二节点与所述第一节点的频率偏差为: 其中, Ax = ^j Axi = Axl + Ax2 + · · · + AxN , Ay = ^ Ayt = Ayl + Ay2 + · · · + AyN
!•=1 i=l 可选的, 以所述第一节点为执行主体, 针对时间同步的场景, 如图 16所示为所述第一节点的结构示意图。 所述第一节点可以用 于执行图 5所示的方法。 参见图 16 , 所述第一节点 03 , 包括: 发送单元 03 1 , 用于向第二节点发送第一 Sync 同步 4艮文, 所 述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所 述第一节点的本地时间 。 举例来说, 所述第一节点和所述第二节点可以为路由器、 交换 机、 ΡΤΝ 或者波分设备等, 所述第一节点和所述第二节点为支持 ΡΤΡ报文发送和接收的设备。所述第一节点和所述第二节点包括记 录时间调整值的装置。 举例来说, 针对所述 ΡΤΡ 4艮文 Ε2Ε 时间同步方式, 所述第一 节点与所述第二节点之间存在多个中间节点, 当某一中间节点支持 1588-2008标准时, 该中间节点需要进行 ΡΤΡ ^艮文转发, 还需要与 该中间节点的最近的一个支持 1588-2008 标准的节点进行时间同 步, 当某一中间节点不支持 1588-2008标准时, 该中间节点需要进 行 ΡΤΡ报文转发, 不需要进行时间同步。 接收单元 032 , 用于接收所述第二节点发送的 Delay— Req延迟 请求 4艮文。
获取单元 033 , 用于获取所述第一节点的时间调整值 Α , 是所 述第一节点发送所述第一 Sync报文的时间与所述第一节点接收所 述 Delay— Req报文的时间之间所述第一节点的时间调整值。 举例来说, 在所述第一节点发送所述第一 Sync报文的时间与 所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点 只发生了一个时间调整事件的场景下, 等于所述一个时间调整事 件对应的时间调整值。 在所述第一节点发送第一 Sync报文的时间与所述第一节点接 收所述 Delay— Req 报文的时间之间所述第一节点发生了多个时间 调整事件的场景下, Δ 等于多个时间调整事件分别对应的多个时间 调整值的累加值。所述多个时间调整事件与所述多个时间调整值一 一对应。 所述发送单元 03 1还用于向所述第二节点发送 Delay— Resp延 迟响应 4艮文, 所述 Delay— Resp 文包括所述第一节点的时间调整 值 Δ 和 以使所述第二节点根据 、 Τ4、 χ , 所述第二节点接收 所述第一 Sync 报文时所述第二节点的本地时间 τ2、 所述第二节点 发送所述 Delay— Req报文时所述第二节点的本地时间 T 和所述第 二节点的时间调整值 获取链路延时 其中, 是所述第二节 点接收所述第一 Sync 报文的时间与所述第二节点发送所述 Delay— Req ^文的时间之间所述第二节点的时间调整值。 举例来说, 在所述第二节点接收所述第一 Sync报文的时间与 所述第二节点发送所述 Delay— Req 报文的时间之间所述第二节点 只发生了一个时间调整事件的场景下, 等于所述一个时间调整 事件对应的时间调整值。 在所述第二节点接收所述第一 Sync报文的时间与所述第二节 点发送所述 Delay— Req 报文的时间之间所述第二节点发生了多个 时间调整事件的场景下, 等于多个时间调整事件分别对应的多 个时间调整值的累加值。所述多个时间调整事件与所述多个时间调 整值 对 。 所述第一节点在接收到所述 Delay— Req报文后,将7^和 ^携带 在与所述 Delay— Req报文对应的 Delay— Resp报文中, 发送至所述 第二节点, 所述第二节点此时得到的信息包括7τ τ τ Δ 以 及 。 因此, 所述第二节点与所述第一节点的链路延时为:
D _ (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2 所述发送单元 03 1还用于: 向所述第二节点发送第二 Sync报 文, 所述第二 Sync 报文中携带所述第一节点发送所述第二 Sync 报文时所述第一节点的本地时间 使所述第二节点根据 i、 所述 第二节点接收所述第二 Sync报文时所述第二节点的本地时间 ^'2和 D获取所述第二节点与所述第一节点的时间 H 0ffset , 并且使所述 第二节点根据所述时间偏差校准所述第二节, ^的本地时钟。 举例来说, 所述第二节点与所述第一节点的时间偏差为: Offset = T2 - T - D 举例来说, 若 #^小于 0 , 则所述第二节点需要将自身的时间 调快, 与所述第一节点保持同步; 若^^ ^大于 0 , 则所述第二节点 需要将自身的时间调慢, 与所述第一节点保持同步; 若得到的 等于 0或者接近于 0 , 则说明所述第二节点与所述第一节点的时间 已同步, 不需要作出调整。 本发明实施例提供一种第一节点,所述第一节点与所述第二节 点进行报文交互时,利用所述第一节点中记录时间调整值的装置和 所述第二节点中记录时间调整值的装置进行计时,通过所述第一节 点在 Delay— Resp 报文中携带所述第一节点发送 Sync 报文和接收 Delay— Req报文之间所述第一节点的调整时间, 和所述第二节点记 录所述第二节点接收 Sync报文和发送 Delay— Req报文之间所述第 二节点的调整时间,使得所述第二节点根据报文交互的发送时的本 地时间和接收时的本地时间以及调整时间,获得所述第二节点与所 述第一节点的链路延时, 从而获得时间偏差, 使得所述第二节点根 据时间偏差校准所述第二节点的本地时钟,上述技术方案有助于提 高 PTP报文的时间同步精度, 提升同步优化性能。 可选的, 以所述第二节点为执行主体, 针对时间同步的场景, 如图 17所示为所述第二节点的结构示意图, 所述第二节点 04 , 包 括: 接收单元 041 , 用于接收第一节点发送的第一 Sync同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时 所述第一节点的本地时间 τι。 发送单元 042 , 用于向所述第一节点发送 Delay— Req延迟请求 报文。 获取单元 043 , 用于获取所述第二节点的时间调整值 , 是 所述第二节点接收所述第一 Sync报文的时间与所述第二节点发送 所述 Delay— Req ^文的时间之间所述第二节点的时间调整值。 所述接收单元 041 还用 于接收所述第 一节 点发送的 Delay— Resp延迟响应报文, 所述 Delay— Resp报文中携带所述第一 节点接收所述 Delay— Req报文时所述第一节点的本地时间 ^ , 和所 述第一节点的时间调整值 , Λ 是所述第一节点发送所述第一
Sync报文的时间与所述第一节点接收所述 Delay— Req报文的时间 之间所述第一节点的时间调整值。
处理单元 044, 用于根据 Γι、 Τ Τ Γ4、 和 获取所述第 二节点与所述第一节点的链路延时 )。 举例来说, 所述第二节点与所述第一节点的链路延时为:
D (T4-Tl-Ax)-(T3-T2-Ay)
_ 2 所述接收单元 041,还用于接收所述第一节点发送的第二 Sync 报文, 所述第二 Sync报文中携带所述第一节点发送所述第二 Sync 报文时所述第一节点的本地时间 T、。 所述处理单元 044, 还用于根据 D、 ^以及所述第二节点接收 所述第二 Sync报文时所述第二节点的本地时间 ^'2获取所述第二节 点与所述第一节点的时间偏差 G ^,并且根据所述时间偏差校准所 述第二节点的本地时钟。 举例来说, 所述第二节点与所述第一节点的时间偏差为: Offset = T2'-T[-D 可选的, 以所述第一节点为执行主体, 针对时间同步的场景, 如图 18 所示为所述第一节点的结构示意图。 所述第一节点可以用 于执行图 8所示的方法。 参见图 18, 所述第一节点 05, 包括: 发送单元 051, 用于向第二节点发送第一 Sync 同步 4艮文, 所 述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所 述第一节点的本地时间 7。 所述发送单元 051, 还用于向所述第二节点发送第三 Sync报 文, 所述第三 Sync 报文中携带所述第一节点发送所述第三 Sync 报文时所述第一节点的本地时间 1和所述第一节点的时间调整值 Δ ' , Δ '是所述第一节点发送所述第 - Sync报文的时间与所述第 ― 节点发送所述第三 Sync报文的时间之间所述第一节点的时间调整 值。
举例来说, Δ '为 与 7 之间所述第一节点的时间调整值, 所述 第三 Sync 报文是在所述第一节点向所述第二节点发送所述第一 Sync报文之后发送给所述第二节点的。
举例来说, 所述 Δ '是在所述第一节点向所述第二节点发送所 述第三 Sync报文时, 从所述第一节点的记录时间调整值的装置中 获取的, 记录的是7 ^与 之间所述第一节点的调整时间。 所述第一 节点并记录了所述第一节点发送所述第三 Sync报文时所述第一节 点的本地时间 T'、。 举例来说, 在所述第一节点发送所述第一 Sync报文的时间与 所述第一节点发送所述第三 Sync报文的时间之间所述第一节点只 发生了一个时间调整事件的场景下, Δ '等于所述一个时间调整事 件对应的时间调整值。 在所述第一节点发送第一 Sync报文的时间与所述第一节点发 送所述第三 Sync报文的时间之间所述第一节点发生了多个时间调 整事件的场景下, Δ '等于多个时间调整事件分别对应的多个时间 调整值的累加值。所述多个时间调整事件与所述多个时间调整值一 一对应。 举例来说, 所述第一节点在发送所述第三 Sync报文时, 在获 得了 Δ '后, 可以将所述第一节点中记录时间调整值的装置清零并 重新开始计时。 举例来说, 所述第二节点在接收到所述第一节点发送的第三 Sync报文后, 得到的信息包括 、 Τ 、 所述第二节点接收所述第一 Sync 文时所述第二节点的本地时间 、 所述第二节点发送 Delay— Req延迟请求报文时所述第二节点的本地时间 ^以及 '。 接收单元 052 , 用于接收所述第二节点发送的 Delay— Req延迟 请求 4艮文。
获取单元 053 , 用于获取所述第一节点的时间调整值 Δ , 是 所述第一节点发送所述第三 Sync报文的时间与所述第一节点接收 所述 Delay— Req 报文的时间之间所述第一节点的时间调整值, 其 中, 所述第二节点接收到所述第三 Sync报文的时间晚于所述第二 节点发送所述 Delay— Req报文的时间。 举例来说, 所述第二节点在接收到所述第一节点发送的第一 Sync报文后, 便向所述第一节点发送 Delay— Req报文, 由于所述 第一节点在发送所述第一 Sync报文后, 又向所述第二节点发送了 第三 Sync报文,所述第三 Sync报文是在所述第二节点向所述第一 节点发送 Delay— Req报文之后, 从所述第一节点接收到的, 这样, 所述第一节点在接收到所述 Delay— Req 报文后, 记录接收所述 Delay— Req报文时所述第一节点的本地时间为 ^。 当所述第一节点在 与 ^之间发生了时间调整值时, 所述第一 节点中记录时间调整的装置获取 与 之间所述第一节点的时间 调整值 Δ 。 举例来说, 在所述第一节点发送所述第三 Sync报文的时间与 所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点 只发生了一个时间调整事件的场景下, Δ 等于所述一个时间调整 事件对应的时间调整值。 在所述第一节点发送第三 Sync报文的时间与所述第一节点接 收所述 Delay— Req 报文的时间之间所述第一节点发生了多个时间 调整事件的场景下, 等于多个时间调整事件分别对应的多个时 间调整值的累加值。所述多个时间调整事件与所述多个时间调整值 ——对应。
即所述 Δ 也可以是所述第一节点在 7 与 7之间进行的一次时 间调整产生的, 也可以是多次时间调整的累加值, 也可以为 0。 所 述 Δ 等于 0表示所述第一节点没有进行时间调整。
这里相当于 与 Λ '之和为 ^ , 即所述第一节点在 和7之间 所述第一节点的调整时间。 所述发送单元 05 1 , 还用于向所述第二节点发送 Delay— Resp 报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req报文时所述第一节点的本地时间 ^和 , 以使所述第二 节点根据所述 、 Τ τ
Figure imgf000075_0001
所述第二节点接收所述 Sync 报文时所述第二节点的本地时间 以及所述第二节点的时间调整 值 获取所述第二节点与所述第一节点的链路延时 其中, 是 所述第二节点接收所述第一 Sync报文的时间与所述第二节点发送 所述 Delay— Req ^文的时间之间所述第二节点的时间调整值。 在所述第二节点接收所述第一 Sync报文的时间与所述第二节 点发送所述 Delay— Req 报文的时间之间所述第二节点只发生了一 个时间调整事件的场景下, 等于所述一个时间调整事件对应的 时间调整值。
在所述第二节点接收所述第一 Sync报文的时间与所述第二节 点发送所述 Delay— Req 报文的时间之间所述第二节点发生了多个 时间调整事件的场景下, 等于多个时间调整事件分别对应的多 个时间调整值的累加值。所述多个时间调整事件与所述多个时间调 整值 对 。 举例来说, 所述第二节点与所述第一节点的链路延时为:
D (H A _ Δ ') _ (Γ32 _ Δ
_ 2 所述发送单元 05 1还用于: 向所述第二节点发送第二 Sync报 文, 所述第二 Sync 报文中携带所述第一节点发送所述第二 Sync 报文时所述第一节点的本地时间 '1 , 以使所述第二节点根据所述 T、、 所述链路延时 D以及所述第二节点接收所述 Sync '报文时所述 第二节点的本地时间 获取所述第二节点与所述第一节点的时间 偏差 0ffset。 举例来说, 所述第二节点与所述第一节点的时间偏差为: Offset = T2' - T[ - D 本发明实施例提供一种第一节点,所述第一节点与所述第二节 点进行报文交互时,利用所述第一节点中记录时间调整值的装置和 所述第二节点中记录时间调整值的装置进行计时,通过所述第一节 点向所述第二节点发送第一 Sync报文, 当所述第二节点在向所述 第一节点发送 Delay— Req报文后,又接收到所述第一节点发送的第 三 Sync报文,所述第三 Sync报文携带所述第一节点的时间调整值 Δ " , 所述第一节点向所述第二节点发送 Delay— Resp 报文, 在 Delay— Resp 报文中携带所述第一节点发送 Sync 报文和接收 Delay— Req报文之间所述第一节点的调整时间 , 所述第二节点并 获取所述第二节点接收 Sync报文和发送 Delay— Req报文之间所述 第二节点的调整时间 , 使得所述第二节点根据报文交互的发送 时的本地时间和接收时的本地时间以及调整时间,获得所述第二节 点与所述第一节点的链路延时,从而获得时间偏差并根据时间偏差 校准所述第二节点的本地时钟, 上述技术方案有助于提高 PTP 报 文的时间同步精度, 提升同步优化性能。 可选的, 以所述第二节点为执行主体, 针对时间同步的场景, 如图 19所示为所述第二节点的结构示意图。 所述第二节点可以用 于执行图 10所示的方法。 参见图 19 , 所述第二节点 06 , 包括: 接收单元 061 , 用于接收所述第一节点发送的第一 Sync 同步 报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync 才艮文时所述第一节点的本地时间 。 发送单元 062 , 用于向所述第一节点发送 Delay— Req延迟请求 报文。 获取单元 063 , 用于获取所述第二节点的时间调整值 , 是 所述第二节点接收所述第一 Sync报文的时间与所述第二节点发送 所述 Delay— Req ^文的时间之间所述第二节点的时间调整值。 所述接收单元 061 ,还用于接收所述第一节点发送的第三 Sync 报文, 所述第三 Sync报文中携带所述第一节点发送所述第三 Sync 才艮文时的本地时间 T'、和所述第一节点的时间调整值 Λ ' , Ax"是所述 第一节点发送所述第一 Sync报文的时间与所述第一节点发送所述 第三 Sync报文的时间之间所述第一节点的时间调整值, 其中, 所 述第三 Sync报文是所述第一节点在 Γι与接收到所述 Delay— Req报 文时所述第一节点的本地时间 T4之间发送至所述第二节点的, 且所 述第二节点接收到所述第三 S y n c报文的时间晚于所述第二节点发 送所述 Delay— Req报文的时间。 所述接收单元 061 , 还用 于接收所述第 一节点发送的 Delay— Req 延迟请求报文, 所述 Delay— Resp 报文中携带所述第一 节点接收所述 Delay— Req报文时所述第一节点的本地时间 ^和所述 第一节点的时间调整值 Δ , 是所述第一节点发送所述第三 Sync 报文的时间与所述第一节点接收所述 Delay— Req 报文的时间之间 所述第一节点的时间调整值;
处理单元 064, 用于根据所述 Γι、 Τ2 , Τ Τ
Figure imgf000077_0001
Λ 以及 Ay获 取所述第二节点与所述第一节点的链路延时 D。 举例来说, 所述第二节点与所述第一节点的链路延时为:
D (Τ,-Τ,-Αχ'-Αχ'^-^-Τ,-Αγ)
_ 2 所述接收单元 061 ,还用于接收所述第一节点发送的第二 Sync 报文, 所述第二 Sync报文中携带所述第一节点发送所述第二 Sync 报文时所述第一节点的本地时间 T、。 所述处理单元 064 , 还用于根据 D、 以及所述第二节点接收 所述 Sync'报文时所述第二节点的本地时间 ^获取所述第二节点与 所述第一节点的时间偏差 ,并且根据所述时间偏差校准所述第 二节点的本地时钟。 举例来说, 所述第二节点与所述第一节点的时间偏差为: Offset = T2'-T -D 可选的, 以所述第一节点为执行主体, 针对时间同步的场景, 如图 20所示为所述第一节点的结构示意图。 所述第一节点可以用 于执行图 11 所示的方法。 参见图 20, 所述第一节点 07, 包括: 接收单元 071 , 用于接收第二节点发送的 Pdelay— Req 延迟请 求报文。 举例来说, 所述第一节点与所述第二节点可以为 1588 同步网 中的节点。 所述第一节点是网络装置, 具体可以为路由器、 网络交 换机或者分组传送网设备。 所述第二节点是网络装置, 具体可以是 路由器、 网络交换机或者分组传送网设备。 所述第一节点和所述第 二节点都为支持 PTP 报文通信的设备。 所述第一节点和所述第二 节点包括记录时间调整值的装置。 举例来说, 针对所述 PTP 4艮文 P2P 时间同步方式, 所述第一 节点是所述第二节点的上游节点,所述第一节点与所述第二节点相 邻。 具体的, 当所述第一节点在接收到所述第二节点发送的 Pdelay— Req报文时, 记录接收 Pdelay— Req报文时所述第一节点的 本地时间为 , 同时启动所述第一节点中记录时间调整值的装置。 在所述第二节点发送所述 Pdelay— Req报文时, 所述第二节点并记 录发送所述 Pdelay— Req 4艮文时所述第二节点的本地时间为 τι ,同时 启动所述第二节点中的记录时间调整值的装置。 此时, 所述第二节 点记录到的信息包括 。 发送单元 072 , 用于向所述第二节点发送 Pdelay— Resp延迟响 应报文, 所述 Pdelay— Resp延迟响应报文中携带所述第一节点接收 所述 Pdelay— Req 文时所述第一节点的本地时间 ^、 所述第一节 点发送所述 Pdelay— Resp 文时所述第一节点的本地时间 以及所 述第一节点的时间调整值 Δ , 以使所述第二节点根据 ^、 τ Α 、 所述第二节点发送所述 Pdelay— Req 4艮文时所述第二节点的本地时 间 Γ 所述第二节点接收所述 Pdelay— Resp报文时所述第二节点的 本地时间 ^以及所述第二节点的时间调整值 获取所述第二节点 与所述第一节点的链路延时 其中, 是所述第一节点接收所述 Pdelay— Req 报文的时间与所述第一节点发送所述 Pdelay— Resp 报 文的时间之间所述第一节点的时间调整值, 是所述第二节点发 送所述 Pdelay— Req 报文的 时 间 与 所述第 二节 点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整值。 举例来说, 所述 Pdelay— Resp报文是所述第一节点针对接收到 的所述 Pdelay— Req报文发送至所述第二节点的。 在所述第一节点 发送所述 Pdelay— Resp 文时, 从所述第一节点的记录时间调整值 的装置中获取在接收到 Pdelay— Req 报文与发送所述 Pdelay— Resp 报文之间所述第一节点的时间调整值 。 所述 Pdelay— Resp 报文携带 、 所述第一节点返回所述 Pdelay— Resp 4艮文时所述第一节点的本地时间 ^以及 ^。 举例来说, 在所述第一节点接收所述 Pdelay— Req报文的时间 与所述第一节点发送所述 Pdelay— Resp报文的时间之间所述第一节 点只发生了一个时间调整事件的场景下, ^等于所述一个时间调整 事件对应的时间调整值。 在所述第一节点接收所述 Pdelay— Req报文的时间与所述第一 节点发送所述 Pdelay— Resp报文的时间之间所述第一节点发生了多 个时间调整事件的场景下, 等于多个时间调整事件分别对应的多 个时间调整值的累加值。所述多个时间调整事件与所述多个时间调 整值 对 。 所述第二节点在接收到所述第一节点发送的 P de lay— Re sp报文 时, 并记录接收所述 Pdelay— Resp报文时所述第二节点的本地时间
Γ4 , 这时, 所述第二节点从记录时间调整值的装置获取所述第二节 点在发送 Pdelay— Req报文与接收所述 Pdelay— Resp 报文之间的时 间调整值 。
举例来说, 在所述第二节点发送所述 Pdelay— Req报文的时间 与第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节点只 发生了一个时间调整事件的场景下, 等于所述一个时间调整事 件对应的时间调整值。 在所述第二节点发送所述 Pdelay— Req报文的时间与所述第二 节点接收所述 Pdelay— Resp报文的时间之间所述第二节点发生了多 个时间调整事件的场景下, 等于多个时间调整事件分别对应的 多个时间调整值的累加值。所述多个时间调整事件与所述多个时间 调整值——对应。
所述第二节点在记录完 后将所述第二节点中记录时间调整 值的装置清零, 等待下一个 Pdelay— Req报文发送时重新开始计时。 举例来说, 所述第二节点与所述第一节点的链路延时为: 所述发送单元 072 , 还用于向所述第二节点发送 Sync 同步报 文,所述 Sync报文中携带所述第一节点发送所述 Sync报文时所述 第一节点的本地时间 以使所述第二节点根据 i、 D以及所述第 二节点接收所述 Sync报文时所述第二节点的本地时间 ^'2获取所述 第二节点与所述第一节点的时间偏差 σ^ ^并且使所述第二节点根 据所述时间偏差校准所述第二节点的本地时钟。 举例来说, 所述第二节点与所述第一节点的时间偏差为: Offset = T2' - T[ - D 本发明实施例提供一种第二节点,所述第一节点与所述第二节 点进行报文交互时,利用所述第一节点和所述第二节点中的记录时 间调整值的装置进行计时, 通过所述第一节点在 Pdelay— Resp报文 中携带所述第一节点接收所述 Pdelay— Req 报文和发送所述 Pdelay— Resp报文之间所述第一节点的调整时间, 和所述第二节点 记录所述第 二节 点发送所述 Pdelay— Req 报文和接收所述 Pdelay— Resp报文之间所述第二节点的调整时间, 使得所述第二节 点根据 4艮文交互发送时的本地时间和接收时的本地时间以及调整 时间, 获得所述第二节点与所述第一节点的链路延时, 从而获得时 间偏差并根据时间偏差调整所述第二节点的本地时钟,上述技术方 案有助于提高 PTP报文的时间同步精度, 提升同步优化性能。 可选的, 以所述第二节点为执行主体, 针对时间同步的场景, 如图 21 所示为所述第二节点的结构示意图, 所述第一节点 08 , 包 括: 发送单元 081 , 用于向第一节点发送 Pdelay— Req 延迟请求报 文。 接收单元 082 , 用于接收所述第一节点发送的 Pdelay— Resp延 迟响应报文, 所述 Pdelay— Resp报文中携带所述第一节点接收所述 Pdelay— Req ^艮文时所述第一节点的本地时间 τ 所述第一节点发送 所述 Pdelay— Resp 文时所述第一节点的本地时间 ^以及所述第一 节点的时间调整值 是所述第一节点接收所述 Pdelay— Req报 文的时间与所述第一节点发送所述 Pdelay— Resp ^文的时间之间所 述第一节点的时间调整值。
处理单元 083, 用于根据 Γ2、 τ Δ 、 所述第二节点发送所述 Pdelay— Req报文时所述第二节点的本地时间 τ 所述第二节点接收 所述 Pdelay— Resp 文时所述第二节点的本地时间 ^以及所述第二 节点的时间调整值 获取所述第二节点与所述第一节点的链路延 时 Z), 其中, 是所述第二节点发送所述 Pdelay— Req 报文的时间 与所述第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节 点的时间调整值。 举例来说, 所述第二节点与所述第一节点的链路延时为:
D (T4-Tl-Ay)-(T3-T2-Ax)
_ 2 所述接收单元 082, 还用于接收所述第一节点发送的 Sync 同 步报文,所述 Sync报文中携带所述第一节点发送所述 Sync报文时 所述第一节点的本地时间 T 。 所述处理单元 083, 还用于根据 ^1、 以及所述第二节点接收 所述 S y n c报文时所述第二节点的本地时间 ^ ' 2获取所述第二节点与 所述第一节点的时间偏差 #^,并根据所述时间偏差校准所述第二 节点的本地时钟。 举例来说, 所述第二节点与所述第一节点的时间偏差为: Offset = T2'-T -D 本发明实施例提供一种节点 09, 如图 22所示, 该节点包括中 央处理单元 091 (英文: central processing unit, 缩写: CPU), 晶 振 092, 物理层 (英文: physical layer, 缩写: PHY) 芯片 093, 计数器 094, 存储器 095以及总线 096, 其中存储器 095可以包括 数据和指令,如图 23所示, PHY可以包括接收时间生成电路 0931 , 发送时间生成电路 0932, 收发器 0933, 晶振 0934, 计数器 0935、 寄存器 0936以及总线 0937。 在本发明实施例中, 晶振 092与计数器 094耦合, 计数器 094 与存储器 095耦合, 晶振 092 以一定的频率输出方波, 计数器 094 对方波的数量进行统计, 具体来说, 计数器 094在每个方波的作用 沿执行累加操作, 累加操作的结果保存在存储器 095 中, 存储器 095 中保存的值就对应节点的本地时钟的本地时间。其中,晶振 092 的工作电压与晶振 092的频率相关, 晶振 092的工作电压越高, 晶 振 092的频率越高。 其中, 在物理层芯片 093 中, 计数器 0935 的值对应物理层芯 片 093 的本地时间, 这里计数器 0935不同于本地节点中的计数器 094。 物理层芯片 093在接收 PTP报文时, 其中的接收时间生成电 路读取计数器 0935 中的值,并将物理层芯片中计数器 0935的值写 入寄存器 0936 , 中央处理单元 091 可以访问物理层芯片 093 中的 寄存器 0936 , 从而获取 PTP报文的接收时间; 物理层芯片 093在 发送 PTP 报文时, 物理层芯片中的发送时间生成电路读取计数器 0935的值, 将计数器 0935的值写入寄存器 0936 , 中央处理单元可 以访问寄存器 0936 , 从而获取 PTP报文的发送时间。 针对本发明实施例中的时间调整事件可以是主时钟节点对从 时钟节点进行时间同步, 具体来说, 从时钟节点中的中央处理单元 091 在获得了与主时钟节点的 PTP 4艮文的发送时间以及 PTP 4艮文 的接收时间后, 中央处理单元 091 可以根据 PTP 报文的发送时间 和 PTP 报文的接收时间来计算时间调整值, 也即时间偏差, 中央 处理单元 091根据时间偏差调整本地时钟的本地时间,具体可以根 据时间偏差调整本地时钟的计数器 094 的值, 中央处理单元 091 再将调整后的本地时间写入存储器 095 , 并将时间调整值写入存储 器 095。 而频率调整事件可以是主时钟节点对从时钟节点进行频率同 步, 具体来说, 从时钟节点中的中央处理器 091在获得了与主时钟 节点的 PTP报文的发送时间以及 PTP报文的接收时间后, 可以根 据 PTP报文的发送时间和 PTP报文的接收时间计算频率调整值, 并将频率调整值保存至存储器 095 , 中央处理单元 091再根据晶振 092的频率与晶振 092的工作电压的对应关系, 以及频率调整值, 计算出工作电压调整值,频率调整电路将工作电压调整值发送至晶 振 092以对晶振 092的工作电业进行调整。 以前述实施例中的第一节点和第二节点中第一节点为执行主 体, 针对所述第一节点对所述第二节点进行频率同步的场景, 收发 器用于向所述第二节点发送第 0个 Sync同步报文,所述第 0个 Sync 报文包括所述收发器发送所述第 0个 Sync报文时所述第一节点的 本地时间 收发器执行指令还用于向所述第二节点发送至少一个 Sync报文, 以使所述第二节点根据 。、 所述第一节点发送第 N个 Sync报文时所述第一节点的本地时间 ^ Δ 、 所述第二节点接收 所述第 0个 Sync ^艮文时所述第二节点的本地时间 。、 所述第二节 点接收所述第 N个 Sync报文时所述第二节点的本地时间 和 Ay获 取所述第二节点与所述第一节点的频率偏差,并且使所述第二节点 根据所述频率偏差校准所述第二节点的本地时钟, 其中, 所述至少 一个 Sync才艮文包含第 i个 Sync才艮文, 所述第 i个 Sync才艮文中携 带所述第一节点向所述第二节点发送所述第 i个报文时所述第一节 点的本地时间 ^和时间调整值 , ^是所述第一节点发送第 i- 1个 同步报文的时间与所述第一节点发送第 i个同步报文的时间之间所 述第一节点的时间调整值, ^是所述第二节点接收所述第 i- 1个同 步报文的时间与所述第二节点接收所述第 i个同步报文的时间之间 所述第二节点的时间调整值, N为正整数, i是 1 至 N中的所有正 整数, ^是所述第一节点发送所述第 0个 Sync报文的时间与所述 第一节点发送所述第 N个 Sync报文的时间之间所述第一节点的时 间调整值, 是所述第二节点接收所述第 0个 Sync报文的时间与 所述第二节点接收所述第 N个 Sync报文的时间之间所述第二节点 的时间调整值。 举例来说, ^是由于所述第一节点发生时间调整事件产生的 时间调整值。 例如, 在所述第一节点发送第 i- 1 个 Sync报文的时 间与所述第一节点发送第 i个 Sync 同步报文的时间之间所述第一 节点只发生了一个时间调整事件的场景下, 等于所述一个时间 调整事件对应的时间调整值。 在所述第一节点发送第 i- 1个同步报文的时间与所述第一节点 发送第 i个同步报文的时间之间所述第一节点发生了多个时间调整 事件的场景下, ^等于多个时间调整事件分别对应的多个时间调 整值的累加值。所述多个时间调整事件与所述多个时间调整值—— 对应。
^是由于所述第二节点发生时间调整事件产生的时间调整值。 例如, 在所述第二节点接收第 i- 1 个 Sync报文的时间与所述第二 节点接收第 i个 Sync 同步报文的时间之间所述第二节点只发生了 一个时间调整事件的场景下, '等于所述一个时间调整事件对应 的时间调整值。 在所述第二节点接收第 i- 1个同步报文的时间与所述第二节点 接收第 i个同步报文的时间之间所述第二节点发生了多个时间调整 事件的场景下, ^等于多个时间调整事件分别对应的多个时间调 整值的累加值。所述多个时间调整事件与所述多个时间调整值—— 对应。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 频率偏差为:
n 。- ί , 对应的, 以所述第二节点为执行主体, 针对所述第一节点对所 述第二节点进行频率同步的场景, 收发器用于从第一节点接收第 0 个 Sync同步报文,所述第 0个 Sync报文中携带所述第一节点发送 所述第 0个 Sync 4艮文时所述第一节点的本地时间 。; 收发器还用 于执行该指令还用于接收所述第一节点发送的至少一个 Sync 报 文,所述至少一个 Sync才艮文包含第 i个 Sync才艮文,所述第 i个 Sync 报文包括所述第一节点向所述第二节点发送所述第 i个报文时所述 第一节点的本地时间 7 ^和时间调整值 ^ , ^是所述第一节点发送 第 i- 1 个同步报文的时间与所述第一节点发送第 i个同步报文的时 间之间所述第一节点的时间调整值; 中央处理单元用于根据 、 所 述第一节点发送第 N个 Sync 文时所述第一节点的本地时间 T N、 ^、 所述第二节点接收所述第 0个 Sync报文时所述第二节点的本 地时间 。、 所述第二节点接收第 N个 Sync报文时所述第二节点的 本地时间 w和 获取所述第二节点与所述第一节点的频率偏差, 并根据所述频率偏差校准所述第二节点的本地时钟, 其中, ^是 所述第二节点接收所述第 i- 1个同步报文的时间与所述第二节点接 收所述第 i个同步报文的时间之间所述第二节点的时间调整值, N 为正整数, i是 1至 N中的所有正整数, ^是所述第一节点发送所 述第 0 个 Sync ^艮文的时间与所述第一节点发送所述第 N个 Sync 报文的时间之间所述第一节点的时间调整值, 是所述第二节点接 收所述第 0 个 Sync 报文的时间与所述第二节点接收所述第 N 个 S ync报文的时间之间所述第二节点的时间调整值。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 频率偏差为:
T —T - Av W ∑
其中, Ax = ^i Axi = Axl + Ax2 +… + AxN, Ay = ^ Ay. = Ayl + Ay2 +… + AyN。 针对所述第一节点对所述第二节点在 E2E 时间同步的场景, 以所述第一节点为执行主体,第一节点中的收发器向第二节点发送 第一 Sync同步报文,所述第一 Sync报文中携带所述发射器发送所 述第一 Sync 报文时所述第一节点的本地时间 收发器还用于接 收所述第二节点发送的 Delay— Req延迟请求 4艮文, 中央处理单元用 于获取所述第一节点的时间调整值 ^ , ^是所述第一节点发送所述 第 Sync报文的时间与所述第一节点接收所述 Delay— Req报文的 时间之间所述第一节点的时间调整值;收发器还用于向所述第二节 点发送 Delay— Resp延迟响应报文, 所述 Delay— Resp报文包括所述 第一节点的时间调整值 ^和 以使所述第二节点根据 、 Δ 、 所述第二节点接收所述第一 S y n c报文时所述第二节点的本地时间 所述第二节点发送所述 Delay— Req报文时所述第二节点的本地 时间 ^, 和所述第二节点的时间调整值 获取链路延时 ) , 其中,
Ay是所述第二节点接收所述第一 Sync报文的时间与所述第二节点 发送所述 Delay— Req报文的时间之间所述第二节点的时间调整值。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 链路延时为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2 在本发明实施例中, 可选的, 收发器还用于向所述第二节点发 送第二 Sync报文,所述第二 Sync报文中携带所述第一节点发送所 述第二 Sync报文时所述第一节点的本地时间 T、, 使所述第二节点 根据 i、 所述第二节点接收所述第二 Sync报文时所述第二节点的 本地时间 ^和 D获取所述第二节点与所述第一节点的时间偏差
0ffset ,并且使所述第二节点根据所述时间偏差校准所述第二节点的 本地时间。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 时间偏差为:
Offset = T2' - T[ - D 对应的, 针对所述第一节点对所述第二节点在 E2E 时间同步 的场景下, 以所述第二节点为执行主体, 收发器用于接收第一节点 发送的第一 Sync同步报文,所述第一 Sync报文中携带所述第一节 点发送所述第一 Sync 报文时所述第一节点的本地时间 收发器 还用于向所述第一节点发送 Delay— Req延迟请求 4艮文, 中央处理单 元用于获取所述第二节点的时间调整值 , 是所述第二节点接 收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第二节, ^的时间调整值;所述收发器还用于接 收所述第 一节 点发送的 Delay— Resp 延迟响应 4艮文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 报文时 所述第一节点的本地时间 τ4 , 和所述第一节点的时间调整值 Δ , Ax 是所述第一节点发送所述第一 Sync报文的时间与所述第一节点接 收所述 Delay— Req报文的时间之间所述第一节点的时间调整值; 中 央处理单元用于根据7τ2 , τ τ 和 获取所述第二节点与 所述第一节点的链路延时 D。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 链路延时为:
在本发明实施例中, 可选的, 收发器还用于接收所述第一节点 发送的第二 Sync报文,所述第二 Sync报文中携带所述第一节点发 送所述第二 Sync ^艮文时所述第一节点的本地时间 T、; 处理器 122执行该指令用于根据 ^1、 以及所述第二节点接收 所述第二 Sync报文的本地时间 获取所述第二节点与所述第一节 点的时间 0ffset ,并根据所述时间偏差 ^ ^校准所述第二节点的 本地时钟。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 时间偏差为:
Offset = T2' - T - D 在本发明实施例中, 针对所述第一节点对所述第二节点进行 E2E时间同步的场景, 若所述第一节点在向所述第二节点发送第一 Sync "¾文后,又向所述第二节点发送第三 Sync文,且所述第三 Sync 报文是所述第二节点在向所述第一节点发送 Delay— Req 延迟请求 报文后接收到的, 时间同步的实现方式可以是: 以所述第一节点为 执行主体, 收发器用于向第二节点发送第一 Sync 同步报文, 所述 第一 Sync报文中携带发射器 133发送所述第一 Sync报文时所述第 一节点的本地时间 τ , 收发器还用于向所述第二节点发送第三 Sync 报文,所述第三 Sync报文中携带发射器发送第三 Sync报文时所述 第一节点的本地时间 1和所述第一节点的时间调整值 Δ ' , Δ '是所 述第一节点发送所述第一 Sync报文的时间与所述第一节点发送所 述第三 Sync报文的时间之间所述第一节点的时间调整值; 收发器 还用于接收所述第二节点发送的 Delay— Req延迟请求报文, 中央处 理单元获取所述第一节点的时间调整值 , 是所述第一节点发 送所述第三 Sync报文的时间与所述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点的时间调整值, 其中, 所述第二节点 接收到所述第三 Sync 报文的时间晚于所述第二节点发送所述 Delay— Req 报文的时间 ; 收发器还用 于向所述第二节点发送 Delay— Resp报文, 所述 Delay— Resp报文中携带所述第一节点接收 所述 Delay— Req报文时所述第一节点的本地时间 ^和 Δ , 以使所述 第二节点根据所述 、 τ Τ
Figure imgf000088_0001
所述第二节点接收所述 Sync 报文时所述第二节点的本地时间 以及所述第二节点的时间调整 值 获取所述第二节点与所述第一节点的链路延时 其中, 是 所述第二节点接收所述第一 Sync报文的时间与所述第二节点发送 所述 Delay— Req ^文的时间之间所述第二节点的时间调整值。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 链路延时为:
D (Τ, - Τ, - Αχ' - Αχ'^ - ^ -Τ, - Αγ)
_ 2 所述收发器还用于向所述第二节点发送第二 Sync报文, 所述 第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述 第一节点的本地时间 以使所述第二节点根据所述 i、 所述链路 延时 以及所述第二节点接收所述第二 Sync 报文时所述第二节点 的本地时间 ^获取所述第二节点与所述第一节点的时间偏差 #^。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 时间偏差为:
Offset = T2' - T - D 对应的, 以所述第二节点为执行主体, 针对所述第一节点对所 述第二节点在 E2E 时间同步的场景, 收发器用于接收所述第一节 点发送的第一 Sync同步报文,所述第一 Sync报文中携带所述第一 节点发送所述第一 Sync 报文时所述第一节点的本地时间 收发 器还用于向所述第一节点发送 Delay— Req延迟请求报文, 中央处理 器用于获取所述第二节点的时间调整值 , 是所述第二节点接收 所述第 ― Sync报文的时间与所述第二节点发送所述 Delay— Req报 文的时间之间所述第二节点的时间调整值;收发器还用于接收所述 第一节点发送的第三 Sync报文,所述第三 Sync报文中携带所述第 一节点发送所述第三 Sync报文时的本地时间 和所述第一节点的 时间调整值 是所述第一节点发送所述第一 Sync报文的时间 与所述第一节点发送所述第三 Sync报文的时间之间所述第一节点 的时间调整值, 其中, 所述第三 Sync 报文是所述第一节点在7 ^与 接收到所述 Delay— Req报文时所述第一节点的本地时间 ^之间发送 至所述第二节点的, 且所述第二节点接收到所述第三 Sync报文的 时间晚于所述第二节点发送所述 Delay— Req 4艮文的时间;收发器还 用于接收所述第一节点发送的 Delay— Req 延迟请求报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req报文时 所述第一节点的本地时间 ^和所述第一节点的时间调整值 , Δ 是 所述第一节点发送所述第三 Sync报文的时间与所述第一节点接收 所述 Delay— Req报文的时间之间所述第一节点的时间调整值;处理 器 142执行该指令还用于根据所述 、 Τ2 , Τ Τ
Figure imgf000089_0001
Λ 以及 Ay获 取所述第二节点与所述第一节点的链路延时 D。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 链路延时为:
D (Τ, - Τ, - Αχ' - Αχ'^ - ^ -Τ, - Αγ)
_ 2 在本发明实施例中, 可选的, 收发器还用于接收所述第一节点 发送的第二 Sync报文,所述第二 Sync报文中携带所述第一节点发 送所述第二 Sync 4艮文时所述第一节点的本地时间
Figure imgf000089_0002
中央处理单 元还用于根据 D、 ^以及所述第二节点接收所述第二 Sync 报文时 所述第二节点的本地时间 Γ ' 2获取所述第二节点与所述第一节点的 时间偏差 0ffset,并且根据所述时间偏差校准所述第二节点的本地时 间。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 时间偏差为:
Offset = T2' - T - D 针对所述第一节点对所述第二节点在 P2P时间同步的场景下, 以所述第一节点为执行主体, 收发器用于接收第二节点发送的 Pdelay— Req 延迟请求报文; 收发器还用于向所述第二节点发送 Pdelay— Resp 延迟响应报文, 所述 Pdelay— Resp 延迟响应报文中携 带所述第一节点接收所述 Pdelay— Req报文时所述第一节点的本地 时间 τ2、 所述第一节点发送所述 Pdelay— Resp 4艮文时所述第一节点 的本地时间 ^以及所述第一节点的时间调整值 , 以使所述第二节 点根据 τ2、 τ Δ 、 所述第二节点发送所述 Pdelay— Req 报文时所 述第二节点的本地时间 T 所述第二节点接收所述 Pdelay— Resp报 文时所述第二节点的本地时间 以及所述第二节点的时间调整值 获取所述第二节点与所述第一节点的链路延时 其中, ^是所 述第一节点接收所述 Pdelay— Req 报文的时间与所述第一节点发送 所述 Pdelay— Resp ^文的时间之间所述第一节点的时间调整值, Δ > 是所述第二节点发送所述 Pdelay— Req 报文的时间与所述第二节点 接收所述 Pdelay— Resp ^文的时间之间所述第二节点的时间调整 值。 在本发明实施例中, 可选的,, 所述第二节点与所述第一节点 的链路延时为:
D (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 在本发明实施例中, 可选的, 收发器还用于向所述第二节点发 送 Sync 同步报文, 所述 Sync 报文中携带所述第一节点发送所述 Sync 报文时所述第一节点的本地时间 , 以使所述第二节点根据 T、、 D以及所述第二节点接收所述 Sync 报文时所述第二节点的本 地时间 获取所述第二节点与所述第一节点的时间偏差 并且 使所述第二节点根据所述时间偏差校准所述第二节点的本地时间。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 时间偏差为:
Offset = T2' - T[ - D 对应的, 以所述第二节点为执行主体, 针对所述第一节点对所 述第二节点的 P2P 时间同步的场景, 收发器用于向第一节点发送 Pdelay— Req延迟请求报文;收发器还用于接收所述第一节点发送的 Pdelay— Resp 延迟响应报文, 所述 Pdelay— Resp报文中携带所述第 一节点接收所述 Pdelay— Req 报文时所述第一节点的本地时间 ^、 所述第一节点发送所述 Pdelay— Resp ^艮文时所述第一节点的本地时 间 以及所述第一节点的时间调整值 Α , 是所述第一节点接收所 述 Pdelay— Req 报文的时间与所述第一节点发送所述 Pdelay— Resp 报文的时间之间所述第一节点的时间调整值; 中央处理单元根据 τ2 , τ Δ 、 所述第二节点发送所述 Pdelay— Req报文时所述第二节 点的本地时间 r 所述第二节点接收所述 Pdelay— Resp 文时所述 第二节点的本地时间 ^以及所述第二节点的时间调整值 获取所 述第二节点与所述第一节点的链路延时 ) , 其中, 是所述第二节 点发送所述 Pdelay— Req 报文的时间与所述第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整值。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 链路延时为:
D (T4 -Tl - Ay) - (T3 - T2 - Ax)
_ 2 在本发明实施例中, 可选的, 所述收发器还用于接收所述第一 节点发送的 Sync同步报文,所述 Sync报文中携带所述第一节点发 送所述 Sync 4艮文时所述第一节点的本地时间 ; 所述中央处理单 元还用于根据 、 D以及所述第二节点接收所述 Sync 报文时所述 第二节点的本地时间 获取所述第二节点与所述第一节点的时间 偏差 °ffset, 并根据所述时间偏差校准所述第二节点的本地时间。 在本发明实施例中, 可选的, 所述第二节点与所述第一节点的 时间偏差为:
Offset = T2' - T[ - D 在本申请所提供的几个实施例中, 应该理解到, 所揭露的节点 和方法, 可以通过其它的方式实现。 例如, 以上所描述的节点实施 例仅是示意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划 分, 实际实现时可以有另外的划分方式, 例如多个单元或组件可以 结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。 另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可 以是通过一些接口, 装置或单元的间接耦合或通信连接, 可以是电 性或其它的形式。 另外, 在本发明各个实施例中的节点和系统中, 各功能单元可 以集成在一个处理单元中, 也可以是各个单元单独物理包括, 也可 以两个或两个以上单元集成在一个单元中。且上述的各单元既可以 釆用硬件的形式实现, 也可以釆用硬件加软件功能单元的形式实 现。
实现上述方法实施例的全部或部分步骤可以通过程序指令相 关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质
(英文: computer readable storage medium ) 中 , 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述的存储介质包括: U盘、 移动硬盘、 只读存储器 (英文: read-only memory , 缩写: ROM )、 随机存取存储器 (英文: random-access memory , 缩写: RAM )、 磁碟或者光盘等各种可以存储程序代码的介质。 以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围 并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技 术范围内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围 之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。

Claims

权 利 要 求 书
1、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第一节点向第二节点发送第 0个 Sync 同步报文, 所述第 0个 Sync 报文中携带所述第一节点发送所述第 0个 Sync报文时所述第一节点的本 地时间 Γ1;。;
所述第一节点向所述第二节点发送至少一个 Sync报文, 以使所述第 二节点根据 Γ1;。、 所述第一节点发送第 Ν个 Sync报文时所述第一节点的本 地时间 Γ1Λί、 Ax , 所述第二节点接收所述第 0个 Sync报文时所述第二节点 的本地时间 Γ2,。、 所述第二节点接收所述第 Ν个 Sync报文时所述第二节点 的本地时间 r2;jV和 Ay获取所述第二节点与所述第一节点的频率偏差, 并且 使所述第二节点根据所述频率偏差校准所述第二节点的本地时钟, 其中, 所述至少一个 Sync报文包含第 i个 Sync报文, 所述第 i个 Sync报文中携 带所述第一节点向所述第二节点发送所述第 i个报文时所述第一节点的本 地时间 7;,.和时间调整值 Δ ,. , Δ ,.是所述第一节点发送第 i-1个同步报文的时 间与所述第一节点发送第 i个同步报文的时间之间所述第一节点的时间调 整值, 是所述第二节点接收所述第 i-1个同步报文的时间与所述第二节 点接收所述第 i个同步报文的时间之间所述第二节点的时间调整值, N为 正整数, i是 1至 N中的所有正整数, Δ是所述第一节点发送所述第 0个 Sync 4艮文的时间与所述第一节点发送所述第 N个 Sync 4艮文的时间之间所 述第一节点的时间调整值, 是所述第二节点接收所述第 0个 Sync报文 的时间与所述第二节点接收所述第 N个 Sync报文的时间之间所述第二节 点的时间调整值。
2、 根据权利要求 1 所述的方法, 其特征在于, 所述第二节点与 所述第一节点的频率偏差为:
N
T -T -Av T^-T2, -∑^i
Ά'ΝΆ'。— w i ,
N N
其中, Ax = ^iAxi =Axl +Ax2 +-- + AxN ·> Ay = ^ Ay. = Ayl + Ay2 +… + AyN
3、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第二节点从第一节点接收第 0个 Sync同步报文,所述第 0个 Sync 报文中携带所述第一节点发送所述第 0个 Sync报文时所述第一节点 的本地时间 ,° ;
所述第二节点接收所述第一节点发送的至少一个 Sync报文, 所 述至少一个 Sync才艮文包含第 i个 Sync才艮文,所述第 i个 Sync才艮文中 携带所述第一节点向所述第二节点发送所述第 i个报文时所述第一节 点的本地时间 ^和时间调整值 , ^是所述第一节点发送第 i- 1个同 步报文的时间与所述第一节点发送第 i个同步报文的时间之间所述第 一节点的时间调整值;
所述第二节点根据7。、 所述第一节点发送第 N个 Sync报文时所 述第一节点的本地时间 7^、 、 所述第二节点接收所述第 0个 Sync 报文时所述第二节点的本地时间 。、 所述第二节点接收第 N个 Sync 报文时所述第二节点的本地时间 7 ^和 获取所述第二节点与所述第 一节点的频率偏差, 并根据所述频率偏差校准所述第二节点的本地时 钟, 其中, ^是所述第二节点接收所述第 i- 1个同步报文的时间与所 述第二节点接收所述第 i个同步报文的时间之间所述第二节点的时间 调整值, N为正整数, i是 1至 N中的所有正整数, 是所述第一节 点发送所述第 0个 Sync报文的时间与所述第一节点发送所述第 N个 Sync 报文的时间之间所述第一节点的时间调整值, 是所述第二节 点接收所述第 0个 Sync报文的时间与所述第二节点接收所述第 N个 Sync报文的时间之间所述第二节点的时间调整值。
4、 根据权利要求 3所述的方法, 其特征在于,
所述第二节点与所述第一节点的频率偏差为:
N
T —T - Av W ∑ i
N N
其中, Δ = ^ Δ . = + Δ 2 + - · + ΑχΝ, Ay = ^ Ay. = Ayl + Ay2 +… + AyN
5、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第一节点向第二节点发送第一 Sync 同步报文, 所述第一 Sync 报文中携带所述第一节点发送所述第一 Sync报文时所述第一节点的 本地时间 τι;
所述第一节点接收所述第二节点发送的 Delay— Req 延迟请求报 文, 并获取所述第一节点的时间调整值 Δ , 是所述第一节点发送所 述第一 Sync报文的时间与所述第一节点接收所述 Delay— Req报文的 时间之间所述第一节, 的时间调整值;
所述第一节点向所述第二节点发送 Delay— Resp延迟响应报文, 所述 Delay— Resp 报文包括所述第一节点的时间调整值 和 以使 所述第二节点根据 、 τ Δ 、 所述第二节点接收所述第一 Sync报文 时所述第二节点的本地时间 τ 所述第二节点发送所述 Delay— Req才艮 文时所述第二节点的本地时间 T 和所述第二节点的时间调整值 获 取链路延时 其中, 是所述第二节点接收所述第一 Sync报文的 时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第二 节点的时间调整值。
6、 根据权利要求 5 所述的方法, 其特征在于, 所述第二节点与 所述第一节点的链路延时为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2
7、 根据权利要求 6所述的方法, 其特征在于, 所述方法还包括: 所述第一节点向所述第二节点发送第二 Sync 报文, 所述第二
Sync报文中携带所述第一节点发送所述第二 Sync报文时所述第一节 点的本地时间 ^, 使所述第二节点根据 ^1、 所述第二节点接收所述第 二 Sync报文时所述第二节点的本地时间 ^'2和 D获取所述第二节点与 所述第一节点的时间 0ffset ,并且使所述第二节点根据所述时间偏 差校准所述第二节点的本地时钟。
8、 根据权利要求 7 所述的方法, 其特征在于, 所述第二节点与 所述第一节点的时间偏差为: Offset = T - T D
9、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第二节点接收第一节点发送的第一 Sync 同步报文, 所述 Sync 报文中携带所述第一节点发送所述第一 Sync报文时所述第一节点的 本地时间 τι;
所述第二节点向所述第一节点发送 Delay— Req延迟请求报文,并 获取所述第二节点的时间调整值 , 是所述第二节点接收所述第 一 Sync报文的时间与所述第二节点发送所述 Delay— Req报文的时间 之间所述第二节点的时间调整值;
所述第二节点接收所述第一节点发送的 Delay— Resp延迟响应报 文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 报文时所述第一节点的本地时间 , 和所述第一节点的时间调整值 Δ , Δ是所述第一节点发送所述第一 Sync报文的时间与所述第一节 点接收所述 Delay— Req报文的时间之间所述第一节点的时间调整值; 所述第二节点根据 、 τ τ 、 和 获取所述第二节点与 所述第一节点的链路延时 D。
10、 根据权利要求 9所述的方法, 其特征在于, 所述第二节点与 所述第一节点的链路延时为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2
1 1、 根据权利要求 10所述的方法, 其特征在于, 所述方法还包 括:
所述第二节点接收所述第一节点发送的第二 Sync报文, 所述第 二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述第一 节点的本地时间
所述第二节点根据 ή、 )以及所述第二节点接收所述第二 Sync 报文的本地时间 ^'2获取所述第二节点与所述第一节点的时间偏差 °ffset , 并根据所述时间偏差 0ffset 准所述第二节点的本地时钟。
12、 根据权利要求 1 1 所述的方法, 其特征在于, 所述第二节点 与所述第一节点的时间偏差为:
Offset = T2' - T[ - D
13、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第一节点向第二节点发送第一 Sync 同步报文, 所述第一 Sync 报文中携带所述第一节点发送所述第一 Sync报文时所述第一节点的 本地时间 τι;
所述第一节点向所述第二节点发送第三 Sync 报文, 所述第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时所述第一节 点的本地时间 和所述第一节点的时间调整值 Δ '是所述第一节 点发送所述第一 Sync报文的时间与所述第一节点发送所述第三 Sync 报文的时间之间所述第一节点的时间调整值;
所述第一节点接收所述第二节点发送的 Delay— Req 延迟请求报 文, 并获取所述第一节点的时间调整值 ^是所述第一节点发送 所述第三 Sync报文的时间与所述第一节点接收所述 Delay— Req报文 的时间之间所述第一节点的时间调整值, 其中, 所述第二节点接收到 所述第三 Sync报文的时间晚于所述第二节点发送所述 Delay— Req报 文的时间;
所述第一节点向所述第二节点发送 Delay— Resp 报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 报文时所 述第一节点的本地时间 Γ4和 Δ , 以使所述第二节点根据 、 τ τ
Figure imgf000097_0001
所述第二节点接收所述 Sync报文时所述第二节点的本地时间 以及所述第二节点的时间调整值 获取所述第二节点与所述第一节 点的链路延时 其中, 是所述第二节点接收所述第一 Sync 报文 的时间与所述第二节点发送所述 Delay— Req 报文的时间之间所述第 二节点的时间调整值。
14、 根据权利要求 13 所述的方法, 其特征在于, 所述第二节点 与所述第一节点的链路延时为:
D (r4 _7 _ A _ A ")_(r3 _r2 _4y)
_ 2
15、 根据权利要求 14所述的方法, 其特征在于, 所述方法还包 括:
所述第一节点向所述第二节点发送第二 Sync 报文, 所述第二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述第一节 点的本地时间 以使所述第二节点根据所述 i、 所述链路延时 D以 及所述第二节点接收所述第二 Sync报文时所述第二节点的本地时间 ^'2获取所述第二节点与所述第一节点的时间 ¾ 0ffset
16、 根据权利要求 15 所述的方法, 其特征在于, 所述第二节点 与所述第一节点的时间偏差为:
Offset = T2' - T - D
17、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第二节点接收所述第一节点发送的第一 Sync 同步报文, 所述第
― Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第一 节点的本地时间 T ,
所述第二节点向所述第一节点发送 Delay— Req延迟请求报文,并 获取所述第二节点的时间调整值 , 是所述第二节点接收所述第一 Sync报文的时间与所述第二节点发送所述 Delay— Req报文的时间之 间所述第二节点的时间调整值;
所述第二节点接收所述第一节点发送的第三 Sync报文, 所述第 三 Sync报文中携带所述第一节点发送所述第三 Sync报文时的本地时 间 和所述第一节点的时间调整值 Δ ' , Λ '是所述第一节点发送所述 第 ― Sync报文的时间与所述第一节点发送所述第三 Sync报文的时间 之间所述第一节点的时间调整值, 其中, 所述第三 Sync报文是所述 第一节点在 与接收到所述 Delay— Req报文时所述第一节点的本地时 间 ^之间发送至所述第二节点的, 且所述第二节点接收到所述第三 Sync报文的时间晚于所述第二节点发送所述 Delay— Req报文的时间; 所述第二节点接收所述第一节点发送的 Delay— Resp延迟响应报 文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 报文时所述第一节点的本地时间 ^和所述第一节点的时间调整值 , ^是所述第一节点发送所述第三 Sync报文的时间与所述第一节点接 收所述 Delay— Req报文的时间之间所述第一节点的时间调整值;
所述第二节点根据 、 Ti、 T r
Figure imgf000099_0001
Λ 以及 Ay获取所述第二 节点与所述第一节点的链路延时 D。
18、 根据权利要求 17所述的方法, 其特征在于, 所述第二节点 与所述第一节点的链路延时为:
D (r4 _7 _A _A ")_(r3 _r2 _4y)
_ 2
19、 根据权利要求 18所述的方法, 其特征在于, 所述方法还包 括:
所述第二节点接收所述第一节点发送的第二 Sync报文, 所述第 二 Sync报文中携带所述第一节点发送所述第二 Sync报文时所述第一 节点的本地时间 T、;
所述第二节点根据 )、 ^以及所述第二节点接收所述 Sync '报文 时所述第二节点的本地时间 ^'2获取所述第二节点与所述第一节点的 时间偏差 0ffset , 并且根据所述时间偏差校准所述第二节点的本地时 钟。
20、 根据权利要求 19所述的方法, 其特征在于, 所述第二节点 与所述第一节点的时间偏差为:
Offset = T2' - T[ - D
21、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第一节点接收第二节点发送的 Pdelay— Req延迟请求报文; 所述的第一节点向所述第二节点发送 Pdelay— Resp 延迟响应报 文, 所述 Pdelay— Resp 延迟响应报文中携带所述第一节点接收所述 Pdelay— Req 4艮文时所述第一节点的本地时间 τ 所述第一节点发送所 述 Pdelay— Resp 文时所述第一节点的本地时间 7 ^以及所述第一节点 的时间调整值 , 以使所述第二节点根据^、 T 、 所述第二节点 发送所述 Pdelay— Req ^艮文时所述第二节点的本地时间 τι、 所述第二 节点接收所述 Pdelay— Resp报文时所述第二节点的本地时间 ^以及所 述第二节点的时间调整值 获取所述第二节点与所述第一节点的链 路延时 其中, 是所述第一节点接收所述 Pdelay— Req 报文的时 间与所述第一节点发送所述 Pdelay— Resp报文的时间之间所述第一节 点的时间调整值, Δ >是所述第二节点发送所述 Pdelay— Req 报文的时 间与所述第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节 点的时间调整值。
22、 根据权利要求 21 所述的方法, 其特征在于, 所述第二节点 与所述第一节点的链路延时为:
D (T4 - Tl - Ay) - (T3 -T2 - Ax)
_ 2
23、 根据权利要求 22所述的方法, 其特征在于, 所述方法还包 括:
所述第一节点向所述第二节点发送 Sync 同步报文, 所述 Sync 报文中携带所述第一节点发送所述 Sync报文时所述第一节点的本地 时间 以使所述第二节点根据 D以及所述第二节点接收所述 Sync 报文时所述第二节点的本地时间 ^ ' 2获取所述第二节点与所述第 一节点的时间偏差 并且使所述第二节点根据所述时间偏差校准 所述第二节点的本地时钟。
24、 根据权利要求 23 所述的方法, 其特征在于, 所述第二节点 与所述第一节点的时间偏差为:
Offset = T2' - T[ - D
25、 一种精确时钟协议同步方法, 其特征在于, 所述方法包括: 第二节点向第一节点发送 Pdelay— Req延迟请求 4艮文;
所述第二节点接收所述第一节点发送的 Pdelay— Resp延迟响应报 文, 所述 Pdelay— Resp报文中携带所述第一节点接收所述 Pdelay— Req 报文时所述第一节点的本地时间 ^、 所述第一节点发送所述 Pdelay— Resp 文时所述第一节点的本地时间 7 ^以及所述第一节点的 时间调整值 ^ , 是所述第一节点接收所述 Pdelay— Req报文的时间 与所述第一节点发送所述 Pdelay— Resp报文的时间之间所述第一节点 的时间调整值;
所述第二节点根据 ^、 τ 、所述第二节点发送所述 Pdelay— Req 报文时所述第二节点的本地时间 、 所述第二节点接收所述 Pdelay— Resp 文时所述第二节点的本地时间 ^以及所述第二节点的 时间调整值 获取所述第二节点与所述第一节点的链路延时 其 中, 是所述第二节点发送所述 Pdelay— Req 报文的时间与所述第二 节点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整 值。
26、 根据权利要求 25 所述的方法, 其特征在于, 所述第二节点 与所述第一节点的链路延时为:
D (T4 - Tl - Ay) - (T3 -T2 - Ax)
_ 2
27、 根据权利要求 26所述的方法, 其特征在于, 所述方法还包 括:
所述第二节点接收所述第一节点发送的 Sync 同步报文, 所述 Sync报文中携带所述第一节点发送所述 Sync报文时所述第一节点的 本地时间 τ、;
所述第二节点根据 、 )以及所述第二节点接收所述 Sync 报文 时所述第二节点的本地时间 获取所述第二节点与所述第一节点的 时间 ¾ 0ffset , 并根据所述时间偏差校准所述第二节点的本地时钟。
28、 根据权利要求 27所述的方法, 其特征在于, 所述第二节点 与所述第一节点的时间偏差为:
Offset = T2' - T - D
29、 一种第一节点, 其特征在于, 包括:
发送单元, 用于向第二节点发送第 0个 Sync 同步报文, 所述第 0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所述 第一节点的本地时间 。;
所述发送单元还用于向所述第二节点发送至少一个 Sync报文, 以使所述第二节点根据所述 、 所述第一节点发送第 N个 Sync报文 时所述第一节点的本地时间 ^、 、 所述第二节点接收所述第 0 个 Sync 报文时所述第二节点的本地时间 。、 所述第二节点接收所述第 N个 Sync报文时所述第二节点的本地时间 和 Ay获取所述第二节点 与所述第一节点的频率偏差, 并且使所述第二节点根据所述频率偏差 校准所述第二节点的本地时钟, 其中, 所述至少一个 Sync报文包含 第 i个 Sync报文, 所述第 i个 Sync报文中携带所述第一节点向所述 第二节点发送所述第 i个报文时所述第一节点的本地时间 Tl,'和时间调 整值 Δ^· , ^是所述第一节点发送第 1个同步报文的时间与所述第一 节点发送第 i个同步报文的时间之间所述第一节点的时间调整值, Δ^ 是所述第二节点接收所述第 i- 1个同步报文的时间与所述第二节点接 收所述第 i个同步报文的时间之间所述第二节点的时间调整值, N为 正整数, i是 1至 N中的所有正整数, ^是所述第一节点发送所述第 0个 Sync ^艮文的时间与所述第一节点发送所述第 N个 Sync 文的时 间之间所述第一节点的时间调整值, 是所述第二节点接收所述第 0 个 Sync报文的时间与所述第二节点接收所述第 N个 Sync报文的时 间之间所述第二节点的时间调整值。
30、 根据权利要求 29所述的第一节点, 其特征在于, 所述第二 节点与所述第一节点的频率偏差为:
N
T —T - Δν Τ Τ2,ο ~∑^
R 1 2 N 2,0
N N
其中, Ax = ^i Axi = Axl + Ax2 + - - + AxN ·> Ay = ^ Ay. = Ayl + Ay2 +… + AyN
3 1、 一种第二节点, 其特征在于, 包括:
接收单元, 用于从第一节点接收第 0个 Sync 同步报文, 所述第 0个 Sync报文中携带所述第一节点发送所述第 0个 Sync报文时所述 第一节点的本地时间 。;
所述接收单元还用于接收所述第一节点发送的至少一个 Sync报 文, 所述至少一个 Sync报文包含第 i个 Sync报文, 所述第 i个 Sync 报文中携带所述第一节点向所述第二节点发送所述第 i个报文时所述 第一节点的本地时间 T"和时间调整值 ^ , ^是所述第一节点发送第 i- 1 个同步报文的时间与所述第一节点发送第 i 个同步报文的时间之 间所述第一节点的时间调整值;
处理单元, 用于根据 。、 所述第一节点发送第 N个 Sync报文时 所述第一节点的本地时间 T 、 、所述第二节点接收所述第 0个 Sync 报文时所述第二节点的本地时间 。、 所述第二节点接收第 N个 Sync 报文时所述第二节点的本地时间 7 ^和 获取所述第二节点与所述第 一节点的频率偏差, 并根据所述频率偏差校准所述第二节点的本地时 钟, 其中, ^是所述第二节点接收所述第 i- 1个同步报文的时间与所 述第二节点接收所述第 i个同步报文的时间之间所述第二节点的时间 调整值, N为正整数, i是 1至 N中的所有正整数, 是所述第一节 点发送所述第 0个 Sync报文的时间与所述第一节点发送所述第 N个 Sync 报文的时间之间所述第一节点的时间调整值, 是所述第二节 点接收所述第 0个 Sync报文的时间与所述第二节点接收所述第 N个 Sync报文的时间之间所述第二节点的时间调整值。
32、 根据权利要求 3 1 所述的第二节点, 其特征在于, 所述第二 节点与所述第一节点的频率偏差为:
N
T - T - Δν Τ Τ2,ο ~∑^
R 1 2 N 2,0
N N
其中, = Δχ^· = Δχ^ + Δ¾ +… + ΑχΝ, Ay = ^ Ay. = Ayl + Ay2 +… + AyN
33、 一种第一节点, 其特征在于, 包括:
发送单元, 用于向第二节点发送第一 Sync 同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第一节 点的本地时间 Τι ;
接收单元,用于接收所述第二节点发送的 Delay— Req延迟请求报 文; 获取单元, 用于获取所述第一节点的时间调整值 Δ , Δ是所述第 一节点发送所述第一 Sync 报文的时间与所述第一节点接收所述 Delay— Req ^文的时间之间所述第一节点的时间调整值;
所述发送单元还用于向所述第二节点发送 Delay— Resp延迟响应 报文, 所述 Delay— Resp报文包括所述第一节点的时间调整值 和 ^ , 以使所述第二节点根据 、 Γ Δ 、 所述第二节点接收所述第一 Sync 报文时所述第二节点的本地时间 ^、 所述第二节点发送所述 Delay— Req ^艮文时所述第二节点的本地时间 T 和所述第二节点的时 间调整值 获取链路延时 其中, 是所述第二节点接收所述第 一 Sync报文的时间与所述第二节点发送所述 Delay— Req报文的时间 之间所述第二节点的时间调整值。
34、 根据权利要求 33 所述的第一节点, 其特征在于, 所述第二 节点与所述第一节点的链路延时为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2
35、 根据权利要求 34所述的第一节点, 其特征在于, 所述发送 单元还用于:
向所述第二节点发送第二 Sync报文,所述第二 Sync报文中携带 所述第一节点发送所述第二 Sync ^艮文时所述第一节点的本地时间 Τ'ι , 使所述第二节点根据 、 所述第二节点接收所述第二 Sync报文 时所述第二节点的本地时间 ^'2和 D获取所述第二节点与所述第一节 点的时间 0ffset ,并且使所述第二节点根据所述时间偏差校准所述 第二节点的本地时钟。
36、 根据权利要求 35 所述的第一节点, 其特征在于, 所述第二 节点与所述第一节点的时间偏差为:
Offset = T2' - T[ - D
37、 一种第二节点, 其特征在于, 包括:
接收单元, 用于接收第一节点发送的第一 Sync 同步报文, 所述 第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第 一节点的本地时间 Γ ,
发送单元, 用于向所述第一节点发送 Delay— Req延迟请求报文; 获取单元, 用于获取所述第二节点的时间调整值 , 是所述 第二节点接收所述第一 Sync 报文的时间与所述第二节点发送所述 Delay— Req ^文的时间之间所述第二节点的时间调整值;
所述接收单元还用于接收所述第一节点发送的 Delay— Resp延迟 响应报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 文时所述第一节点的本地时间 T 和所述第一节点的时 间调整值 , ^是所述第一节点发送所述第一 Sync报文的时间与所 述第一节点接收所述 Delay— Req 报文的时间之间所述第一节点的时 间调整值;
处理单元, 用于根据 、 τ Τ 4、 和 获取所述第二节点 与所述第一节点的链路延时 D。
38、 根据权利要求 36所述的第二节点, 其特征在于, 所述第二 节点与所述第一节点的链路延时为:
D (T4 - Tl - Ax) - (T3 - T2 - Ay)
_ 2
39、 根据权利要求 38所述的第二节点, 其特征在于, 所述接收 单元,还用于接收所述第一节点发送的第二 Sync报文,所述第二 Sync 报文中携带所述第一节点发送所述第二 Sync报文时所述第一节点的 本地时间
所述处理单元, 还用于根据 ^1、 D以及所述第二节点接收所述第 二 Sync报文的本地时间 ^'2获取所述第二节点与所述第一节点的时间 偏差 0ffset , 并根据所述时间偏差 0ffset校准所述第二节点的本地时钟。
40、 根据权利要求 39所述的第二节点, 其特征在于, 所述第二 节点与所述第一节点的时间偏差为:
Offset = T2 - T - D
41、 一种第一节点, 其特征在于, 包括:
发送单元, 用于向第二节点发送第一 Sync 同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所述第一节 点的本地时间 τ ,
所述发送单元, 还用于向所述第二节点发送第三 Sync报文, 所 述第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时所述 第一节点的本地时间 和所述第一节点的时间调整值 Δ ' , Λ '是所述 第一节点发送所述第一 Sync报文的时间与所述第一节点发送所述第 三 Sync报文的时间之间所述第一节点的时间调整值;
接收单元,用于接收所述第二节点发送的 Delay— Req延迟请求报 文;
获取单元, 用于获取所述第一节点的时间调整值 Δ , Λ 是所述 第一节点发送所述第三 Sync 报文的时间与所述第一节点接收所述 Delay— Req ^文的时间之间所述第一节点的时间调整值, 其中, 所述 第二节点接收到所述第三 S y n c报文的时间晚于所述第二节点发送所 述 Delay— Req报文的时间;
所述发送单元, 还用于向所述第二节点发送 Delay— Resp 4艮文, 所述 Delay— Resp报文中携带所述第一节点接收所述 Delay— Req报文 时所述第一节点的本地时间 和 Δ , 以使所述第二节点根据所述7 i、 Τ τ Δ '、
Figure imgf000106_0001
所述第二节点接收所述 Sync 报文时所述第二节点 的本地时间 ^以及所述第二节点的时间调整值 获取所述第二节点 与所述第一节点的链路延时 其中, 是所述第二节点接收所述第 一 Sync报文的时间与所述第二节点发送所述 Delay— Req报文的时间 之间所述第二节点的时间调整值。
42、 根据权利要求 41 所述的第一节点, 其特征在于, 所述第二 节点与所述第一节点的链路延时为:
D (r4 _7 _ A _ A ")_(r3 _r2 _4y)
_ 2
43、 根据权利要求 42所述的第一节点, 其特征在于, 所述发送 单元还用于:
向所述第二节点发送第二 Sync报文,所述第二 Sync报文中携带 所述第一节点发送所述第二 Sync ^艮文时所述第一节点的本地时间 T、, 以使所述第二节点根据所述 、 所述链路延时 D以及所述第二节 点接收所述 Sync '报文时所述第二节点的本地时间 ^'2获取所述第二节 点与所述第一节点的时间 ^ 0ffset
44、 根据权利要求 43 所述的第一节点, 其特征在于, 所述第二 节点与所述第一节点的时间偏差为:
Offset = T2' - T - D
45、 一种第二节点, 其特征在于, 包括:
接收单元, 用于接收所述第一节点发送的第一 Sync 同步报文, 所述第一 Sync报文中携带所述第一节点发送所述第一 Sync报文时所 述第一节点的本地时间?;
发送单元, 用于向所述第一节点发送 Delay— Req延迟请求报文; 获取单元, 用于获取所述第二节点的时间调整值 , 是所述第 二节点接收所述第一 Sync 报文的时间与所述第二节点发送所述 Delay— Req ^文的时间之间所述第二节点的时间调整值;
所述接收单元,还用于接收所述第一节点发送的第三 Sync报文, 所述第三 Sync报文中携带所述第一节点发送所述第三 Sync报文时的 本地时间 和所述第一节点的时间调整值 Δ '是所述第一节点发 送所述第 ― Sync报文的时间与所述第一节点发送所述第三 Sync报文 的时间之间所述第一节点的时间调整值, 其中, 所述第三 Sync报文 是所述第一节点在 与接收到所述 D elay— Re q报文时所述第一节点的 本地时间 ^之间发送至所述第二节点的, 且所述第二节点接收到所述 第三 Sync报文的时间晚于所述第二节点发送所述 Delay— Req报文的 时间;
所述接收单元,还用于接收所述第一节点发送的 Delay— Req延迟 请求报文, 所述 Delay— Resp 报文中携带所述第一节点接收所述 Delay— Req 4艮文时所述第一节点的本地时间 ^和所述第一节点的时间 调整值 Δ , Λ 是所述第一节点发送所述第三 Sync报文的时间与所述 第一节点接收所述 Delay— Req 报文的时间之间所述第一节点的时间 调整值;
处理单元, 用于根据所述 Τι、 Τ Τ Τ Δ '、 Λ 以及 Ay获取所 述第二节点与所述第一节点的链路延时 )。
46、 根据权利要求 45 所述的第二节点, 其特征在于, 所述第二 节点与所述第一节点的链路延时为:
D _ (T4 - Τ - Αχ' - Αχ") - (Τ32 -Ay)
_ 2
47、 根据权利要求 46所述的第二节点, 其特征在于, 所述接收 单元,还用于接收所述第一节点发送的第二 Sync报文,所述第二 Sync 报文中携带所述第一节点发送所述第二 Sync报文时所述第一节点的 本地时间
所述处理单元, 还用于根据 D、 : Γ 以及所述第二节点接收所述 Sync '报文时所述第二节点的本地时间 ^ '2获取所述第二节点与所述第 一节点的时间 ¼ 0ffset,并且根据所述时间偏差校准所述第二节点的 本地时钟。
48、 根据权利要求 47所述的第二节点, 其特征在于, 所述第二 节点与所述第一节点的时间偏差为:
Offset = T2' - T[ - D
49、 一种第一节点, 其特征在于, 包括:
接收单元, 用于接收第二节点发送的 Pdelay— Req延迟请求报文; 发送单元,用于向所述第二节点发送 Pdelay— Resp延迟响应 4艮文, 所述 Pdelay— Resp 延迟响应报文中携带所述第一节点接收所述 Pdelay— Req 4艮文时所述第一节点的本地时间 τ 所述第一节点发送所 述 Pdelay— Resp 文时所述第一节点的本地时间 以及所述第一节点 的时间调整值 ^, 以使所述第二节点根据^、 Τ Δ 、 所述第二节点 发送所述 Pdelay— Req ^艮文时所述第二节点的本地时间 τι、 所述第二 节点接收所述 Pdelay— Resp报文时所述第二节点的本地时间 ^以及所 述第二节点的时间调整值 获取所述第二节点与所述第一节点的链 路延时 其中, 是所述第一节点接收所述 Pdelay— Req 报文的时 间与所述第一节点发送所述 Pdelay— Resp报文的时间之间所述第一节 点的时间调整值, 是所述第二节点发送所述 Pdelay— Req 报文的时 间与所述第二节点接收所述 Pdelay— Resp报文的时间之间所述第二节 点的时间调整值。
50、 根据权利要求 49所述的第一节点, 其特征在于, 所述第二 节点与所述第一节点的链路延时为:
D (T4 - Tl - Ay) - (T3 -T2 - Ax)
_ 2
51、 根据权利要求 50所述的第一节点, 其特征在于, 所述发送 单元, 还用于向所述第二节点发送 Sync同步报文, 所述 Sync报文中 携带所述第一节点发送所述 Sync 报文时所述第一节点的本地时间 T、, 以使所述第二节点根据 i、 D以及所述第二节点接收所述 Sync 报文时所述第二节点的本地时间 获取所述第二节点与所述第一节 点的时间偏差 0ffset并且使所述第二节点根据所述时间偏差校准所述 第二节点的本地时钟。
52、 根据权利要求 5 1 所述的第一节点, 其特征在于, 所述第二 节点与所述第一节点的时间偏差为:
Offset = T2' - T[ - D
53、 一种第二节点, 其特征在于, 包括:
发送单元, 用于向第一节点发送 Pdelay— Req延迟请求 4艮文; 接收单元, 用于接收所述第一节点发送的 Pdelay— Resp延迟响应 报文, 所述 Pdelay— Resp 报文中携带所述第一节点接收所述 Pdelay— Req 4艮文时所述第一节点的本地时间 τ 所述第一节点发送所 述 Pdelay— Resp 文时所述第一节点的本地时间 以及所述第一节点 的时间调整值 Δ , Δ是所述第一节点接收所述 Pdelay— Req报文的时 间与所述第一节点发送所述 Pdelay— Resp报文的时间之间所述第一节 点的时间调整值;
处理单元,用于根据 τ2、 ^、 Δ 、所述第二节点发送所述 Pdelay— Req 报文时所述第二节点的本地时间 、 所述第二节点接收所述 Pdelay— Resp 文时所述第二节点的本地时间 ^以及所述第二节点的 时间调整值 获取所述第二节点与所述第一节点的链路延时 其 中, 是所述第二节点发送所述 Pdelay— Req 报文的时间与所述第二 节点接收所述 Pdelay— Resp报文的时间之间所述第二节点的时间调整 值。
54、 根据权利要求 53 所述的第二节点, 其特征在于, 所述第二 节点与所述第一节点的链路延时为:
D (T4-Tl-Ay)-(T3-T2-Ax)
_ 2
55、 根据权利要求 54所述的第二节点, 其特征在于, 所述接收 单元, 还用于接收所述第一节点发送的 Sync同步报文, 所述 Sync报 文中携带所述第一节点发送所述 Sync报文时所述第一节点的本地时 间 τ、;
所述处理单元, 还用于根据 ^1、 D以及所述第二节点接收所述 Sync 报文时所述第二节点的本地时间 ^ ' 2获取所述第二节点与所述第 一节点的时间偏差 0 ,并根据所述时间偏差校准所述第二节点的本 地时钟。
56、 根据权利要求 55 所述的第二节点, 其特征在于, 所述第二 节点与所述第一节点的时间偏差为:
Offset = f2-T[-D
PCT/CN2013/090159 2013-12-20 2013-12-20 精确时钟协议同步方法和节点 WO2015089848A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201380002819.5A CN105027489B (zh) 2013-12-20 2013-12-20 精确时钟协议同步方法和节点
PCT/CN2013/090159 WO2015089848A1 (zh) 2013-12-20 2013-12-20 精确时钟协议同步方法和节点

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/090159 WO2015089848A1 (zh) 2013-12-20 2013-12-20 精确时钟协议同步方法和节点

Publications (1)

Publication Number Publication Date
WO2015089848A1 true WO2015089848A1 (zh) 2015-06-25

Family

ID=53402013

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/090159 WO2015089848A1 (zh) 2013-12-20 2013-12-20 精确时钟协议同步方法和节点

Country Status (2)

Country Link
CN (1) CN105027489B (zh)
WO (1) WO2015089848A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107852522A (zh) * 2015-08-07 2018-03-27 索尼公司 接收设备和数据处理方法
CN111654350A (zh) * 2020-07-07 2020-09-11 范雯 一种检测通信传送网络网元设备频率偏差的方法
CN115801175A (zh) * 2023-01-30 2023-03-14 国仪量子(合肥)技术有限公司 时间频率同步方法、系统、存储介质及电子设备

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110100408B (zh) * 2016-12-30 2021-05-18 华为技术有限公司 交互时间同步报文的方法以及网络装置
CN112600641A (zh) * 2020-12-31 2021-04-02 深圳市英特瑞半导体科技有限公司 一种网络设备时间同步方法、装置、设备及存储介质
CN115334008B (zh) * 2022-10-18 2023-03-21 中国电子科技集团公司第三十研究所 Ptn网1588报文抖动处理方法、系统、设备及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101505214A (zh) * 2009-03-10 2009-08-12 华为技术有限公司 时间同步的方法、装置和系统
CN102098155A (zh) * 2011-03-18 2011-06-15 北京国智恒电力管理科技有限公司 基于ptp协议实现亚微秒级同步精度的方法
CN103138887A (zh) * 2011-12-05 2013-06-05 中兴通讯股份有限公司 一种1588事件报文的处理方法及系统
US20130170507A1 (en) * 2011-12-13 2013-07-04 Canning Hsueh Time synchronization for network testing equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101330374B (zh) * 2007-06-18 2012-11-14 大唐移动通信设备有限公司 传输网中的时钟同步方法、系统和从时钟侧实体
CN102195766B (zh) * 2010-03-01 2013-12-25 杭州华三通信技术有限公司 一种时间同步的方法和时钟设备
CN102195735B (zh) * 2010-03-11 2014-04-09 杭州华三通信技术有限公司 多子系统设备的时间同步方法及子系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101505214A (zh) * 2009-03-10 2009-08-12 华为技术有限公司 时间同步的方法、装置和系统
CN102098155A (zh) * 2011-03-18 2011-06-15 北京国智恒电力管理科技有限公司 基于ptp协议实现亚微秒级同步精度的方法
CN103138887A (zh) * 2011-12-05 2013-06-05 中兴通讯股份有限公司 一种1588事件报文的处理方法及系统
US20130170507A1 (en) * 2011-12-13 2013-07-04 Canning Hsueh Time synchronization for network testing equipment

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107852522A (zh) * 2015-08-07 2018-03-27 索尼公司 接收设备和数据处理方法
EP3334169A4 (en) * 2015-08-07 2018-12-26 Sony Corporation Receiving device and data processing method
US10785525B2 (en) 2015-08-07 2020-09-22 Saturn Licensing Llc Reception apparatus and data processing method
CN111654350A (zh) * 2020-07-07 2020-09-11 范雯 一种检测通信传送网络网元设备频率偏差的方法
CN115801175A (zh) * 2023-01-30 2023-03-14 国仪量子(合肥)技术有限公司 时间频率同步方法、系统、存储介质及电子设备

Also Published As

Publication number Publication date
CN105027489B (zh) 2018-08-21
CN105027489A (zh) 2015-11-04

Similar Documents

Publication Publication Date Title
WO2015089848A1 (zh) 精确时钟协议同步方法和节点
CN110651446B (zh) 无线装置和无线装置处理方法
WO2011120262A1 (zh) 时间同步的处理方法及装置
CN102013931B (zh) 时间同步方法及系统、从属定时设备及主定时设备
JP4853625B2 (ja) 伝搬遅延時間測定方法、同期方法、及び無線lanシステム
WO2009003335A1 (fr) Procédé de synchronisation et de correction de retard entre une unité bande de base et une unité radiofréquence
WO2011076051A1 (zh) 时间同步的方法、设备及系统
WO2012065334A1 (zh) 在时分复用网络中实现时间同步的方法、设备和系统
WO2012003746A1 (zh) 一种实现边界时钟的方法和装置
EP3180876B1 (en) Method and apparatus for synchronising a plurality of distributed devices with a network
WO2015196685A1 (zh) 时钟同步方法及装置
WO2012055360A1 (zh) 时间同步方法和相关设备及系统
WO2013092360A1 (en) Methods and apparatus for communication synchronization
WO2013020499A1 (zh) 自动补偿1588链路非对称性时延的实现方法及系统
WO2010115357A1 (zh) 一种基于ip网络的无线基站时钟校正方法及系统
WO2011160595A1 (zh) 基于ptp及链路质量选取主时钟节点的方法、从时钟节点及系统
JP6384697B2 (ja) 同期方法、同期装置、および基地局
US20220007321A1 (en) Network Entities and Methods for a Wireless Network System for Determining Time Information
WO2018120173A1 (zh) 交互时间同步报文的方法以及网络装置
CN109891960B (zh) 无线设备、无线设备处理方法和存储器
WO2017063322A1 (zh) 时间同步方法、主时间同步装置、通信系统及存储介质
JP2007529163A (ja) ネットワーク・ノード
WO2023124311A1 (zh) 超宽带基站的无线同步方法及装置
JP6254028B2 (ja) スレーブノード及び時刻同期方法
WO2013155944A1 (zh) 一种时钟传输方法、边界时钟及透传时钟

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201380002819.5

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13899555

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13899555

Country of ref document: EP

Kind code of ref document: A1