CN115276869A - Clock synchronization method and device, electronic equipment and storage medium - Google Patents

Clock synchronization method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115276869A
CN115276869A CN202210877974.2A CN202210877974A CN115276869A CN 115276869 A CN115276869 A CN 115276869A CN 202210877974 A CN202210877974 A CN 202210877974A CN 115276869 A CN115276869 A CN 115276869A
Authority
CN
China
Prior art keywords
time
compensation
clock
message
compensation time
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210877974.2A
Other languages
Chinese (zh)
Inventor
林力帆
李鹏
欧亮
卢兰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp Ltd
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 China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202210877974.2A priority Critical patent/CN115276869A/en
Publication of CN115276869A publication Critical patent/CN115276869A/en
Pending legal-status Critical Current

Links

Images

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
    • 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

Landscapes

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

Abstract

The present disclosure provides a clock synchronization method, a clock synchronization device, an electronic device, and a storage medium, wherein the clock synchronization method includes: the method comprises the steps of obtaining a compensation time set by obtaining a plurality of compensation times of a time message, wherein the compensation time is a difference value between a first time and a second time, the first time is a time when the time message sent by a master clock is received, the second time is a time when the time message is forwarded to a slave clock, and the slave clock starts to process the time message.

Description

Clock synchronization method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a clock synchronization method and apparatus, an electronic device, and a storage medium.
Background
Under the condition of clock synchronization, the data transmission of the information transmission system needs to keep the data transmission rate consistent upstream and downstream, so that data loss is avoided. In the clock synchronization system, a master clock sends a time message to a slave clock, and the slave clock adjusts a local clock according to the time message so as to synchronize clocks of the master clock and the slave clock.
The existing clock synchronization device needs to provide a time difference value for a time message, correct the receiving time of the actual receiving time message from the clock and improve the clock synchronization precision. However, in the case that the actual manufacturing process cannot guarantee complete accuracy, the time difference measured by the clock synchronization device has a difference in measurement accuracy between devices of the same type, so that the time difference deviates from an actual value, and the clock synchronization is inaccurate.
Therefore, how to improve the precision of master-slave clock synchronization becomes a technical problem which needs to be solved urgently.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure provides a clock synchronization method, apparatus, electronic device and storage medium, which at least to some extent overcome the problem of low precision of master-slave clock synchronization in the related art.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the present disclosure, there is provided a clock synchronization method, including: acquiring a plurality of compensation times of a time message to obtain a compensation time set, wherein the compensation time is a difference value between a first time and a second time, the first time is a time when the time message sent by a master clock is received, the second time is a time when the time message is forwarded to a slave clock, and the slave clock starts to process the time message; configuring a local clock of the slave clock to synchronize the slave clock with a clock of the master clock based on the set of compensated times.
In an embodiment of the present disclosure, obtaining a plurality of compensation times of a time packet to obtain a compensation time set includes: receiving a time message sent by a master clock, and determining the time when the time message is received; copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to a slave clock through different paths, and determining the time when the slave clock starts to process each copied time message; obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock; and respectively writing the plurality of compensation time of the time message into the CF fields of the correction domain of the corresponding time message.
In an embodiment of the present disclosure, after obtaining a plurality of compensation times of the time packet and obtaining a compensation time set, the method further includes: and screening the compensation time which accords with a preset range value in the compensation time set.
In one embodiment of the present disclosure, configuring a local clock of the slave clock based on the set of compensated times comprises: calculating to obtain weighted compensation time according to the compensation time set; configuring a local clock of the slave clock based on the weighted compensation time.
In an embodiment of the present disclosure, calculating a weighted compensation time according to the compensation time set includes: calculating a compensation time weight according to the compensation time set; and calculating to obtain weighted compensation time according to the compensation time set and the compensation time weight.
In one embodiment of the present disclosure, calculating a backoff time weight from the set of backoff times comprises: calculating the sum of the reciprocals of all the compensation times in the compensation time set; and calculating the compensation time weight according to the sum of the reciprocals of all the compensation times in the compensation time set and the compensation time set.
In an embodiment of the present disclosure, calculating a weighted compensation time according to the compensation time set and the compensation time weight includes: and calculating the sum of products of all the compensation time in the compensation time set and the weight of the compensation time to obtain the weighted compensation time.
According to another aspect of the present disclosure, there is provided a clock synchronization apparatus including: a set obtaining module, configured to obtain multiple compensation times of a time packet, to obtain a compensation time set, where the compensation time is a difference between a first time and a second time, the first time is a time when the time packet sent by a master clock is received, and the second time is a time when the time packet is forwarded to a slave clock and the slave clock starts to process the time packet; a clock configuration module to configure a local clock of the slave clock based on the compensated set of times to synchronize the slave clock with a clock of the master clock.
In an embodiment of the present disclosure, the set obtaining module is further configured to receive a time packet sent by a master clock, and determine a time when the time packet is received; copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to the slave clock through different paths, and determining the time when the slave clock starts to process each copied time message; obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock; and respectively writing the compensation time of the time message into the correction domain CF field of the corresponding time message.
In an embodiment of the disclosure, the apparatus further includes an offset value filtering module, where the offset value filtering module is configured to filter compensation times that meet a preset range value in the compensation time set.
In an embodiment of the present disclosure, the clock configuration module is further configured to calculate a weighted compensation time according to the compensation time set; configuring a local clock of the slave clock based on the weighted compensation time.
In an embodiment of the present disclosure, the clock configuration module is further configured to calculate a compensation time weight according to the compensation time set; and calculating to obtain weighted compensation time according to the compensation time set and the compensation time weight.
In an embodiment of the present disclosure, the clock configuration module is further configured to calculate a sum of reciprocals of all the compensation times in the compensation time set; and calculating the compensation time weight according to the sum of the reciprocals of all the compensation times in the compensation time set and the compensation time set.
In an embodiment of the disclosure, the clock configuration module is further configured to calculate a sum of products of all compensation times in the compensation time set and the compensation time weight, so as to obtain the weighted compensation time.
According to still another aspect of the present disclosure, there is provided an electronic device including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the clock synchronization method described above via execution of the executable instructions.
According to yet another aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the clock synchronization method described above.
The embodiment of the disclosure provides a clock synchronization method, a clock synchronization device, an electronic device and a storage medium, wherein the clock synchronization method comprises the following steps: the method comprises the steps of obtaining a compensation time set by obtaining a plurality of compensation times of a time message, wherein the compensation time is a difference value between a first time and a second time, the first time is a time when the time message sent by a master clock is received, the second time is a time when the time message is forwarded to a slave clock, and the slave clock starts to process the time message.
Furthermore, the method and the device screen and screen the compensation time which accords with the preset range value in the compensation time set according to the preset range value by setting the preset range value so as to remove invalid compensation time in the compensation time set and improve the reliability of data.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It should be apparent that the drawings in the following description are merely examples of the disclosure and that other drawings may be derived by those of ordinary skill in the art without inventive effort.
FIG. 1 is a schematic diagram of a clock synchronization system in an embodiment of the present disclosure;
FIG. 2 is a flow chart of a clock synchronization method in an embodiment of the present disclosure;
FIG. 3 is a flow chart illustrating another method of clock synchronization in an embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating a clock synchronization method according to an embodiment of the disclosure;
FIG. 5 is a flow chart illustrating another method of clock synchronization in an embodiment of the present disclosure;
FIG. 6 is a flow chart illustrating another method of clock synchronization in an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of a clock synchronization apparatus according to an embodiment of the disclosure; and
fig. 8 shows a block diagram of an electronic device in an embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
As mentioned in the foregoing background, the conventional clock synchronization apparatus needs to provide a time difference value for the time packet, correct the receiving time of the time packet actually received from the clock, and improve the clock synchronization precision. However, in a case where the actual manufacturing process cannot guarantee complete accuracy, the time difference measured by the clock synchronization device has a difference in measurement accuracy between devices of the same type, so that the time difference deviates from an actual value, and the clock synchronization is inaccurate.
Based on this, the present disclosure provides a clock synchronization method, apparatus, electronic device and storage medium, which improve the accuracy of clock synchronization of a master clock and a slave clock by configuring a local clock of the slave clock according to a plurality of compensation times of a time packet.
For ease of understanding, the following first explains several terms to which the disclosure relates:
PTP (precision Time Protocol) is a Protocol for Time and frequency synchronization of standard ethernet terminal devices, and is also called IEEE1588, which is abbreviated as 1588. In a PTP clock synchronization system (i.e. PTP domain), there is and only one synchronized clock, to which all terminal devices in the PTP domain remain synchronized. The nodes which issue the synchronous clocks in the PTP domain are the main nodes, and the nodes which receive the synchronous clocks are the slave nodes. The master node and the slave node can realize clock synchronization through interactive PTP messages by utilizing a 1588 clock synchronization algorithm. The PTP protocol is designed mainly for a relatively localized and networked system, with a good subnet and a relatively stable internal component. The PTP protocol is widely applied to a distributed system due to the advantages of simple implementation, small occupied network and computing resources and the like.
IEEE1588 is a precision clock synchronization protocol standard of a network measurement and control system, which is referred to as a precision clock protocol for short. Time and frequency offset are calculated through message passing between the master device and the slave device, so that frequency and time synchronization of the master device and the slave device is achieved, and the accuracy can reach a sub-microsecond level. The purpose of this standard is to accurately synchronize the measurement with a separate, independently running clock in the control system.
The traditional clock synchronization protocol has a precise clock synchronization protocol defined by IEEE1588, such as a PTP protocol, etc., wherein when clocks of two systems are synchronized by using the PTP protocol, compensation time in an incoming direction and an outgoing direction can be written in a CF field of a time packet through hardware, a value of a CF domain is subtracted from packet receiving time when the incoming direction message is sent to a calculation unit to calculate precision, the outgoing direction can be added by the hardware to obtain packet sending time, and finally, the time carried by the message is close to the time for receiving and sending the packet by the hardware.
The present disclosure adds a plurality of CF field write units on the basis of a conventional clock synchronization system, and refers to a schematic diagram of a clock synchronization system shown in fig. 1, where the clock synchronization system can be applied to a clock synchronization method in various embodiments of the present disclosure. After the time message receiving module 110 receives the time message sent by the master clock, copying the time message to obtain a plurality of copied time messages, and broadcasting the plurality of copied time messages; the message processing module 120 receives a plurality of copied time messages, measures the compensation time of the plurality of copied time messages, obtains a plurality of compensation times of the time messages, and writes the plurality of compensation times of the time messages into respective CF fields through a plurality of CF field writing units, such as the CF field writing unit 121, the CF field writing unit 122, and the CF field writing unit 123 in fig. 1, where the number of the CF field writing units is not limited, and uploads the time messages in which the compensation times are written to the calculation module 130, the calculation module 130 reads the CF field of each copied time message to obtain a compensation time set, calculates the weighted compensation time according to the compensation time set, and uploads the obtained weighted compensation time to the configuration module 140, and the configuration module 140 configures a local clock of a slave clock according to the weighted compensation time, so as to synchronize clocks of the master clock and the slave clock.
The present exemplary embodiment will be described in detail below with reference to the drawings and examples.
First, the embodiments of the present disclosure provide a clock synchronization method, which may be applied to a slave clock or executed by any electronic device with computing processing capability.
Fig. 2 shows a flowchart of a clock synchronization method in an embodiment of the present disclosure, and as shown in fig. 2, the clock synchronization method provided in the embodiment of the present disclosure includes the following steps:
s202, obtaining a plurality of compensation times of the time packet, and obtaining a compensation time set, where the compensation time is a difference between a first time and a second time, the first time is a time when the time packet sent by the master clock is received, and the second time is a time when the time packet is forwarded to the slave clock and the slave clock starts to process the time packet.
It should be noted that the compensation time set includes a plurality of compensation times of the time packet; in an embodiment of the present disclosure, after receiving a time packet sent by a master clock, the time packet may be copied first to obtain a plurality of copied time packets, the copied time packets are broadcasted, the compensation time of each copied time packet is measured to obtain the compensation time of each copied time packet, the compensation time is written into a CF field of the corresponding time packet, and a compensation time set is obtained by reading the CF field of each time packet.
The time messages mentioned in the embodiments of the present disclosure may be various time messages defined by a PTP protocol, the PTP protocol defines two types of messages, one is a time message, it needs to be time stamped at the time of receiving and sending, and an event port is used for receiving and sending, and the port number of the event port is 319; the second is a common message, which is transmitted and received by using a universal port without stamping at the time of transmitting and receiving, and the port number of the universal port is 320. Time messages include, but are not limited to: a synchronization (Sync) message, a Delay request (Delay _ Req) message, a peer Delay request (Pdelay _ Req) message, and a peer Delay response (Pdelay _ Resp) message. Accordingly, common messages include, but are not limited to: notification (Announce) message, follow (Follow _ Up) message, delay response (Delay _ Resp) message, peer Delay response Follow (Pdelay _ Resp _ Follow _ Up) message, management (management) message, and Signaling message. The PTP time message in the embodiment of the present disclosure conforms to a format specified by a PTP protocol, and includes, for example, a TimeStamp (TS) domain, a CF domain, a PTP message type domain, a PTP message serial number domain, a PTP message port domain, and the like.
S204, based on the compensation time set, the local clock of the slave clock is configured so as to enable the slave clock to be synchronous with the clock of the master clock.
It should be noted that the local clock of the slave clock may be configured according to a plurality of compensation times of the time packet in the compensation time set, for example, first, weight values of all compensation times in the compensation time set are calculated, where the weight value of each compensation time in the compensation time set may be the same or different, then, weighted values of all compensation times in the compensation time set are calculated according to the compensation time set and the weight values, and finally, the local clock of the slave clock is configured according to the weighted values of all compensation times in the compensation time set.
According to the clock synchronization method provided by the embodiment of the disclosure, a compensation time set is obtained by obtaining a plurality of compensation times of a time message, wherein the compensation time is a difference value between a first time and a second time, the first time is a time when the time message sent by a master clock is received, the second time is a time when the time message is forwarded to a slave clock, and the slave clock starts to process the time message.
It should be noted that the clock synchronization method disclosed by the present disclosure may be applied to the scenes of clock synchronization of hardware between networking network elements, clock synchronization of a server cluster, clock synchronization between a server resource pool and an entity network element, and the like.
The clock synchronization method provided by the disclosure is characterized in that a plurality of CF field writing modules are added on the basis of the conventional time compensation device, after a time message sent by a master clock is received, a plurality of compensation times of the time message are measured, each compensation time of the time message is written into the respective CF field by using the plurality of CF field writing modules and is uploaded to a computing unit for weighted compensation time computation, and a local clock of a slave clock is configured according to the obtained weighted compensation time, so that the clock synchronization accuracy of the master clock and the slave clock is improved.
In an embodiment of the present disclosure, the obtaining of multiple compensation times of the time packet may be implemented by the steps disclosed in fig. 3 to obtain a compensation time set, referring to another clock synchronization method flowchart shown in fig. 3, which may include the following steps:
s302, receiving a time message sent by a master clock, and determining the time when the time message is received;
s304, copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to the slave clock through different paths, and determining the time when the slave clock starts to process each copied time message;
s306, obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock;
s308, writing the compensation time of the time message into the correction domain CF field of the corresponding time message respectively.
It should be noted that, in an embodiment of the present disclosure, referring to a schematic diagram of a clock synchronization method shown in fig. 4, after receiving a time packet sent by a master clock, where the time packet may be a Sync packet, a time t1 when the time packet is sent from the master clock is recorded, and a time t2 when the slave clock receives the time packet. Then, the slave clock returns a delay _ req message to the master clock, and records the time t3 when the slave clock sends the delay _ req message, and the time t4 when the master clock receives the delay _ req message. The offset time offset and the transmission delay of the time packet can be calculated by the following formulas:
offset=((t2-t1)-(t4-t3))/2 (1)
delay=((t2-t1)+(t4-t3))/2 (2)
after the compensation time of each time message is obtained, each compensation time of the time message is written into a respective CF field, and a compensation time set is obtained by reading the CF field of each time message.
In an embodiment of the present disclosure, after obtaining a plurality of compensation times of the time packet and obtaining a compensation time set, the method further includes: and screening the compensation time which accords with the preset range value in the compensation time set. Here, the number of the first and second electrodes, for example, the set of compensation times obtained is N = { N =1,n2,n3,...,niI is a positive integer, the time precision standard value is set to be k, and the preset time range value is [ -k, k [ -k]Screening the compensation time meeting the preset range value in the compensation time set to obtain the screened compensation time set N1= { N =j∈N,-k≤njK is less than or equal to k, and j is a positive integer. According to the method and the device, the preset range value is set, and the compensation time meeting the preset range value in the compensation time set is screened and screened according to the preset range value, so that invalid compensation time in the compensation time set is removed, and the reliability of data is improved.
In one embodiment of the present disclosure, configuring the local clock of the slave clock based on the compensated time set may be implemented by the steps disclosed in fig. 5, and referring to another clock synchronization method flowchart shown in fig. 5, the steps may include:
s502, calculating to obtain weighted compensation time according to the compensation time set;
and S504, configuring a local clock of the slave clock based on the weighted compensation time.
It should be noted that, in one embodiment of the present disclosure, the set of compensated time after the filtering N1= { N = { N = N = is providedj∈N,-k≤njK is less than or equal to k, the compensation time weight can be calculated according to the compensation time set, and then the weighted compensation time can be calculated according to the compensation time set and the compensation time weight. The sum of the inverses of all the compensation times in the compensation time set can be calculated; and calculating the compensation time weight according to the sum of the inverses of all the compensation times in the compensation time set and the compensation time set.
In one embodiment of the present disclosure, the sum of the reciprocals S of all the compensation times in the set of compensation times N1 and the compensation time weight a may be calculated by the following formula:
Figure BDA0003763269090000101
Figure BDA0003763269090000102
wherein, S is the sum of the reciprocals of all the compensation time in the compensation time set N1, and m is the number of elements in the compensation time set N1.
In one embodiment of the present disclosure, the weighted compensation time T of the compensation time set N1 may be calculated by the following formula:
Figure BDA0003763269090000103
according to the clock synchronization method provided by the embodiment of the disclosure, the final compensation time, namely the weighted compensation time, is obtained through a weighting algorithm, and the compensation time written in the traditional hardware is optimized through the algorithm, so that the clock synchronization precision is finally improved, and errors caused by manufacturing process deviation are reduced. Meanwhile, under the plurality of weighted compensation time acquisition circuits, the optimal message packet sending circuit is obtained according to calculation, so that a better circuit can be automatically selected for the current environment without replacing equipment to obtain a better clock synchronization network element, and the production cost is reduced.
In an embodiment of the present disclosure, calculating the weighted compensation time according to the compensation time set may be implemented by the steps disclosed in fig. 6, and referring to another clock synchronization method flowchart shown in fig. 6, the steps may include:
s602, calculating a compensation time weight according to the compensation time set;
and S604, calculating to obtain weighted compensation time according to the compensation time set and the compensation time weight.
In one embodiment of the present disclosure, calculating a backoff time weight from a set of backoff times comprises: calculating the sum of the reciprocals of all the compensation times in the compensation time set; and calculating the compensation time weight according to the sum of the inverses of all the compensation times in the compensation time set and the compensation time set.
In one embodiment of the present disclosure, calculating a weighted compensation time according to the compensation time set and the compensation time weight includes: and calculating the sum of the products of all the compensation time and the weight of the compensation time in the compensation time set to obtain weighted compensation time.
Based on the same inventive concept, the embodiment of the present disclosure further provides a clock synchronization apparatus, such as the following embodiments. Because the principle of the embodiment of the apparatus for solving the problem is similar to that of the embodiment of the method, the embodiment of the apparatus can be implemented by referring to the implementation of the embodiment of the method, and repeated details are not described again.
Fig. 7 shows a schematic diagram of a clock synchronization apparatus in an embodiment of the present disclosure, and as shown in fig. 7, the apparatus includes:
a set obtaining module 710, configured to obtain a plurality of compensation times of a time packet, to obtain a compensation time set, where the compensation time is a difference between a first time and a second time, the first time is a time when a time packet sent by a master clock is received, the second time is a time when the time packet is forwarded to a slave clock, and the slave clock starts to process the time packet;
a clock configuration module 720, configured to configure the local clock of the slave clock based on the compensated set of times to synchronize the slave clock with the clock of the master clock.
In an embodiment of the disclosure, the apparatus further includes an offset value filtering module, where the offset value filtering module is configured to filter the compensation time meeting the preset range value in the compensation time set.
In an embodiment of the present disclosure, the set obtaining module 710 is further configured to receive a time packet sent by a master clock, and determine a time when the time packet is received; copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to the slave clock through different paths, and determining the time when the slave clock starts to process each copied time message; obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock; and respectively writing the plurality of compensation time of the time message into the CF fields of the correction domain of the corresponding time message.
In an embodiment of the present disclosure, the clock configuration module 720 is further configured to calculate a weighted compensation time according to the compensation time set; a local clock of the slave clock is configured based on the weighted compensation time.
In an embodiment of the present disclosure, the clock configuration module 720 is further configured to calculate a compensation time weight according to the compensation time set; and calculating to obtain the weighted compensation time according to the compensation time set and the compensation time weight.
In an embodiment of the present disclosure, the clock configuration module 720 is further configured to calculate a sum of reciprocals of all compensation times in the compensation time set; and calculating the compensation time weight according to the sum of the inverses of all the compensation times in the compensation time set and the compensation time set.
In an embodiment of the disclosure, the clock configuration module 720 is further configured to calculate a sum of products of all compensation times in the compensation time set and the compensation time weight, so as to obtain a weighted compensation time.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 800 according to this embodiment of the disclosure is described below with reference to fig. 8. The electronic device 800 shown in fig. 8 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 8, electronic device 800 is in the form of a general purpose computing device. The components of the electronic device 800 may include, but are not limited to: the at least one processing unit 810, the at least one memory unit 820, and a bus 830 that couples the various system components including the memory unit 820 and the processing unit 810.
Where the memory unit stores program code, the program code may be executed by the processing unit 810 to cause the processing unit 810 to perform steps according to various exemplary embodiments of the present disclosure as described in the "exemplary methods" section above in this specification. For example, the processing unit 810 may perform the following steps of the above-described method embodiments: acquiring a plurality of compensation times of the time message to obtain a compensation time set, wherein the compensation time is a difference value between a first time and a second time, the first time is a time when the time message sent by the master clock is received, the second time is a time when the time message is forwarded to the slave clock, and the slave clock starts to process the time message; based on the compensated set of times, a local clock of the slave clock is configured to synchronize the slave clock with a clock of the master clock.
In some embodiments, in the electronic device provided in the embodiments of the present disclosure, the processing unit 810 is further configured to: receiving a time message sent by a master clock, and determining the time when the time message is received; copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to the slave clock through different paths, and determining the time when the slave clock starts to process each copied time message; obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock; and respectively writing the compensation time of the time message into the correction domain CF field of the corresponding time message.
In some embodiments, in the electronic device provided in the embodiments of the present disclosure, the processing unit 810 is further configured to: and screening the compensation time which accords with the preset range value in the compensation time set.
In some embodiments, in the electronic device provided in the embodiments of the present disclosure, the processing unit 810 is further configured to: calculating to obtain weighted compensation time according to the compensation time set; a local clock of the slave clock is configured based on the weighted compensation time.
In some embodiments, in the electronic device provided in the embodiments of the present disclosure, the processing unit 810 is further configured to: calculating a compensation time weight according to the compensation time set; and calculating to obtain the weighted compensation time according to the compensation time set and the compensation time weight.
In some embodiments, in the electronic device provided in the embodiments of the present disclosure, the processing unit 810 is further configured to: calculating the sum of the reciprocals of all the compensation times in the compensation time set; and calculating the compensation time weight according to the sum of the inverses of all the compensation times in the compensation time set and the compensation time set.
In some embodiments, in the electronic device provided in the embodiments of the present disclosure, the processing unit 810 is further configured to: and calculating the sum of the products of all the compensation time and the compensation time weight in the compensation time set to obtain the weighted compensation time.
The storage unit 820 may include readable media in the form of volatile memory units such as a random access memory unit (RAM) 8201 and/or a cache memory unit 8202, and may further include a read only memory unit (ROM) 8203.
The storage unit 820 may also include a program/utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 830 may be any of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 800 may also communicate with one or more external devices 840 (e.g., a keyboard, a pointing device, a bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 800, and/or with any device (e.g., a router, a modem, etc.) that enables the electronic device 800 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 850. Also, the electronic device 800 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) via the network adapter 860. As shown, the network adapter 860 communicates with the other modules of the electronic device 800 via the bus 830. It should be appreciated that although not shown, other hardware and/or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium, which may be a readable signal medium or a readable storage medium. On which a program product capable of implementing the above-described method of the present disclosure is stored. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device. For example, when the computer program stored on the computer readable storage medium in the embodiment of the present disclosure is executed by the processor, the following steps of the following method can be realized: acquiring a plurality of compensation times of a time message to obtain a compensation time set, wherein the compensation time is a difference value between a first time and a second time, the first time is a time when the time message sent by a master clock is received, the second time is a time when the time message is forwarded to a slave clock, and the slave clock starts to process the time message; based on the compensated set of times, a local clock of the slave clock is configured to synchronize the slave clock with a clock of the master clock.
In some embodiments, when the computer program stored on the computer readable storage medium is executed by the processor, the following steps of the following method can be realized: receiving a time message sent by a master clock, and determining the time when the time message is received; copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to the slave clock through different paths, and determining the time when the slave clock starts to process each copied time message; obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock; and respectively writing the compensation time of the time message into the correction domain CF field of the corresponding time message.
In some embodiments, when the computer program stored on the computer readable storage medium is executed by the processor in the embodiments of the disclosure, the following steps of the following method can be further implemented: and screening the compensation time which accords with the preset range value in the compensation time set.
In some embodiments, when the computer program stored on the computer readable storage medium is executed by the processor, the following steps of the following method can be realized: calculating to obtain weighted compensation time according to the compensation time set; a local clock of the slave clock is configured based on the weighted compensation time.
In some embodiments, when the computer program stored on the computer readable storage medium is executed by the processor in the embodiments of the disclosure, the following steps of the following method can be further implemented: calculating a compensation time weight according to the compensation time set; and calculating to obtain the weighted compensation time according to the compensation time set and the compensation time weight.
In some embodiments, when the computer program stored on the computer readable storage medium is executed by the processor in the embodiments of the disclosure, the following steps of the following method can be further implemented: calculating the sum of the reciprocals of all the compensation times in the compensation time set; and calculating the compensation time weight according to the sum of the inverses of all the compensation times in the compensation time set and the compensation time set.
In some embodiments, when the computer program stored on the computer readable storage medium is executed by the processor in the embodiments of the disclosure, the following steps of the following method can be further implemented: and calculating the sum of the products of all the compensation time and the weight of the compensation time in the compensation time set to obtain weighted compensation time.
More specific examples of the computer-readable storage medium in the present disclosure may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In the present disclosure, a computer readable storage medium may include a propagated data signal with readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Alternatively, program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
In particular implementations, program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Moreover, although the steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that these steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice in the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A method of clock synchronization, comprising:
acquiring a plurality of compensation times of a time message to obtain a compensation time set, wherein the compensation time is a difference value between a first time and a second time, the first time is a time when the time message sent by a master clock is received, the second time is a time when the time message is forwarded to a slave clock, and the slave clock starts to process the time message;
configuring a local clock of a slave clock based on the set of compensated times to synchronize the slave clock with a clock of the master clock.
2. The clock synchronization method of claim 1, wherein obtaining a plurality of compensation times for the time packet to obtain a set of compensation times comprises:
receiving a time message sent by a master clock, and determining the time when the time message is received;
copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to a slave clock through different paths, and determining the time when the slave clock starts to process each copied time message;
obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock;
and respectively writing the plurality of compensation time of the time message into the CF fields of the correction domain of the corresponding time message.
3. The clock synchronization method of claim 1, wherein after obtaining a plurality of backoff times for the time packet to obtain a backoff time set, the method further comprises:
and screening the compensation time which accords with a preset range value in the compensation time set.
4. The clock synchronization method of claim 1, wherein configuring the local clock of the slave clock based on the set of compensated times comprises:
calculating to obtain weighted compensation time according to the compensation time set;
configuring a local clock of the slave clock based on the weighted compensation time.
5. The clock synchronization method of claim 4, wherein calculating a weighted compensation time from the set of compensation times comprises:
calculating a compensation time weight according to the compensation time set;
and calculating to obtain weighted compensation time according to the compensation time set and the compensation time weight.
6. The clock synchronization method of claim 5, wherein computing a back-off time weight from the set of back-off times comprises:
calculating the sum of the reciprocals of all the compensation times in the compensation time set;
and calculating the compensation time weight according to the sum of the reciprocals of all the compensation times in the compensation time set and the compensation time set.
7. The clock synchronization method of claim 4, wherein calculating a weighted compensation time according to the set of compensation times and the weight of the compensation time comprises:
and calculating the sum of products of all the compensation time in the compensation time set and the weight of the compensation time to obtain the weighted compensation time.
8. A clock synchronization apparatus, comprising:
the device comprises a set acquisition module, a time delay module and a time delay module, wherein the set acquisition module is used for acquiring a plurality of compensation times of a time message to obtain a compensation time set, the compensation times are difference values between a first time and a second time, the first time is the time when the time message sent by a master clock is received, the second time is the time when the time message is forwarded to a slave clock, and the slave clock starts to process the time message;
a clock configuration module to configure a local clock of the slave clock to synchronize the slave clock with a clock of the master clock based on the set of compensated times;
the set acquisition module is also used for receiving a time message sent by the master clock and determining the time when the time message is received; copying the time messages to obtain a plurality of copied time messages, respectively sending the plurality of copied time messages to a slave clock through different paths, and determining the time when the slave clock starts to process each copied time message; obtaining a plurality of compensation times of the time message according to the time when the time message is received and the time when each copied time message starts to be processed from the clock; and respectively writing the plurality of compensation time of the time message into the CF fields of the correction domain of the corresponding time message.
9. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the clock synchronization method of any one of claims 1 to 7 via execution of the executable instructions.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the clock synchronization method of any one of claims 1 to 7.
CN202210877974.2A 2022-07-25 2022-07-25 Clock synchronization method and device, electronic equipment and storage medium Pending CN115276869A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210877974.2A CN115276869A (en) 2022-07-25 2022-07-25 Clock synchronization method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210877974.2A CN115276869A (en) 2022-07-25 2022-07-25 Clock synchronization method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115276869A true CN115276869A (en) 2022-11-01

Family

ID=83769236

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210877974.2A Pending CN115276869A (en) 2022-07-25 2022-07-25 Clock synchronization method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115276869A (en)

Similar Documents

Publication Publication Date Title
JP3698074B2 (en) Network synchronization method, LSI, bus bridge, network device, and program
US8738792B2 (en) Server time protocol messages and methods
CN103563287B (en) Synchronization device and synchronization method
EP1427121A1 (en) Radio access network, radio communication method, synchronous server and node
JP7401656B2 (en) METHODS, APPARATUS AND SYSTEM AND STORAGE MEDIA FOR SELECTING CLOCK SOURCES
EP2658161B1 (en) Transmission device, transmission method and computer program
CN111385050B (en) Clock synchronization method, device and storage medium
CN101415071B (en) System and method for synchronizing simultaneous media stream playback
CN110719135A (en) Time calibration method and system and electronic device
US20200169378A1 (en) Methods, Apparatus and Computer-Readable Media for Synchronization Over an Optical Network
CN104144047A (en) Synchronization method of communication network system, intermediate node and slave node
CN113424466B (en) Method and device for clock synchronization
KR20230116903A (en) Methods and Heterogeneous Computing Systems for Clock Synchronization
CN115276869A (en) Clock synchronization method and device, electronic equipment and storage medium
US10334539B2 (en) Metered interface
CN115314146B (en) Time synchronization method and device under multi-hop networking, electronic equipment and storage medium
CN101420281A (en) Be used between network element, transmitting the method and apparatus of time value in a few days
CN112511255B (en) Time synchronization method and device
CN113259039A (en) Time synchronization method and device, computer equipment and storage medium
CN114389733A (en) PTP master clock device, clock synchronization method and storage medium
CN113132041B (en) Data transmission delay calculation method and device
US11664967B2 (en) Network device
CN112688752B (en) Time synchronization method, message processing method and device for time synchronization
CN115296768A (en) Time synchronization method and system of terminal equipment
WO2020155738A1 (en) Clock distribution method and apparatus in network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination