CN107395307A - A kind of clock synchronizing method and equipment - Google Patents

A kind of clock synchronizing method and equipment Download PDF

Info

Publication number
CN107395307A
CN107395307A CN201710565171.2A CN201710565171A CN107395307A CN 107395307 A CN107395307 A CN 107395307A CN 201710565171 A CN201710565171 A CN 201710565171A CN 107395307 A CN107395307 A CN 107395307A
Authority
CN
China
Prior art keywords
mrow
clock
timestamp
group
mfrac
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.)
Granted
Application number
CN201710565171.2A
Other languages
Chinese (zh)
Other versions
CN107395307B (en
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.)
Raisecom Technology Co Ltd
Original Assignee
Raisecom Technology Co 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 Raisecom Technology Co Ltd filed Critical Raisecom Technology Co Ltd
Priority to CN201710565171.2A priority Critical patent/CN107395307B/en
Publication of CN107395307A publication Critical patent/CN107395307A/en
Application granted granted Critical
Publication of CN107395307B publication Critical patent/CN107395307B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • 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/0641Change of the master or reference, e.g. take-over or failure of the master
    • 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/0652Synchronisation among time division multiple access [TDMA] nodes, e.g. time triggered protocol [TTP]
    • H04J3/0655Synchronisation among time division multiple access [TDMA] nodes, e.g. time triggered protocol [TTP] using timestamps

Landscapes

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

Abstract

The embodiment of the invention discloses a kind of clock synchronizing method and equipment, the clock synchronizing method includes:When upstream equipment where equipment and upstream clock where local clock connects, when the port clock state of equipment is from clock or only to do from clock, and the port clock state of upstream equipment is when being master clock, equipment is obtained from upstream equipment and records the clock information for synchronization, and local clock is synchronized into upstream clock according to the clock information;When equipment and upstream equipment disconnect suddenly, compensation is modified to local clock according to the clock information recorded in synchronizing process.The embodiment of the present invention is when clock source is lost, compensation is modified to local clock, row clock is synchronous to continue to enter with clock source, so as to control the purpose in a less scope, having reached clock synchronization in certain period of time from the time difference of clock and clock source.

Description

A kind of clock synchronizing method and equipment
Technical field
The present invention relates to simultaneous techniques, espespecially a kind of clock synchronizing method and equipment.
Background technology
In the field of communications, clock is synchronous plays a very important role to other business such as voice, video tool.Realize that clock is same The method of step mainly includes the mode such as link layer hardware transport and the transmission of message software layer, and national standard IEEE1588v2 agreements are (accurate Time protocol (PTP, Precision Time Protocol)) clock frequency and clock phase realized based on message switching method Synchronizing function, it is synchronous so as to enter row clock according to the clock information of Receive message master clock from clock when it is present during clock source.
From clock and the clock synchronizing method of clock source when national standard IEEE 1588v2 agreements define clock source when it is present, But if clock source is lost, will be lost from clock and continue the synchronous reference source of clock, without reference to related content in agreement.
The content of the invention
The embodiments of the invention provide a kind of clock synchronizing method and equipment, can when clock source is lost, from clock after The continuous correction-compensation for carrying out local clock, it is synchronous to continue to enter row clock with clock source, so that will be from clock and clock The time difference in source controls in certain period of time in a less scope, reaches the synchronous purpose of clock.
The embodiments of the invention provide a kind of clock synchronizing method, including:
When upstream equipment where equipment and upstream clock where local clock connects, when the port clock state of equipment From clock or only to do from clock, and when the port clock state of upstream equipment is master clock, equipment obtains simultaneously from upstream equipment The clock information for synchronization is recorded, and local clock is synchronized to by upstream clock according to the clock information;
When equipment and upstream equipment disconnect suddenly, the clock information according to recorded in synchronizing process is carried out to local clock Correction-compensation.
Optionally, the clock information includes being used to determine that a group or more of of time difference are used for the synchronous time Stamp;
Local clock is synchronized into upstream clock according to the clock information includes:
Determine and record that correction time is poor first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp;
Determine and record the frequency offset correction amount of every group of timestamp in the first preset time relative to first group of timestamp, and profit With the frequency offset correction amount obtained to correction time difference carries out secondary correction first corresponding to each group of timestamp, obtain and record The secondary correction time difference corresponding to this group of timestamp;
Every the second preset time according to last the secondary correction time difference pair obtained in second preset time Local clock enters row clock synchronization.
Optionally,
It is described to determine that correction time difference is wrapped first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp Include:
Wherein, Fi is that correction time is poor first corresponding to i-th group of timestamp, Offseti is i-th of time difference according to determined by i-th group of timestamp.
Optionally, the secondary correction time difference obtains in the following manner:
Every group of timestamp includes relative to the frequency offset correction amount of first group of timestamp in the first preset time of the determination:Will The one group of timestamp set in first preset time is relative to the frequency offset correction amount of first group of timestamp as the first pre- timing Interior every group of timestamp relative to first group of timestamp frequency offset correction amount.
Optionally, this method includes:
It is more than the default time difference when the secondary correction time difference corresponding to a certain group of timestamp in second preset time During threshold value, row clock synchronization is entered according to the secondary correction time difference corresponding to a certain group of timestamp.
Optionally,
Every group of timestamp includes relative to the frequency offset correction amount of first group of timestamp in the first preset time of the determination:
Determine that i-th group of timestamp is relative in the first preset time according to formula fi=(ti2-t12)-(ti1-t11) The frequency offset correction amount of one group of timestamp;Wherein, i is the integer more than or equal to 1, and fi is i-th group of time in the first preset time For stamp relative to the frequency offset correction amount of first group of timestamp, ti2 is to receive the first event in i-th group of timestamp in the first preset time The timestamp of message, t12 are the timestamp for receiving the first event message in the first preset time in the 1st group of timestamp, ti1 the I-th group of timestamp middle and upper reaches equipment sends the timestamp of the first event message in one preset time, and t11 is in the first preset time 1st group of timestamp middle and upper reaches equipment sends the timestamp of the first event message.
Optionally,
It is described that secondary correction is carried out to the difference of correction time first of corresponding timestamp using the frequency offset correction amount obtained, Obtaining the secondary correction time difference corresponding to this group of timestamp includes:
The secondary correction time corresponding to i-th group of timestamp in the first preset time is calculated according to formula CorFi=Fi-fi Difference;
Wherein i is the integer more than or equal to 1, and CorFi is secondary school corresponding to i-th group of timestamp in the first preset time Positive time difference, Fi are that correction time is poor first corresponding to the i-th group of timestamp obtained in the first preset time, and fi is first default Frequency offset correction amount corresponding to i-th group of timestamp in time.
Optionally,
Clock information includes recorded in the synchronizing process:Correction time first of every group of timestamp is poor, frequency offset correction Amount,
The clock information according to recorded in synchronizing process is modified compensation to local clock to be included:
According to formula
Compensation is modified to the local clock;
Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first first default Frequency offset correction amount corresponding to m1 groups timestamp in time, f (m2/T2) are m2 group timestamps in the 2nd the first preset time Corresponding frequency offset correction amount ... ..., f (mn/Tn) are frequency offset correction corresponding to mn group timestamps in n-th of first preset times Amount, T1 are the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd Correction time is poor first corresponding to m2 group timestamps in first preset time ... ..., when F (mn/Tn) is default n-th first Correction time is poor first corresponding to interior mn group timestamps, and n is the integer more than or equal to 1.
Optionally,
Clock information includes recorded in the synchronizing process:Correction time first of every group of timestamp is poor, frequency correction Amount and secondary correction time value,
The clock information according to recorded in synchronizing process is modified compensation to local clock to be included:
When the precision of local clock crystal oscillator is higher than predetermined value, every the 3rd preset time according to being obtained in synchronizing process The secondary correction time difference corresponding to each group of timestamp, compensation is modified to the local clock with the order of inverted order;
Otherwise, according to formula
Compensation is modified to the local clock;
Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first first default Frequency offset correction amount corresponding to m1 groups timestamp in time, f (m2/T2) are m2 group timestamps in the 2nd the first preset time Corresponding frequency offset correction amount ... ..., f (mn/Tn) are frequency offset correction corresponding to mn group timestamps in n-th of first preset times Amount, T1 are the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd Correction time is poor first corresponding to m2 group timestamps in first preset time ... ..., when F (mn/Tn) is default n-th first Correction time is poor first corresponding to interior mn group timestamps, and n is the integer more than or equal to 1.
The embodiment of the present invention also proposed a kind of equipment, including:
Acquisition module, during for being connected with the upstream equipment where upstream clock, when port clock state be from clock or Only do from clock, and when the port clock state of upstream equipment is master clock, obtains and recorded for synchronization from upstream equipment Clock information;
Synchronization module, for local clock to be synchronized into upstream clock according to clock information;
Compensating module, for when being disconnected suddenly with upstream equipment, according to the clock information pair recorded in synchronizing process Local clock is modified compensation.
Optionally, the clock information includes being used to determine that a group or more of of time difference are used for the synchronous time Stamp;
The synchronization module is specifically used for:
Determine and record that correction time is poor first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp;
Determine and record the frequency offset correction amount of every group of timestamp in the first preset time relative to first group of timestamp, and profit With the frequency offset correction amount obtained to correction time difference carries out secondary correction first corresponding to each group of timestamp, obtain and record The secondary correction time difference corresponding to this group of timestamp;
Every the second preset time according to last the secondary correction time difference pair obtained in second preset time Local clock enters row clock synchronization.
Optionally, the compensating module is specifically used for:
When being disconnected suddenly with upstream equipment,
According to formula
Compensation is modified to the local clock;
Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first first default Frequency offset correction amount corresponding to m1 groups timestamp in time, f (m2/T2) are m2 group timestamps in the 2nd the first preset time Corresponding frequency offset correction amount ... ..., f (mn/Tn) are frequency offset correction corresponding to mn group timestamps in n-th of first preset times Amount, T1 are the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd Correction time is poor first corresponding to m2 group timestamps in first preset time ... ..., when F (mn/Tn) is default n-th first Correction time is poor first corresponding to interior mn group timestamps, and n is the integer more than or equal to 1.
The embodiment of the present invention also proposed a kind of equipment, including:Precision Time Protocol PTP ports, processor and computer Readable storage medium storing program for executing;
The PTP ports, for obtaining clock information from upstream equipment;
Instruction is stored with the computer-readable recording medium, when the instruction is by the computing device, is realized Following steps:
When being connected with the upstream equipment where upstream clock, when the port clock state of PTP ports is from clock or only to do From clock, and when the port clock state of the PTP ports of upstream equipment is master clock, control PTP ports obtain from upstream equipment For the clock information of synchronization, and recording clock information;
Local clock is synchronized to by upstream clock according to clock information;
When being disconnected suddenly with upstream equipment, local clock is repaiied according to the clock information recorded in synchronizing process Positive compensation.
Compared with correlation technique, the embodiment of the present invention includes:It is upper where equipment and upstream clock where local clock When swimming equipment connection, when the port clock state of equipment is from clock or only to do from clock, and the port clock shape of upstream equipment When state is master clock, equipment obtains from upstream equipment and records the clock information for synchronization, and will be local according to clock information Clock is synchronized to upstream clock;When equipment and upstream equipment disconnect suddenly, equipment is according to the clock recorded in synchronizing process Information is modified compensation to local clock.By the scheme of the embodiment of the present invention, when clock source is lost, i.e., upstream equipment with When equipment disconnects suddenly, equipment is modified compensation to local clock according to the clock information recorded in synchronizing process, to enter One step continues to enter that row clock is synchronous with clock source, so as to will be controlled from the time difference of clock and clock source in certain period of time In a less scope, the synchronous purpose of clock is reached.
Other features and advantages of the present invention will be illustrated in the following description, also, partly becomes from specification Obtain it is clear that or being understood by implementing the present invention.The purpose of the present invention and other advantages can be by specification, rights Specifically noted structure is realized and obtained in claim and accompanying drawing.
Brief description of the drawings
Accompanying drawing is used for providing further understanding technical solution of the present invention, and a part for constitution instruction, with this The embodiment of application is used to explain technical scheme together, does not form the limitation to technical solution of the present invention.
Fig. 1 is the flow chart of clock synchronizing method of the embodiment of the present invention;
Fig. 2 is a kind of structure composition schematic diagram of equipment of the embodiment of the present invention;
Fig. 3 is the structure composition schematic diagram of another kind equipment of the embodiment of the present invention;
Fig. 4 is the structure composition schematic diagram of another equipment of the embodiment of the present invention.
Embodiment
Embodiments of the invention are described in detail below in conjunction with accompanying drawing.It should be noted that do not conflicting In the case of, the feature in embodiment and embodiment in the application can be mutually combined.
Can be in the computer system of such as one group computer executable instructions the flow of accompanying drawing illustrates the step of Perform.Also, although logical order is shown in flow charts, in some cases, can be with suitable different from herein Sequence performs shown or described step.
Referring to Fig. 1, the embodiment of the present invention proposes a kind of clock synchronizing method, including:
When upstream equipment where equipment and upstream clock where step 100, local clock connects, when the port of equipment Clock status are from clock or only to do from clock, and when the port clock state of upstream equipment is master clock, equipment is set from upstream It is standby to obtain and record the clock information for synchronization.
In this step, clock information includes being used to determine that a group or more of of time difference are used for synchronous timestamp;
When link delay mechanism is latency request-response mechanism, each group of timestamp includes:Upstream equipment sends the The timestamp of one event message, upstream equipment receive the timestamp of second event message, equipment receive the first event message when Between stamp and equipment send second event message timestamp;
When link delay mechanism is reciprocity delay strategy, each group of timestamp includes:Upstream equipment sends the first event Timestamp, the upstream equipment of message receive the timestamp of second event message, and upstream equipment sends the time of the 3rd event message Stamp, equipment receives the timestamp of the first event message, equipment sends the timestamp of second event message and equipment receives the 3rd thing The timestamp of part message.
Wherein, the timestamp of the first event message of equipment reception can record when equipment receives the first event message, The timestamp that equipment sends second event message can record when equipment sends second event message, and equipment receives the 3rd event The timestamp of message can record when equipment receives three event messages.
The timestamp that upstream equipment sends the first event message can send the first event from the carrying that upstream equipment is sent Obtained in the message of the timestamp of message, what the timestamp that upstream equipment receives second event message can be sent from upstream equipment Carry and is obtained in the message for the timestamp for receiving second event message, the timestamp that upstream equipment sends the 3rd event message can be with Obtained in the message for the timestamp that the carrying sent from upstream equipment sends the 3rd event message.
Step 101, local clock is synchronized to by upstream clock according to clock information.Specifically include:
Step 1011:Determined and recorded based on synchronization time difference corresponding to each group of timestamp first corresponding to this group of timestamp Secondary correction time is poor;
Wherein it is possible to determined according to equation below:
Wherein, Fi is correction time offseti first corresponding to i-th group of timestamp For i-th of time difference according to determined by i-th group of timestamp.
More specifically, due to time synchronization process generally use latency request-response mechanism and reciprocity delay strategy, root It is as described below come the method for determining correction time first according to two kinds of mechanism:
(1) when link delay mechanism is latency request-response mechanism,
Link delay delay corresponding to each group of timestamp is determined, is specially:
According to formulaCalculate link delay corresponding to i-th group of timestamp; Wherein, i is the integer more than or equal to 1;
The time difference offset according to corresponding to link delay corresponding to each group of timestamp determines each group of timestamp, specifically For:
The time difference corresponding to i-th group of timestamp is calculated according to formula offseti=(ti2-ti1)-delayi;
The correction time difference F first according to corresponding to the time difference corresponding to each group of timestamp determines each group of timestamp, tool Body is::
When i is 1, according to correction time is poor first corresponding to formula F 1=offset1 the 1st group of timestamp of calculating;
When i is more than or equal to 2, according to formulaCalculate corresponding to i-th group of timestamp Correction time is poor first;
Wherein, delayi is link delay corresponding to i-th group of timestamp, and ti2 is that equipment receives first in i-th group of timestamp The timestamp of event message, ti1 send the timestamp of the first event message, ti3 i-th for i-th group of timestamp middle and upper reaches equipment Equipment sends the timestamp of second event message in group timestamp, and ti4 is that i-th group of timestamp middle and upper reaches equipment receives second event The timestamp of message, offseti are the time difference corresponding to i-th group of timestamp, and F1 is timing first corresponding to the 1st group of timestamp Between it is poor, Fi is that correction time is poor first corresponding to i-th group of timestamp, and F (i-1) is that (i-1) is organized corresponding to timestamp first Correction time is poor.
(2) when link delay mechanism is reciprocity delay strategy
Link delay delay corresponding to each group of timestamp is determined, is specially:
According to formulaCalculate link delay corresponding to i-th group of timestamp; Wherein, i is the integer more than or equal to 1;
The time difference offset according to corresponding to link delay corresponding to each group of timestamp calculates each group of timestamp, specifically For:
The time difference corresponding to i-th group of timestamp is calculated according to formula offseti=(ti2-ti1)-delayi;
Equipment correction time difference F first according to corresponding to link delay and time difference calculate each group of timestamp, specifically For::
When i is 1, according to correction time is poor first corresponding to formula F 1=offset1 the 1st group of timestamp of calculating;
When i is more than or equal to 2, according to formulaCalculate corresponding to i-th group of timestamp Correction time is poor first;
Wherein, delayi is link delay corresponding to i-th group of timestamp, and ti2 is that equipment receives first in i-th group of timestamp The timestamp of event message, ti1 send the timestamp of the first event message, ti3 i-th for i-th group of timestamp middle and upper reaches equipment Equipment sends the timestamp of second event message in group timestamp, and ti4 is that i-th group of timestamp middle and upper reaches equipment receives second event The timestamp of message, ti5 is the timestamp that i-th group of timestamp middle and upper reaches equipment sends the 3rd event message, when ti6 is i-th group Between stab in equipment receive the timestamp of the 3rd event message, offseti is the time difference corresponding to i-th group of timestamp, and F1 is the 1st group Correction time is poor first corresponding to timestamp, and Fi is that correction time is poor first corresponding to i-th group of timestamp, and F (i-1) is the (i-1) correction time is poor first corresponding to group timestamp.
Certainly, in other examples, correction time difference F can also be when directly taking the synchronization of every group of timestamp first Between poor offset, without dealing with, but its synchronization accuracy will be determined not as good as with reference to the synchronization time difference of upper one group of timestamp Correction time first it is poor;
Step 1012:Determine and record that every group of timestamp is relative to the frequency of first group of timestamp in each first preset time Inclined correcting value;
The first preset time herein is to obtain the cycle of secondary correction time;As a rule first preset time can be with Definite value is arranged to, but in some special situations, the first preset time could be arranged to according to given value or rule change Period time value, do not limit herein;
It is determined that every group of timestamp can lead to relative to the frequency offset correction amount of first group of timestamp in each first preset time Cross in the following manner:
According to formula
Fi=(ti2-t12)-(ti1-t11) determines that i-th group of timestamp is relative to first group of time in the first preset time The frequency offset correction amount of stamp;Wherein, i is integer more than or equal to 1, fi be in the first preset time i-th group of timestamp relative to The frequency offset correction amount of first group of timestamp, ti2 be received in the first preset time in i-th group of timestamp the first event message when Between stab, t12 is the timestamp for receiving the first event message in the first preset time in the 1st group of timestamp, when ti1 is first default Interior i-th group of timestamp middle and upper reaches equipment sends the timestamp of the first event message, when t11 is the 1st group in the first preset time Between stab the timestamp that middle and upper reaches equipment sends the first event message.
As fi=0, represent synchronous with master clock frequency from clock;
Work as fi>When 0, represent fast from clock ratio master clock frequency;
Work as fi<When 0, represent slow from clock ratio master clock frequency.
Alternatively, as fi=0, the value can be no longer calculated in first preset time, and gives tacit consent to and originally first presets It is synchronous with master clock frequency from clock in time, or alternatively, as fi=0, multiple first preset times can be spaced and taken Value calculates whether f is 0 again, with monitoring from clock and master clock whether Frequency Synchronization, think during this from clock with it is main when Clock is synchronous;
In another embodiment, for simplicity, can be just for every m groups time in the first preset time Stamp group calculate once the m groups timestamp relative to first group of timestamp frequency offset correction amount (computational methods with upper similar, no longer Repeat), and using the result of this frequency offset calculation amount as by other groups of timestamps in first preset time relative to first Group timestamp frequency offset correction amount, typically, can by last group of timestamp in the first preset time relative to first group when Between the frequency offset correction amount of the frequency offset correction amount stabbed as every group of timestamp in the scheduled time relative to first group of timestamp, so as to Simplify calculating process, this typically can be changed in little scene application in amounts of frequency offset by ectocine realizes.
Step 1013:The difference of correction time first of corresponding this group of timestamp is carried out using the frequency offset correction amount obtained Secondary correction, obtain and record the secondary correction time difference corresponding to this group of timestamp;
Specifically, calculate secondary school corresponding to i-th group of timestamp in the first preset time according to formula CorFi=Fi-fi The positive time difference;
Wherein i is the integer more than or equal to 1, and CorFi is secondary school corresponding to i-th group of timestamp in the first preset time Positive time difference, Fi are that correction time is poor first corresponding to the i-th group of timestamp obtained in the first preset time, and fi is first default Frequency offset correction amount corresponding to i-th group of timestamp in time.
Step 1014:Every the second preset time according to last the secondary correction time obtained in the second preset time Difference enters row clock synchronization to local clock.
Wherein, the second preset time is cycle lock in time of identified equipment in advance, in second preset time It can be set according to system and obtain one group or multigroup timestamp for being used for synchronization, do not limited herein.
Optionally, it is big when the secondary correction time difference corresponding to a certain group of timestamp for judging to obtain in the second preset time When time difference threshold value, row clock synchronization is entered according to the secondary correction time difference corresponding to this group of timestamp.
Wherein, time difference threshold value can obtain knowing and being manually set by test of many times.
Step 102, when equipment and upstream equipment disconnect suddenly, according to being used for recorded in synchronizing process it is synchronous when Clock information is modified compensation to local clock.
, can be by judging whether the 3rd preset time has more newly arriving for clock information of progress to judge that equipment is in this step It is no to disconnect with upstream equipment, when the renewal for judging not having to carry out clock information in the 3rd preset time, judge equipment with Upstream equipment disconnects;When judging to have in the 3rd preset time the renewal for carrying out clock information, judge that equipment is set with upstream It is standby to be not turned off.
In this step, after being disconnected due to equipment and upstream equipment, local clock is typically to continue to tie up by local crystal oscillator Hold the time, it is assumed that the function model of clock is T (t)=wt+ β, wherein, t is the reference time, and w is that instantaneous moment clock frequency is inclined Difference, β are phase deviation, due to enter when equipment connects with upstream equipment row clock it is synchronous during have recorded every group when Between the difference Fi of correction time first that stabs, frequency offset correction amount fi, local clock is entered according to the clock information recorded in synchronizing process Row correction-compensation includes:
According to formula:
Compensation is modified to local clock;
Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first first default Frequency offset correction amount corresponding to m1 groups timestamp in time, f (m2/T2) are m2 group timestamps in the 2nd the first preset time Corresponding frequency offset correction amount ... ..., f (mn/Tn) are frequency offset correction corresponding to mn group timestamps in n-th of first preset times Amount, T1 are the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd Correction time is poor first corresponding to m2 group timestamps in first preset time ... ..., when F (mn/Tn) is default n-th first Correction time is poor first corresponding to interior mn group timestamps, and n is the integer more than or equal to 1;And the selection of m group timestamps (m1, m2 ... ... mn selection) can determine according to rule set in advance, for example, all selecting in the first preset time The timestamp of same sequence number, but if the first preset time value is different, the selective value of m group timestamps can also be different, Preferably can all it directly select as last group of timestamp in the current first choice time.
By above-mentioned clock compensation method, equipment can be caused after being disconnected with upstream clock, maintained with local crystal oscillator In the case of local clock, the historical time information pair recorded in the synchronizing process according to before with upstream clock is remained able to Local zone time compensates, because the compensating approach is to be based on original upstream clock and local clock, therefore, using the method Local clock lock in time after being disconnected with upstream clock can be made to remain within certain accuracy rating.
Optionally, when the precision of the crystal oscillator frequency of local clock is higher, typically, during higher than predetermined value (4.6ppm), Equipment every the 3rd preset time according to the secondary correction time difference obtained in synchronizing process with the order of inverted order to local clock Compensation is modified, the 3rd preset time herein can be when the setting of local zone time synchronization is carried out during a disconnection of setting Between, but preferably, the 3rd preset time can be lock in time when equipment normally connects upstream equipment (for example, second Preset time);Lock in time is consistent when thereby guaranteeing that equipment line with disconnecting.
That is, in first the 3rd preset time, corresponded to according to last group of timestamp obtained in synchronizing process The secondary correction time difference compensation is modified to local clock;In second the 3rd preset time, obtained according in synchronizing process The secondary correction time difference corresponding to the second from the bottom group of timestamp obtained is modified compensation to local clock;..., at n-th Three preset times, according to the secondary correction time difference corresponding to the n-th group timestamp reciprocal obtained in synchronizing process to local clock It is modified compensation.
Optionally, this method also includes:
After equipment recovers connection with upstream equipment, equipment continues executing with the port clock state when equipment as from clock or only Do from clock, and when the port clock state of upstream equipment is master clock, equipment obtains clock information from upstream equipment, according to obtaining The step of local clock is synchronized to upstream clock by the clock information obtained.
Referring to Fig. 2, the embodiment of the present invention also proposed a kind of equipment, including:
Acquisition module, during for being connected with the upstream equipment where upstream clock, when port clock state be from clock or Only do from clock, and when the port clock state of upstream equipment is master clock, obtains and recorded for synchronization from upstream equipment Clock information;
Synchronization module, for local clock to be synchronized into upstream clock according to clock information;
Compensating module, for when being disconnected suddenly with upstream equipment, according to the clock information pair recorded in synchronizing process Local clock is modified compensation.
Optionally, clock information includes being used to determine that a group or more of of time difference are used for synchronous timestamp;
The synchronization module is specifically used for:
Determine and record that correction time is poor first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp;
Determine and record the frequency offset correction amount of every group of timestamp in the first preset time relative to first group of timestamp, and profit With the frequency offset correction amount obtained to correction time difference carries out secondary correction first corresponding to each group of timestamp, obtain and record The secondary correction time difference corresponding to this group of timestamp;
Every the second preset time according to last the secondary correction time difference pair obtained in second preset time Local clock enters row clock synchronization.
Optionally, the compensating module is specifically used for:
When being disconnected suddenly with upstream equipment,
According to formula
Compensation is modified to the local clock;
Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first first default Frequency offset correction amount corresponding to m1 groups timestamp in time, f (m2/T2) are m2 group timestamps in the 2nd the first preset time Corresponding frequency offset correction amount ... ..., f (mn/Tn) are frequency offset correction corresponding to mn group timestamps in n-th of first preset times Amount, T1 are the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd Correction time is poor first corresponding to m2 group timestamps in first preset time ... ..., when F (mn/Tn) is default n-th first Correction time is poor first corresponding to interior mn group timestamps, and n is the integer more than or equal to 1.
Referring to Fig. 3, as a kind of example, the equipment of the embodiment of the present invention includes:
PTP ports, for being from clock or only to do from clock when the port clock state of PTP ports, and upstream equipment When the port clock state of PTP ports is master clock, clock information is obtained from upstream equipment;
Best master clock module, for recording the clock information obtained;
Module during calibration pair, for local clock to be synchronized into upstream clock according to clock information;Dashed forward when with upstream equipment When so disconnecting, compensation is modified to local clock according to the clock information recorded in synchronizing process.
Optionally, clock information includes being used to determine that a group or more of of time difference are used for synchronous timestamp;
Module is specifically used for realizing in the following ways during calibration pair is synchronized to upstream according to clock information by local clock Clock includes:
Determine and record that correction time is poor first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp;
Determine and record the frequency offset correction amount of every group of timestamp in the first preset time relative to first group of timestamp, and profit With the frequency offset correction amount obtained to correction time difference carries out secondary correction first corresponding to each group of timestamp, obtain and record The secondary correction time difference corresponding to this group of timestamp;
Every the second preset time according to last the secondary correction time difference pair obtained in second preset time Local clock enters row clock synchronization.
Optionally, equipment also includes:
Global data collection, for preserving link delay mechanism;
PTP ports are specifically used for:
When link delay mechanism is latency request-response mechanism, of the PTP ports from upstream equipment is received One event message, the PTP ports of upstream device send second event message;Receive the PTP ports from upstream equipment The message of the timestamp of message comprising the timestamp for sending the first event message and reception second event message;
When link delay mechanism is reciprocity delay strategy, the first event of the PTP ports from upstream equipment is received Message, the PTP ports of upstream device send second event message;Receive the 3rd thing of the PTP ports from upstream equipment Part message;Receive the message of the timestamp of carrying the first event message of transmission of the PTP ports from upstream equipment, carrying connects Receive the message of the timestamp of second event message and carry the message for the timestamp for sending the 3rd event message;
Best master clock module is specifically used for:
When link delay mechanism is latency request-response mechanism, when receiving the first event message in PTP ports, note Record receives the timestamp of the first event message;
When sending second event message in PTP ports, record sends the timestamp of second event message;
When the message comprising the timestamp for sending the first event message is received in PTP ports, the transmission in message is obtained The timestamp and record of first event message;
When the message comprising the timestamp for receiving second event message is received in PTP ports, the reception in message is obtained The timestamp and record of second event message.
When link delay mechanism is reciprocity delay strategy, when receiving the first event message in PTP ports, record receives To the timestamp of the first event message;
When sending second event message in PTP ports, record sends the timestamp of second event message;
When receiving three event messages in PTP ports, record receives the timestamp of the 3rd event message;
When the message comprising the timestamp for sending the first event message is received in PTP ports, the transmission in message is obtained The timestamp and record of first event message;
When the message comprising the timestamp for receiving second event message is received in PTP ports, the reception in message is obtained The timestamp and record of second event message;
When the message comprising the timestamp for sending the 3rd event message is received in PTP ports, the transmission in message is obtained The timestamp and record of 3rd event message.
Referring to Fig. 4, the embodiment of the present invention also proposed a kind of equipment, including:
Precision Time Protocol PTP ports, processor and computer-readable recording medium;
The PTP ports, for obtaining clock information from upstream equipment;
Instruction is stored with the computer-readable recording medium, when the instruction is by the computing device, is realized Following steps:
When being connected with the upstream equipment where upstream clock, when the port clock state of PTP ports is from clock or only to do From clock, and when the port clock state of the PTP ports of upstream equipment is master clock, control PTP ports obtain from upstream equipment Clock information, and recording clock information;
Local clock is synchronized to by upstream clock according to the clock information of acquisition;
When being disconnected suddenly with upstream equipment, local clock is repaiied according to the clock information recorded in synchronizing process Positive compensation.
Although disclosed herein embodiment as above, described content be only readily appreciate the present invention and use Embodiment, it is not limited to the present invention.Technical staff in any art of the present invention, taken off not departing from the present invention On the premise of the spirit and scope of dew, any modification and change, but the present invention can be carried out in the form and details of implementation Scope of patent protection, still should be subject to the scope of the claims as defined in the appended claims.

Claims (13)

  1. A kind of 1. clock synchronizing method, it is characterised in that including:
    Where equipment and upstream clock where local clock upstream equipment connection when, when equipment port clock state be from Clock is only done from clock, and when the port clock state of upstream equipment is master clock, equipment is obtained and recorded from upstream equipment For the clock information of synchronization, and local clock is synchronized to by upstream clock according to the clock information;
    When equipment and upstream equipment disconnect suddenly, clock information is modified to local clock according to recorded in synchronizing process Compensation.
  2. 2. clock synchronizing method according to claim 1, it is characterised in that the clock information includes being used to determine the time The a group or more of of difference are used for synchronous timestamp;
    Local clock is synchronized into upstream clock according to the clock information includes:
    Determine and record that correction time is poor first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp;
    The frequency offset correction amount of every group of timestamp in the first preset time relative to first group of timestamp is determined and recorded, and utilizes institute The frequency offset correction amount of acquisition obtains to correction time difference carries out secondary correction first corresponding to each group of timestamp and records the group The secondary correction time difference corresponding to timestamp;
    Every the second preset time according to last the secondary correction time difference obtained in second preset time to local Clock enters row clock synchronization.
  3. 3. clock synchronizing method according to claim 2, it is characterised in that
    It is described to determine that correction time difference includes first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp:
    Wherein, Fi is that correction time is poor first corresponding to i-th group of timestamp, and offseti is According to i-th of time difference determined by i-th group of timestamp.
  4. 4. clock synchronizing method according to claim 2, it is characterised in that the secondary correction time difference passes through with lower section Formula obtains:
    Every group of timestamp includes relative to the frequency offset correction amount of first group of timestamp in the first preset time of the determination:By first The one group of timestamp set in preset time is relative to the frequency offset correction amount of first group of timestamp as in first scheduled time Every group of timestamp relative to first group of timestamp frequency offset correction amount.
  5. 5. clock synchronizing method according to claim 2, it is characterised in that this method includes:
    It is more than default time difference threshold value when the secondary correction time difference corresponding to a certain group of timestamp in second preset time When, row clock synchronization is entered according to the secondary correction time difference corresponding to a certain group of timestamp.
  6. 6. clock synchronizing method according to claim 2, it is characterised in that
    Every group of timestamp includes relative to the frequency offset correction amount of first group of timestamp in the first preset time of the determination:
    Determine that i-th group of timestamp is relative to first group in the first preset time according to formula fi=(ti2-t12)-(ti1-t11) The frequency offset correction amount of timestamp;Wherein, i is the integer more than or equal to 1, and fi is i-th group of timestamp phase in the first preset time For the frequency offset correction amount of first group of timestamp, ti2 is to receive the first event message in i-th group of timestamp in the first preset time Timestamp, t12 is the timestamp for receiving the first event message in the first preset time in the 1st group of timestamp, and ti1 is first pre- If i-th group of timestamp middle and upper reaches equipment sends the timestamp of the first event message in the time, t11 is the 1st in the first preset time Group timestamp middle and upper reaches equipment sends the timestamp of the first event message.
  7. 7. clock synchronizing method according to claim 2, it is characterised in that
    It is described that secondary correction is carried out to the difference of correction time first of corresponding timestamp using the frequency offset correction amount obtained, obtain The secondary correction time difference includes corresponding to this group of timestamp:
    The secondary correction time difference corresponding to i-th group of timestamp in the first preset time is calculated according to formula CorFi=Fi-fi;
    Wherein i is integer more than or equal to 1, and CorFi is in the first preset time corresponding to i-th group of timestamp during secondary correction Between it is poor, Fi be the first preset time in obtain i-th group of timestamp corresponding to first correction time it is poor, fi is the first preset time Frequency offset correction amount corresponding to interior i-th group of timestamp.
  8. 8. clock synchronizing method according to claim 2, it is characterised in that
    Clock information includes recorded in the synchronizing process:Correction time first of every group of timestamp is poor, frequency offset correction amount,
    The clock information according to recorded in synchronizing process is modified compensation to local clock to be included:
    According to formula
    <mrow> <mi>T</mi> <mrow> <mo>(</mo> <mi>t</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mrow> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>1</mn> <mo>/</mo> <mi>T</mi> <mn>1</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>1</mn> </mrow> </mfrac> <mo>+</mo> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>2</mn> <mo>/</mo> <mi>T</mi> <mn>2</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>2</mn> </mrow> </mfrac> <mo>+</mo> <mn>...</mn> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mi>n</mi> <mo>/</mo> <mi>T</mi> <mi>n</mi> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mi>n</mi> </mrow> </mfrac> </mrow> <mi>n</mi> </mfrac> <mi>t</mi> <mo>+</mo> <mfrac> <mrow> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>1</mn> <mo>/</mo> <mi>T</mi> <mn>1</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>1</mn> </mrow> </mfrac> <mo>+</mo> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>2</mn> <mo>/</mo> <mi>T</mi> <mn>2</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>2</mn> </mrow> </mfrac> <mo>+</mo> <mn>...</mn> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mi>n</mi> <mo>/</mo> <mi>T</mi> <mi>n</mi> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mi>n</mi> </mrow> </mfrac> </mrow> <mi>n</mi> </mfrac> </mrow>
    Compensation is modified to the local clock;
    Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first the first preset time Frequency offset correction amount corresponding to interior m1 group timestamps, f (m2/T2) are that m2 groups timestamp is corresponding in the 2nd the first preset time Frequency offset correction amount ... ..., f (mn/Tn) is frequency offset correction amount corresponding to mn group timestamps in n-th first preset times, T1 is the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/ T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd first Correction time is poor first corresponding to m2 groups timestamp in preset time ... ..., and F (mn/Tn) is in n-th of first preset times Correction time is poor first corresponding to mn group timestamps, and n is the integer more than or equal to 1.
  9. 9. clock synchronizing method according to claim 2, it is characterised in that
    Clock information includes recorded in the synchronizing process:Correction time first of every group of timestamp is poor, frequency correction amount with And secondary correction time value,
    The clock information according to recorded in synchronizing process is modified compensation to local clock to be included:
    It is each according to what is obtained in synchronizing process every the 3rd preset time when the precision of local clock crystal oscillator is higher than predetermined value The secondary correction time difference corresponding to group timestamp, compensation is modified to the local clock with the order of inverted order;
    Otherwise, according to formula
    <mrow> <mi>T</mi> <mrow> <mo>(</mo> <mi>t</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mrow> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>1</mn> <mo>/</mo> <mi>T</mi> <mn>1</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>1</mn> </mrow> </mfrac> <mo>+</mo> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>2</mn> <mo>/</mo> <mi>T</mi> <mn>2</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>2</mn> </mrow> </mfrac> <mo>+</mo> <mn>...</mn> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mi>n</mi> <mo>/</mo> <mi>T</mi> <mi>n</mi> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mi>n</mi> </mrow> </mfrac> </mrow> <mi>n</mi> </mfrac> <mi>t</mi> <mo>+</mo> <mfrac> <mrow> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>1</mn> <mo>/</mo> <mi>T</mi> <mn>1</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>1</mn> </mrow> </mfrac> <mo>+</mo> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>2</mn> <mo>/</mo> <mi>T</mi> <mn>2</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>2</mn> </mrow> </mfrac> <mo>+</mo> <mn>...</mn> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mi>n</mi> <mo>/</mo> <mi>T</mi> <mi>n</mi> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mi>n</mi> </mrow> </mfrac> </mrow> <mi>n</mi> </mfrac> </mrow>
    Compensation is modified to the local clock;
    Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first the first preset time Frequency offset correction amount corresponding to interior m1 group timestamps, f (m2/T2) are that m2 groups timestamp is corresponding in the 2nd the first preset time Frequency offset correction amount ... ..., f (mn/Tn) is frequency offset correction amount corresponding to mn group timestamps in n-th first preset times, T1 is the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/ T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd first Correction time is poor first corresponding to m2 groups timestamp in preset time ... ..., and F (mn/Tn) is in n-th of first preset times Correction time is poor first corresponding to mn group timestamps, and n is the integer more than or equal to 1.
  10. A kind of 10. equipment, it is characterised in that including:
    Acquisition module, during for being connected with the upstream equipment where upstream clock, when port clock state is from clock or only to do From clock, and when the port clock state of upstream equipment is master clock, obtained from upstream equipment and record the clock for synchronization Information;
    Synchronization module, for local clock to be synchronized into upstream clock according to clock information;
    Compensating module, for when being disconnected suddenly with upstream equipment, according to the clock information recorded in synchronizing process to local Clock is modified compensation.
  11. 11. equipment according to claim 10, it is characterised in that the clock information includes being used to determine the one of the time difference Group or more than the one group timestamp for being used for synchronization;
    The synchronization module is specifically used for:
    Determine and record that correction time is poor first corresponding to this group of timestamp based on the time difference corresponding to each group of timestamp;
    The frequency offset correction amount of every group of timestamp in the first preset time relative to first group of timestamp is determined and recorded, and utilizes institute The frequency offset correction amount of acquisition obtains to correction time difference carries out secondary correction first corresponding to each group of timestamp and records the group The secondary correction time difference corresponding to timestamp;
    Every the second preset time according to last the secondary correction time difference obtained in second preset time to local Clock enters row clock synchronization.
  12. 12. equipment according to claim 10, it is characterised in that the compensating module is specifically used for:
    When being disconnected suddenly with upstream equipment,
    According to formula
    <mrow> <mi>T</mi> <mrow> <mo>(</mo> <mi>t</mi> <mo>)</mo> </mrow> <mo>=</mo> <mfrac> <mrow> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>1</mn> <mo>/</mo> <mi>T</mi> <mn>1</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>1</mn> </mrow> </mfrac> <mo>+</mo> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>2</mn> <mo>/</mo> <mi>T</mi> <mn>2</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>2</mn> </mrow> </mfrac> <mo>+</mo> <mn>...</mn> <mfrac> <mrow> <mi>f</mi> <mrow> <mo>(</mo> <mi>m</mi> <mi>n</mi> <mo>/</mo> <mi>T</mi> <mi>n</mi> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mi>n</mi> </mrow> </mfrac> </mrow> <mi>n</mi> </mfrac> <mi>t</mi> <mo>+</mo> <mfrac> <mrow> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>1</mn> <mo>/</mo> <mi>T</mi> <mn>1</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>1</mn> </mrow> </mfrac> <mo>+</mo> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mn>2</mn> <mo>/</mo> <mi>T</mi> <mn>2</mn> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mn>2</mn> </mrow> </mfrac> <mo>+</mo> <mn>...</mn> <mfrac> <mrow> <mi>F</mi> <mrow> <mo>(</mo> <mi>m</mi> <mi>n</mi> <mo>/</mo> <mi>T</mi> <mi>n</mi> <mo>)</mo> </mrow> </mrow> <mrow> <mi>T</mi> <mi>n</mi> </mrow> </mfrac> </mrow> <mi>n</mi> </mfrac> </mrow>
    Compensation is modified to the local clock;
    Wherein, T (t) is the correction-compensation amount of local clock, and t is the reference time, and f (m1/T1) is first the first preset time Frequency offset correction amount corresponding to interior m1 group timestamps, f (m2/T2) are that m2 groups timestamp is corresponding in the 2nd the first preset time Frequency offset correction amount ... ..., f (mn/Tn) is frequency offset correction amount corresponding to mn group timestamps in n-th first preset times, T1 is the 1st the first preset time, and T2 is the 2nd the first preset time ... ..., and Tn is n-th of first preset times, F (m1/ T1) for correction time is poor first corresponding to m1 group timestamps in the 1st the first preset time, F (m2/T2) is the 2nd first Correction time is poor first corresponding to m2 groups timestamp in preset time ... ..., and F (mn/Tn) is in n-th of first preset times Correction time is poor first corresponding to mn group timestamps, and n is the integer more than or equal to 1.
  13. A kind of 13. equipment, it is characterised in that including:Precision Time Protocol PTP ports, processor and computer-readable storage medium Matter;
    The PTP ports, for obtaining clock information from upstream equipment;
    Instruction is stored with the computer-readable recording medium, when the instruction is by the computing device, is realized as follows Step:
    When being connected with the upstream equipment where upstream clock, when the port clock state of PTP ports be from clock or only do from when Clock, and when the port clock state of the PTP ports of upstream equipment is master clock, control PTP ports obtain from upstream equipment to be used for Synchronous clock information, and recording clock information;
    Local clock is synchronized to by upstream clock according to clock information;
    When being disconnected suddenly with upstream equipment, benefit is modified to local clock according to the clock information recorded in synchronizing process Repay.
CN201710565171.2A 2017-07-12 2017-07-12 A kind of clock synchronizing method and equipment Active CN107395307B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710565171.2A CN107395307B (en) 2017-07-12 2017-07-12 A kind of clock synchronizing method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710565171.2A CN107395307B (en) 2017-07-12 2017-07-12 A kind of clock synchronizing method and equipment

Publications (2)

Publication Number Publication Date
CN107395307A true CN107395307A (en) 2017-11-24
CN107395307B CN107395307B (en) 2019-04-19

Family

ID=60339303

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710565171.2A Active CN107395307B (en) 2017-07-12 2017-07-12 A kind of clock synchronizing method and equipment

Country Status (1)

Country Link
CN (1) CN107395307B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114006674A (en) * 2021-12-31 2022-02-01 深圳市海清视讯科技有限公司 Time correction method, device, equipment and storage medium for attendance equipment
CN114765635A (en) * 2021-01-08 2022-07-19 腾讯科技(深圳)有限公司 Clock synchronization method, device and system, computer equipment and storage medium
WO2022257447A1 (en) * 2021-06-08 2022-12-15 中兴通讯股份有限公司 Time synchronization method, network device, and storage medium
WO2023226821A1 (en) * 2022-05-24 2023-11-30 华为技术有限公司 Clock synchronization method and apparatus, and serial number generation method and apparatus

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227246A (en) * 2008-01-28 2008-07-23 中兴通讯股份有限公司 Method and apparatus for master-salve clock synchronization
CN102088397A (en) * 2009-12-03 2011-06-08 中兴通讯股份有限公司 Communication network element and clock frequency correction system and method
US20130266306A1 (en) * 2011-02-08 2013-10-10 Mitsubishi Electric Corporation Time synchronization method for communication system, slave station apparatus, master station apparatus, control device, and program
CN103532692A (en) * 2013-10-18 2014-01-22 广州南方电力集团科技发展有限公司 Double-passage double-mode redundant optical fiber longitudinal difference power distribution terminal data synchronization method
CN103684648A (en) * 2012-09-21 2014-03-26 中兴通讯股份有限公司 Ring network node clock effectiveness judgment method and device
CN103905135A (en) * 2012-12-24 2014-07-02 中国移动通信集团公司 Method, device and system for realizing time synchronization
CN104798326A (en) * 2012-09-19 2015-07-22 阿尔卡特朗讯公司 Method for managing and maintaining an accurate distribution of time in a network when a failure occurs
CN106533600A (en) * 2016-10-14 2017-03-22 瑞斯康达科技发展股份有限公司 Clock synchronization method and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227246A (en) * 2008-01-28 2008-07-23 中兴通讯股份有限公司 Method and apparatus for master-salve clock synchronization
CN102088397A (en) * 2009-12-03 2011-06-08 中兴通讯股份有限公司 Communication network element and clock frequency correction system and method
US20130266306A1 (en) * 2011-02-08 2013-10-10 Mitsubishi Electric Corporation Time synchronization method for communication system, slave station apparatus, master station apparatus, control device, and program
CN104798326A (en) * 2012-09-19 2015-07-22 阿尔卡特朗讯公司 Method for managing and maintaining an accurate distribution of time in a network when a failure occurs
CN103684648A (en) * 2012-09-21 2014-03-26 中兴通讯股份有限公司 Ring network node clock effectiveness judgment method and device
CN103905135A (en) * 2012-12-24 2014-07-02 中国移动通信集团公司 Method, device and system for realizing time synchronization
CN103532692A (en) * 2013-10-18 2014-01-22 广州南方电力集团科技发展有限公司 Double-passage double-mode redundant optical fiber longitudinal difference power distribution terminal data synchronization method
CN106533600A (en) * 2016-10-14 2017-03-22 瑞斯康达科技发展股份有限公司 Clock synchronization method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114765635A (en) * 2021-01-08 2022-07-19 腾讯科技(深圳)有限公司 Clock synchronization method, device and system, computer equipment and storage medium
CN114765635B (en) * 2021-01-08 2024-02-20 腾讯科技(深圳)有限公司 Clock synchronization method, device, system, computer equipment and storage medium
WO2022257447A1 (en) * 2021-06-08 2022-12-15 中兴通讯股份有限公司 Time synchronization method, network device, and storage medium
CN114006674A (en) * 2021-12-31 2022-02-01 深圳市海清视讯科技有限公司 Time correction method, device, equipment and storage medium for attendance equipment
CN114006674B (en) * 2021-12-31 2022-04-01 深圳市海清视讯科技有限公司 Time correction method, device, equipment and storage medium for attendance equipment
WO2023226821A1 (en) * 2022-05-24 2023-11-30 华为技术有限公司 Clock synchronization method and apparatus, and serial number generation method and apparatus

Also Published As

Publication number Publication date
CN107395307B (en) 2019-04-19

Similar Documents

Publication Publication Date Title
CN106488550B (en) Determine the method and apparatus of terminal Yu base station clock time deviation
CN107395307A (en) A kind of clock synchronizing method and equipment
EP2595331A2 (en) Communication apparatus for performing time synchronization
CN102859941B (en) Renewal to the accumulative residence time being grouped in packet exchange communication network
KR101749202B1 (en) Method, apparatus, and system for generating timestamp
CN104994573B (en) Wireless communication system, its base station and mobile station, communication synchronization management method
CN102932905B (en) The realization method and system of 1588 link asymmetry time delays of automatic compensation
CN104836630B (en) IEEE1588 clock synchronization system and implementation method therefor
WO2017101528A1 (en) Method and device for clock link switching and base station
CN106357362B (en) A kind of method for synchronizing time, device and PTP system
CN102983927B (en) Time compensation method for master-slave clock timing based on IEEE 1588 protocol
CN110324889A (en) Clock synchronizing method, communication device and communication equipment
CN103168440B (en) Time path compensation method and device
CN103299575B (en) Transmitting device and transmission method
CN101834712A (en) Method for realizing accurate time synchronization by utilizing IEEE1588 protocol
EP2515591B1 (en) Method, apparatus and system for clock synchronization
CN103166792B (en) Line asymmetrical compensation method, equipment and system
US11411848B2 (en) Flexible ethernet latency measurement method and related device
CN108650050A (en) A kind of distributed network clock synchronous method
WO2020043181A1 (en) Clock synchronization method and apparatus, system, storage medium, and electronic device
CN105376043B (en) A kind of method for synchronizing time of double board systems
CN104993900A (en) Synchronous correction method based on IEEE1588 clock model
WO2012149751A1 (en) Method and related device for grading clock classes
KR20000076918A (en) Wireless network with user clock synchronization
CN106455042B (en) A kind of time synchronization between nodes method, wireless sensor network and its node

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
GR01 Patent grant
GR01 Patent grant