Patent Description:
In a communication network, the clock synchronization between different apparatus is very important for a collaboration and communication with each other. Clock distribution apparatus cascaded in the network distribute the clock signal received from clock source to each apparatus in the network, such as a terminal device.

One clock distribution apparatus may receive clock signals from more than one clock sources, or from one clock source through different transmission path in the communication network. Due to the state of the clock sources or the network, the priority of one clock signal being distributed may change, and another clock signal will be distributed instead.

During the switching of the clock signals to be distributed, there will be a jump of characteristic of the clock signal, such as phase/time. Downstream apparatuses, which are sensitive to the characteristic of the clock signal will be affected. Sometimes, these downstream apparatuses lose connection from the network during switching of the clock signal.

<CIT> discloses, according to a machine translated version on Espacenet, a clock reference seamless switching method and device. The seamless switching method comprises: acquiring clock priorities of a plurality of reference sources; selecting an optimal reference source and at least one auxiliary reference source according to the clock priorities; calculating the phase difference of the optimal reference source and the auxiliary reference source; providing a first phase locked loop synchronizing with the clock of the optimal reference source; and if the optimal reference source is detected to be abnormal, synchronizing the first phase locked loop with the clock of the auxiliary reference source, compensating the phase difference for the clock of the auxiliary reference source and then outputting the clock. The phase difference of the optimal reference source and the auxiliary reference source is calculated, when the optimal reference source is abnormal, the reference source is switched to the auxiliary reference source, and the clock of the auxiliary reference source compensated with the phase difference is output, so that phase jitter is avoided when the optimal reference source is replaced by the auxiliary reference source, and the stability of communication is ensured.

<CIT> discloses a time synchronization method, wherein the method includes: a slave device detecting whether time synchronization can be performed via a primary link between a master device and the slave device; and when time synchronization cannot be performed via the primary link between the master device and the slave device, the slave device using a backup link to perform time synchronization.

Certain aspects of the present disclosure and their embodiments may provide solutions to these or other challenges. There are, proposed herein, various embodiments which address one or more of the issues disclosed herein.

A first aspect of the present disclosure provides a method performed by a clock distribution apparatus, comprising: receiving a first clock signal; receiving a second clock signal; calculating an offset difference between the first clock signal and the second clock signal; compensating the second clock signal, based on the offset difference; and outputting a clock signal, based on the compensated second clock signal. The first clock signal is from a third clock source through a first transmission path in a network; the second clock signal is from the third clock source through a second transmission path in the network. The method may further comprise: determining whether a network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network. Compensating the second clock signal, based on the offset difference comprises: compensating a local clock of the clock distribution apparatus with the offset difference, when it is determined that the network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network.

In embodiments of the present disclosure, it is determined that the network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network, when the first transmission path in the network is not valid and the second transmission path in the network is stable during a predetermined time period.

In embodiments of the present disclosure, the method may further comprise: comparing the offset difference with a predetermined threshold. The local clock is compensated with the offset difference, when it is determined that the network connection between the third clock source and the clock distribution apparatus is switched from the first network transmission path to the second network transmission path and the offset difference is bigger than the predetermined threshold.

In embodiments of the present disclosure, calculating the offset difference between the first clock signal and the second clock signal comprises: obtaining a first offset of the first clock signal, and a second offset of the second clock signal; and obtaining the offset difference, based on the first offset and the second offset.

In embodiments of the present disclosure, the method further comprises: reducing the offset difference by a predefined value or a predefined rate. Compensating the second clock signal with the offset difference comprises: compensating the second clock signal with the reduced offset difference.

In embodiments of the present disclosure, the predefined value is configurable.

In embodiments of the present disclosure, the offset difference comprises: a phase offset difference.

In embodiments of the present disclosure, the clock distribution apparatus comprises: a boundary clock apparatus.

In embodiments of the present disclosure, the boundary clock apparatus comprises: a Partial-Support Telecom Boundary Clock (T-BC-P) apparatus.

In embodiments of the present disclosure, the first clock source comprises: a Grandmaster (GM) apparatus. The second clock source comprises: a Grandmaster (GM) apparatus.

In embodiments of the present disclosure, the clock distribution apparatus determines to switch from the first clock source to the second clock source, based on a Best Master Clock Algorithm (BMCA).

A second aspect of the present disclosure provides a clock distribution apparatus, comprising: a processor; and a memory, containing instructions executable by the processor. The clock distribution apparatus is operative to: receive a first clock signal; receive a second clock signal; calculate an offset difference between the first clock signal and the second clock signal; compensate the second clock signal, based on the offset difference; and output a clock signal, based on the compensated second clock signal. The first clock signal is from a third clock source through a first transmission path in a network; the second clock signal is from the third clock source through a second transmission path in the network. The clock distribution apparatus is further configured to: determine whether a network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network. Compensate the second clock signal, based on the offset difference comprises: compensating a local of the clock distribution apparatus with the offset difference, when it is determined that the network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network.

In embodiments of the present disclosure, the clock distribution apparatus is further operative to implement any method above mentioned.

A third aspect of the present disclosure provides a clock distribution apparatus, comprising: a PTP packet receiver and sender, configured to receive a first clock signal, and receive a second clock signal; an offset difference calculator, configured to calculate an offset difference between the first clock signal and the second clock signal; an offset difference compensator, configured to compensate the second clock signal, based on the offset difference. The PTP packet receiver and sender is further configured to output a clock signal, based on the compensated second clock signal.

In embodiments of the present disclosure, the clock distribution apparatus is further configured to implement any method above mentioned.

A fourth aspect of the present disclosure provides a computer readable storage medium having a computer program stored thereon, the computer program executable by a device to cause the device to carry out any method above mentioned.

According to embodiments of the present disclosure, a switching of the clock signal, due to a change a transmission path will be smoothly handled by the clock distribution apparatus. The influence to the downstream apparatus will be reduced.

Through the more detailed description of some embodiments of the present disclosure in the accompanying drawings, the above and other objects, features and advantages of the present disclosure will become more apparent, wherein the same reference generally refers to the same components in the embodiments of the present disclosure.

All references to alan/the element, apparatus, component, means, step, etc. are to be interpreted openly as referring to at least one instance of the element, apparatus, component, means, step, etc., unless explicitly stated otherwise.

As used herein, the term "network", or "communication network/ system" refers to a network/ system following any suitable communication standards, such as new radio (NR), long term evolution (LTE), LTE-Advanced, wideband code division multiple access (WCDMA), high-speed packet access (HSPA), and so on. Furthermore, the communications between a terminal device and a network node in the communication network may be performed according to any suitable generation communication protocols, including, but not limited to, the first generation (<NUM>), the second generation (<NUM>), <NUM>, <NUM>, the third generation (<NUM>), <NUM>, <NUM>, <NUM> communication protocols, and/or any other protocols either currently known or to be developed in the future.

The term "apparatus" herein may refer to any end device that can access a communication network and receive services therefrom. By way of example and not limitation, the apparatus comprises a terminal device, and further the terminal device may refer to a user equipment (UE), or other suitable devices. The UE may be, for example, a subscriber station, a portable subscriber station, a mobile station (MS) or an access terminal (AT). The terminal device may include, but not limited to, portable computers, image capture terminal devices such as digital cameras, gaming terminal devices, music storage and playback appliances, a mobile phone, a cellular phone, a smart phone, a tablet, a wearable device, a personal digital assistant (PDA), a vehicle, and the like.

As yet another specific example, in an Internet of things (IoT) scenario, a terminal device may also be called an IoT device and represent a machine or other device that performs monitoring, sensing and/or measurements etc., and transmits the results of such monitoring, sensing and/or measurements etc. to another terminal device and/or a network equipment. The terminal device may in this case be a machine-to-machine (M2M) device, which may in a 3rd generation partnership project (3GPP) context be referred to as a machine-type communication (MTC) device.

As one particular example, the terminal device may be a UE implementing the 3GPP narrow band Internet of things (NB-IoT) standard. Particular examples of such machines or devices are sensors, metering devices such as power meters, industrial machinery, or home or personal appliances, e.g. refrigerators, televisions, personal wearables such as watches etc. In other scenarios, a terminal device may represent a vehicle or other equipment, for example, a medical instrument that is capable of monitoring, sensing and/or reporting etc. on its operational status or other functions associated with its operation.

<FIG> is an exemplary block diagram showing a network, in which a method according to embodiments of the present disclosure is implemented.

As shown in <FIG>, a clock distribution apparatus <NUM> may receive clock signals from more than one clock sources, wherein one clock signal from the clock source with highest priority is distributed to downstream apparatus <NUM>. Due to the state of the clock source or the network, the priority may change, and another clock signal will be distributed.

For example, the clock distribution apparatus <NUM> may receive a first clock signal from the first clock source <NUM>, through the first transmission path <NUM> in a network, and may receive a second clock signal from the second clock source <NUM>, through the second transmission path <NUM> in the network. As an example, the priority may change from the first clock source <NUM> to the second clock source <NUM>. Thus, the second clock signal will replace the first clock signal.

The clock distribution apparatus <NUM> receives a first clock signal from the third clock source <NUM>, through the first transmission path <NUM> in a network, and receives a second clock signal from the third clock source <NUM>, through the second transmission path <NUM> in the network. As an example, a network connection between the third clock source <NUM> and the clock distribution apparatus <NUM> may be switched from the first transmission path <NUM> in the network to the second transmission path <NUM> in the network. Then, the second clock signal will replace the first clock signal.

During the switching of the clock signals to be distributed, there will be a jump of characteristic of the clock signal, such as phase/time. Downstream apparatus <NUM> may be affected. When the downstream apparatus <NUM> is sensitive to the characteristic of the clock signal, it may lose connection from the network during switching of the clock signal.

More specific example is assumed below for a more illustrative description, but it is not limitation to the present disclosure.

A specific architecture according to ITU-T G. <NUM> (<NUM>/<NUM>) profile may be taken as example, wherein ITU-T refers to International Telecommunication Union- Telecommunication Standardization Sector. The distribution of phase/time with precision time support (PTS) from the network is allowed in such specific architecture. The profile bases on the PTP defined in IEEE <NUM>-<NUM>, and works in the unicast mode only. IEEE refers to Institute of Electrical and Electronics Engineers.

According to ITU-T G. <NUM> (<NUM>/<NUM>) profile, a clock distribution apparatus, such as Partial-Support Telecom Boundary Clock (T-BC-P) is a boundary clock with multiple PTP ports connecting to multiple clock sources, such as Grandmaster (GM). One of these ports may be Slave, and other ports may have a state of "Passive" or "Master", which is decide according to BMCA (best master clock algorithm). The Slave port will immediately calculate the phase/time which is distributed by upstream GM, and the phase/time will distribute to downstream clock via the Master ports. If the T-BC-P gets a new GM with higher priority via another PTP port, it will be new Slave port, and the local phase/time will be adjusted according to new GM, then this new phase/time will pass to downstream clock.

The delay on the PTP packet transmission path is a key factor that will affect the phase calculation. The second GM with higher priority will become active master immediately according to the BMCA decision. Compared with the last GM, there will involve different path delay, it will cause the phase gap. This phase gap distributes to the downstream when Slave ports switchover, and the phase jump can be seen on downstream clock. If the downstream device is sensitive to the phase/time. This may cause a problem which disturbs the business.

See <FIG>, firstly, the clock distribution apparatus <NUM> is synchronizing to the first clock source <NUM> and getting the phase/time from the first clock source <NUM>. It is assumed that there is 20ns delay introduced on the first network transmission path <NUM>. Such delay may cause a phase offset of a clock signal in the clock distribution apparatus <NUM>, which is also 20ns.

Then, the second clock source <NUM> with higher priority builds up the connection with the clock distribution apparatus <NUM>, the clock distribution apparatus <NUM> will switch to second clock source <NUM> directly according to a section of "<NUM> Alternate BMCA, telecom slave model and master selection process" which is defined in a "Rec. <NUM> (<NUM>/<NUM>)".

It is assumed that there is another delay on the second network transmission path <NUM>, which is 2000ns. Here a phase gap happens, due to the first clock source <NUM> and the second clock source <NUM>. The clock distribution apparatus <NUM> will have a 1980ns phase jump on local phase/time and will distribute it to the downstream apparatus <NUM> immediately.

The downstream apparatus <NUM> will be introduced with a 1980ns phase jump, even it is synchronized to a clock source, through the clock distribution apparatus <NUM> all the time.

The 1980ns phase jump might be too large for the downstream apparatus <NUM>, thus, the operation of the downstream apparatus <NUM> might be affected. Particularly, the downstream apparatus <NUM> might lose connection from the network during switching of the clock signal.

As shown in <FIG>, when the clock source (such as the third clock source <NUM>) is not changed, a delay variation on the PTP packet transmission path is still a key factor that will affect the phase calculation. If the transmission path is suddenly changed (e.g. from the first transmission path <NUM> to the second transmission path <NUM>), for example due to a switch to any backup network devices, the delay variation will suddenly change according to the new transmission path. And the delay variation value will take effect at the clock phase calculation. For example, an offset of phase between a clock source and the clock distribution apparatus will change suddenly and greatly. The clock will distribute the phase with such big changed value to its downstream. If the downstream device is sensitive to the phase/time. This may also cause a problem which disturbs the business.

<FIG> shows only one clock distribution apparatuses <NUM>, however, it should be understood that there may be more than one clock distribution apparatuses in serial, between a downstream apparatus <NUM> and a clock source.

<FIG> is an exemplary flow chart showing a method performed at the clock distribution apparatus according to embodiments of the present disclosure.

As shown in <FIG>, a method performed at a clock distribution apparatus comprises: S201, receiving a first clock signal; S202, receiving a second clock signal; S203, calculating an offset difference between the first clock signal and the second clock signal; S204, compensating the second clock signal, based on the offset difference; and S206, outputting a clock signal, based on the compensated second clock signal.

According to embodiments of the present disclosure, the second clock signal is not directly transferred by the clock distribution apparatuses <NUM>. The offset difference between the first clock signal and the second clock signal is calculated and used to compensate the second clock signal. Then, the compensated second clock signal is transferred to the downstream apparatus <NUM>. The switching of the clock signal will be smoother for the downstream apparatus <NUM>.

Namely, the phase jump may be detected and compensated in the clock distribution apparatuses <NUM>. The downstream apparatus <NUM> may not be affected by the phase jump.

According to above description, this disclosure raises a method to compensate the phase offset in the PTP packet streams dynamically and continuously base on the active one. It eliminates the influence of phase jump caused by switchover from one packet stream (GM) to another stream (GM), or from one transmission path to another transmission path. Here we give a detailed description.

<FIG> is a block diagram showing an output message for the second clock signal.

In embodiments not part of the invention, the first clock signal may be from a first clock source <NUM>; and the second clock signal may be from a second clock source <NUM>.

As shown in <FIG>, the method may further comprise: step S205, determining to switch from the first clock source to the second clock source. In embodiments not part of the invention, the clock distribution apparatus may determine to switch from the first clock source to the second clock source, based on a Best Master Clock Algorithm (BMCA).

In embodiments not part of the invention, the step S204, compensating the second clock signal, based on the offset difference may comprise: S2041, generating an output message including information about the second clock signal and the offset difference. The step S206, outputting a clock signal, based on the compensated second clock signal may comprise: S2061, outputting the output message.

According to embodiments not part of the invention, the second clock signal itself, which needs to be transferred by the clock distribution apparatuses <NUM>, is not changed. Only an extra information about the offset difference is added. Thus, the compatibility of the embodiments of the present disclosure is improved, without amending existing transferring procedure of the clock signal in the clock distribution apparatuses <NUM>.

<FIG> is a block diagram showing an output message for the second clock signal. As shown in <FIG>, in embodiments not part of the invention, the output message comprises: a Precision Time Protocol (PTP) message <NUM>. The offset difference <NUM> is included in a Correction Field <NUM> of the PTP message <NUM>.

In embodiments not part of the invention, the information about the second clock signal (not shown in <FIG>) indicates a phase value of the second clock signal. The phase value may also be referred as a time value, a time stamp value, etc..

According to embodiments not part of the invention, the PTP is applied, and information about the offset difference is added in a Correction Field <NUM> of the PTP message <NUM>. No extra processing or resource are needed.

The PTP message <NUM> may comprises any one of: a Sync message, a Follow_Up message, a Delay _Resp message, etc. Sync refers to Synchronization, and Resp refers to response.

<FIG> is an exemplary time line showing a manner to obtain an offset. The offset is phase offset caused by the transmission delay. In such situation, the offset difference comprises: a phase offset difference, namely, the phase gap caused by the different transmission delays on different transmission path.

As shown in <FIG>, the first clock source <NUM> sends a message M1, such as a Sync message, at time T1. The clock distribution apparatus <NUM> receives the message M1 from the first clock source <NUM>, and records a time stamp T2. The clock distribution apparatus <NUM> may obtain the time stamp T1 from the message M1, or from another message M2, such as a Follow_Up message. Then, the clock distribution apparatus <NUM> sends a message M3, such as a Delay _Req message, at time T3. Req refers to request. The first clock source <NUM> receives the message M3 at time T4. The first clock source <NUM> sends another message M4, such as a Delay_Resp message to inform the clock distribution apparatus <NUM> about the time stamp T4. The transmission delay may be calculated by: (T-ms + T-sm)/<NUM> = ((T2 - T1) + (T4 - T3))/<NUM>, for example when the transmission delay from the first clock source <NUM> to the clock distribution apparatus <NUM> and the transmission delay from the clock distribution apparatus <NUM> to the first clock source <NUM> can be treated as the same.

It should be understood that another parameter affecting the phase offset may also be calculated according to <FIG>. The parameter (T-of) is an error/offset between a local DateTime value of the clock distribution apparatus <NUM>, and a DateTime value of the first clock source <NUM>. For example, in the same actual time point, the local DateTime value of the clock distribution apparatus may be "<NUM>:<NUM> am" (TCS), however, the DateTime value of the first clock source <NUM> may be "<NUM>:<NUM> am (TCD)". The error/offset of the DateTime values may be calculated by: (T-sm - T-ms)/<NUM> = ((T4 - T3) - (T2 - T1))/<NUM>. However, such error/offset of the DateTime values may be eliminated easily by adjusting the local DateTime value of the clock distribution apparatus <NUM>. Therefore, the influence of such error/offset of the DateTime values to the phase offset will be eliminated.

In the <FIG>, T1, T4 are underlined, as they have value recorded by the first clock source <NUM> under the clock of the first clock source103. T2, T3 are not underlined, as they have value recorded by the clock distribution apparatus <NUM> under the local clock of the clock distribution apparatus.

Therefore, the clock distribution apparatus <NUM> obtains a first phase offset of the first clock signal, caused by the transmission delay. With the same manner, the clock distribution apparatus <NUM> obtains a second phase offset of the second clock signal.

Such manner may also be named as delay request-response mechanism. It should be understood, any other manner, such as peer delay mechanism, may also be applied, as long as it can obtain a transmission delay on the transmission path.

In embodiments of the present disclosure, the first clock signal is from a third clock source <NUM> through a first transmission path <NUM> in a network; the second clock signal is from the third clock source <NUM> through a second transmission path <NUM> in the network.

The transmission delay (T-delay-down) from the first clock source <NUM> to the clock distribution apparatus <NUM> and the transmission delay (T-delay-up) from the clock distribution apparatus <NUM> to the first clock source <NUM> may have too big difference to be treated as the same.

There may be a relationship between any Tcs and corresponding TCD: TCD = TCS + T-of.

Thus, T2 = T1 + T-of + T-delay-down; T4 = T3 - T-of + T-delay-up.

Thus, T-of = (T2 - T1 - T4 + T3)/<NUM> + (T-delay-up - T-delay-down)/<NUM>.

As an example without limitation, as to the first transmission path <NUM>, T-delay-down = T-delay-up = 20ns. However, as to the second transmission path <NUM>, T-delay-down= 10ns, T-delay-up = 2000ns.

When the first transmission path <NUM> is down due to node restart or release upgrade, the PTP packets stream from the first clock source <NUM> will switch to the second transmission path <NUM>. But the second transmission path <NUM> has the different network load in downstream and upstream, so the T-delay-down ≠ T-delay-up. This delay will immediately take effect on the passed PTP packets.

The clock distribution apparatus <NUM> may calibrate its phase/time to the first clock source <NUM> via the second transmission path <NUM>, and will involve an about 1000ns phase gap (the difference of T-of of different transmission paths). The phase gap will be distributed to its downstream, such as downstream apparatus <NUM> as shown in <FIG>.

The downstream apparatus <NUM> will be effected with such phase jump, even it is synchronizing to the first clock source <NUM> all the time.

<FIG> is another exemplary flow chart showing exemplary substeps of method as shown in <FIG>.

As shown in <FIG>, the method may further comprise: step S205', determining whether a network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network.

In embodiments of the present disclosure, the step S204, compensating the second clock signal, based on the offset difference may comprise: step S2042, compensating a local clock with the offset difference, when it is determined that the network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network.

According to embodiments of the present disclosure, the difference between T-of in different transmission path (such as about 1000ns phase gap described above) will be calculated and used to compensate the local clock of the clock distribution apparatus <NUM>. Namely, each "TCD" recorded by the clock distribution apparatus <NUM> will be adjusted accordingly thereafter.

For example, the local clock is adjusted by 1000ns (plus or minus). Then, the adjusted value is record in field "originTimestamp" in PTP packet. The processing procedure is just the same as before being adjusted. The downstream apparatus feels no change of "offset".

Optionally, the method may further comprise: step S207, comparing the offset difference with a predetermined threshold. The local clock is compensated with the offset difference, when it is determined that the network connection between the third clock source and the clock distribution apparatus is switched from the first network transmission path to the second network transmission path and the offset difference is bigger than the predetermined threshold.

According to embodiments of the present disclosure, the local clock is compensated with the offset difference when the offset difference is bigger than the predetermined threshold, so as to ignore minor offset difference which may be acceptable to the downstream apparatuses. Any offset difference exceeding such predetermined threshold may be compensated, such as to be zero.

Further, this threshold may be considered as a standard, an offset difference exceeding this threshold only needs to be compensated to be equal to or less than this threshold, rather than to be compensated to be zero. The requirement about calculation or the capability for the clock distribution apparatus to make compensation may be reduced. This predetermined compensation threshold may also be configured by any authorized user.

Further, according to embodiments of the present disclosure, the local clock may be compensated with the offset difference when the offset difference is less than another predetermined upper threshold for compensation, so as not to go beyond an adjustment capability of the local clock of the clock distribution apparatus. This predetermined upper threshold for compensation may also be configured by any authorized user. Particularly, the upper threshold may be a rather big value, and when this upper threshold is exceeded, it may be considered that failures occurs in transmission path or any relating apparatus in network (including the clock distribution apparatus itself). This predetermined upper threshold for compensation may also be configured according to a capability of the local clock or by any authorized user.

Namely, according to embodiments of the present disclosure, the local clock may be compensated with the offset difference when the offset difference is bigger than a predetermined threshold, and less than another predetermined upper threshold for compensation.

<FIG> is another exemplary flow chart showing exemplary substeps of method as shown in <FIG>. As shown in <FIG>, calculating the offset difference between the first clock signal and the second clock signal comprises: S601, obtaining a first offset of the first clock signal, and a second offset of the second clock signal; and S602, obtaining the offset difference, based on the first offset and the second offset.

In step S601, any manner, such as delay request-response mechanism, peer delay mechanism, etc., may be applied. In step S602, a simple numerical difference may be obtained. For example, an offset difference may equal to (the second offset - the first offset). When the first offset is 20ns, the second offset is 2000ns, the offset difference may be 1980ns. A plus sign of the offset difference may mean the delay of the second clock signal is larger than the first clock signal.

According to embodiments to the present disclosure, a simple numerical difference may be applied for the offset difference. It is convenient for the downstream apparatus <NUM> to analyze the out message received from the clock distribution apparatus <NUM>.

<FIG> is another exemplary flow chart showing exemplary substeps of method as shown in <FIG>. As shown in <FIG>, calculating the offset difference between the first clock signal and the second clock signal comprises: S701, obtaining a first offset of the first clock signal, and a second offset of the second clock signal; S702, obtaining a candidate offset difference, based on the first offset and the second offset; S703, storing the candidate offset difference; S704, obtaining a plurality of stored candidate offset differences; S705, obtaining a mean value, or a last value of the stored candidate offsets, as the offset difference to compensate the second clock signal, when the plurality of candidate offset differences are located in a predetermined scope; and S706, returning to a step of obtaining a first offset of the first clock signal, and a second offset of the second clock signal, when the plurality of candidate offset differences are not located in the predetermined scope.

According to the embodiments of the present disclosure, the offset difference may be calculated repeatedly, until that a value is stabilized, namely, when the first offset and the second offset is stabilized. The influence of the fluctuations of the first network transmission path <NUM> and the second network transmission path <NUM> may be reduced.

<FIG> is an exemplary flow chart showing other steps of method as shown in <FIG>. As shown in <FIG>, the method further comprises: S801, reducing the offset difference by a predefined value or a predefined rate. Accordingly, compensating the second clock signal with the offset difference comprises: compensating the second clock signal with the reduced offset difference.

According to embodiments of the present disclosure, the offset difference included in the output message may be reduced to zero, step by step. A smooth switching from the first clock signal to the second clock signal may be achieved during a configurable time period. The operation of the downstream apparatus <NUM> will not be affected, during or after the switching.

For example, firstly, 1980ns may be applied as the offset difference. Then, after a configurable period (e.g. one minute), 1880ns is applied. In such manner, the offset difference is reduced to zero, step by step.

<FIG> is a block diagram showing a clock distribution apparatus in accordance with embodiments of the present disclosure. As shown in <FIG>, the clock distribution apparatus, comprises a processor <NUM>; and a memory <NUM>, containing instructions executable by the processor <NUM>. The clock distribution apparatus <NUM> is operative to: receive (S201) a first clock signal from a first clock source; receive (S202) a second clock signal from a second clock source; calculate (S203) an offset difference between the first clock signal and the second clock signal; compensate (S204) the second clock signal with the offset difference; determine (S205) to switch from the first clock source to the second clock source; and output (S206) the compensated second clock signal.

The processor <NUM> may be any kind of processing component, such as one or more microprocessor or microcontrollers, as well as other digital hardware, which may include digital signal processors (DSPs), special-purpose digital logic, and the like. The memory <NUM> may be any kind of storage component, such as read-only memory (ROM), random-access memory, cache memory, flash memory devices, optical storage devices, etc..

In embodiments of the present disclosure, the clock distribution apparatus <NUM> is further operative to implement any method above mentioned, such as shown in <FIG>, <FIG>, <FIG>.

For example, the clock distribution apparatus may be further operative to:
generate (S2041) an output message including information about the second clock signal and the offset difference; and output (S2061) the output message.

For example, the clock distribution apparatus is further operative to: obtain (S601) a first offset of the first clock signal, and a second offset of the second clock signal; and obtain (S602) the offset difference, based on the first offset and the second offset.

For example, the clock distribution apparatus is further operative to: obtain (S701) a first offset of the first clock signal, and a second offset of the second clock signal; obtain (S702) a candidate offset difference, based on the first offset and the second offset; store (S703) the candidate offset difference; obtain (S704) a plurality of stored candidate offset differences; obtain (S705) a mean value, or a last value of the stored candidate offsets, as the offset difference to compensate the second clock signal, when the plurality of candidate offset differences are located in a predetermined scope; and return (S706) to a step of obtaining a first offset of the first clock signal, and a second offset of the second clock signal, when the plurality of candidate offset differences are not located in the predetermined scope.

For example, the clock distribution apparatus is further operative to: reduce (S801) the offset difference by a predefined value or a predefined rate; and compensate the second clock signal with the reduced offset difference.

According to embodiments of the present disclosure, the second clock signal is not directly transferred by the clock distribution apparatuses <NUM>. The offset difference between the first clock signal and the second clock signal is calculated and used to compensate the second clock signal. Then, the compensated second clock signal is transferred to the downstream apparatus <NUM>.

For example, the phase jump may be detected and compensated in the clock distribution apparatuses <NUM>. The downstream apparatus <NUM> may not be affected by the phase jump.

<FIG> is an exemplary flow chart showing a method performed in the clock distribution apparatus in accordance with embodiments of the present disclosure.

As shown in <FIG>, in step S901, the clock distribution apparatus receives messages from a new master (namely, a new clock source).

In step S902, the clock distribution apparatus determines whether a best master already exist. If yes, the clock distribution apparatus performs the step S903. If no, the clock distribution apparatus performs the step S907.

In step S903, the clock distribution apparatus calculates a phase offset difference between the existing best master and the new master. Namely, the existing best master is the first clock source, and the new master is the second clock source.

In step S904, it is determined whether the phase offset difference is ready or not. If yes, the step S905 is performed. If no, the clock distribution apparatus returns to step S903.

In step S905, the phase offset about the new master is compensated, namely, the second clock signal from the new master is compensated with the phase offset difference.

In step S906, it is determined whether the compensation is finished or not. If yes, the step S907 is performed. If no, the clock distribution apparatus returns to step S905.

In step S907, the clock distribution apparatus records the new master as joining the BMCA, namely, as a candidate for the best master.

In step S <NUM>, it is determined whether the compensation is finished or not. If yes, the step S909 is performed. If no, the clock distribution apparatus jumps to step S9012.

In step S909, the clock distribution apparatus switches to the new master.

In step S9010, it is determined whether the phase recovery is enabled or not. If yes, the step S9011 is performed. If no, the clock distribution apparatus jumps to step S9012.

In step S9011, the clock distribution apparatus smoothly removes the compensation for the phase offset, namely, recedes the phase offset difference by a predefined value or a predefined rate.

According to embodiments of the present disclosure, smooth switching to the new master (clock source) may be achieved, no matter the best master is already exists or not.

<FIG> is another exemplary flow chart showing a method performed in the clock distribution apparatus in accordance with embodiments of the present disclosure.

In step S1001, the clock distribution apparatus <NUM> may receive clock signals from the third clock source <NUM>, including the first clock signal from through the first transmission path <NUM>, and the second clock signal from through the second transmission path <NUM>.

In step S1002, the clock distribution apparatus <NUM> may calculate phase/time parameters relating to the first clock signal and the second clock signal.

In step <NUM>, the clock distribution apparatus <NUM> may calculate the phase difference between the first clock signal through the first transmission path <NUM> and the second clock signal through the second transmission path <NUM>.

In step S1004, the clock distribution apparatus <NUM> may determine whether the offset difference exceed threshold (such as the predetermined threshold above described). If "Yes", then the clock distribution apparatus <NUM> may go to step S1005. If "No", then the clock distribution apparatus <NUM> may go to step S1010. Particularly, an absolute value of the offset difference may be used to be compared with a positive threshold, when it is possible for the offset difference to be positive or negative. If the absolute value of the offset difference is bigger than the positive threshold (such as the above predetermined threshold), it is considered that the clock distribution apparatus <NUM> needs to compensate the local clock. Further, another predetermined upper threshold above described may also be utilized, even it is not shown in <FIG>.

In step S1005, a timer (such as a simulate timer) starts. Before the timer expires, the clock distribution apparatus <NUM> should check the phase offset is stable or not, but not apply the phase offset difference to the local clock, and/or on the output.

In embodiments of the present disclosure, if the phase offset difference is flapping (jumping in and out of the range of the thresholds, or jumping up and down comparing to the predetermined threshold). The timer should be restarted.

In step S1006, the clock distribution apparatus <NUM> may determine whether the timer expires. If yes, then the clock distribution apparatus <NUM> may go to step S1007.

In step S1007, the clock distribution apparatus <NUM> may compensate the local phase/time, based on the phase offset difference.

In step S1008, the clock distribution apparatus <NUM> may determine whether the phase recovery is enabled or not. If yes, the step S1009 is performed. If no, the clock distribution apparatus <NUM> jumps to step S1010.

In step S1009, the clock distribution apparatus <NUM> smoothly removes the compensation for the local clock. Namely, the clock distribution apparatus <NUM> recedes the value of phase offset difference for compensation by a predefined value or a predefined rate. For example, the 1000ns offset difference may be reduced by 100ns per minute.

In step S1010, the clock distribution apparatus <NUM> output a clock signal, with/without the compensation based on the offset difference.

<FIG> is a block diagram showing function units of a clock distribution apparatus in accordance with embodiments of the present disclosure. As shown in <FIG>, the clock distribution apparatus <NUM> may comprise: an offset difference calculator <NUM>, an offset difference compensator <NUM>. The offset difference calculator <NUM> may be configured to calculate (S203) an offset difference between the first clock signal and the second clock signal. The offset difference compensator <NUM> may be configured to compensate (S204) the second clock signal with the offset difference.

The offset difference calculator <NUM> is a main function and triggers another module to work. It is also the interface interact with the PTP Algorithm.

The offset difference calculator <NUM> may obtain each PTP packets timestamp information, and calculate the phase offset.

The offset difference compensator <NUM> may be triggered by timer expired event. The offset difference compensator <NUM> may compensate the phase offset on local clock, and local clock will distribute the compensated phase to the downstream.

The first clock signal and the second clock signal may be firstly received by the PTP packet receiver and sender <NUM> via any port <NUM>. Namely, the PTP packet receiver and sender <NUM> may be configured to receive (S201) a first clock signal from a first clock source; and receive (S202) a second clock signal from a second clock source.

The PTP protocol stack <NUM> is configured to implement PTP protocol. For example, the PTP protocol stack <NUM> is configured to determine (S205) to switch from the first clock source to the second clock source. And then, the PTP packet receiver and sender <NUM> is further configured to output (S206) the compensated second clock signal.

The clock distribution apparatus <NUM> may further comprise: an offset difference reducer <NUM>, configured to reduce (S801) the offset difference by a predefined value or a predefined rate.

The clock distribution apparatus <NUM> may further comprise: a threshold module <NUM>. The threshold module <NUM> may obtain the phase offset difference from Phase Offset difference Calculator, and then check whether the Phase Offset difference exceeds the threshold(s) or not. For example, the threshold module <NUM> may check whether the Phase Offset is bigger than a predetermined threshold above described, and/or whether the Phase Offset is less than another predetermined upper threshold above described. The threshold module <NUM> may receive the threshold configuration for defining the threshold value(s).

The clock distribution apparatus <NUM> may further comprise: a timer <NUM>. The timer <NUM> may be triggered by Threshold module <NUM>. Before the timer <NUM> expired, the local clock should check whether the phase offset is stable or not, but not apply the phase offset on the output (namely, not compensate the local clock).

These function unit may have conventional arrangement in the field of electronics, electrical devices and/or electronic devices and may include, for example, electrical and/or electronic circuitry, devices, modules, processors, memories, logic solid state and/or discrete devices, computer programs or instructions for carrying out respective tasks, procedures, computations, outputs, and/or displaying functions, and so on, as such as those that are described herein.

As to the architecture according to ITU-T G. <NUM> profile, if there exists PTP Slave port, the other non-slave PTP ports monitors the GM (if it exists) phase/time via the PTP packets. The phase offset calculator and compensator will apply to the non-slave PTP ports. If one of the PTP ports connects to the new GM with higher priority, the T-BC-P will not switchover to the new GM immediately. Firstly, this PTP port monitors phase/time via the PTP packets, then the phase offset calculator and compensator figure out the phase gap and compensates the offset into the packets stream. Finally, the BMCA will be triggered and the PTP port will become Slave. As the result, the downstream will never see the phase jump suddenly, just it will get a smooth curve of the phase.

Take T-BC-P for example, one PTP port should be slave, it now locked to a GM. And one or more regular PTP ports could also be configured for backup purpose. But they will be non-slave state and wait for the result of calculator and compensator to trigger the BMCA to re-choose the slave port.

<FIG> is a block diagram showing a computer readable storage medium in accordance with embodiments of the present disclosure. As shown in <FIG>, a computer readable storage medium <NUM> having a computer program <NUM> stored thereon, the computer program <NUM> when executed by a device causes the device to carry out any method above mentioned, such as shown in <FIG>, <FIG>, <FIG>, <FIG>.

The computer readable storage medium <NUM> may be configured to include memory such as RAM, ROM, programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic disks, optical disks, floppy disks, hard disks, removable cartridges, or flash drives.

In general, the various exemplary embodiments of the present disclosure may be implemented in hardware or special purpose circuits, software, logic or any combination thereof. For example, some aspects may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor or other computing device, although the disclosure is not limited thereto. While various aspects of the exemplary embodiments of this disclosure may be illustrated and described as block diagrams, flow charts, or using some other pictorial representation, it is well understood that these blocks, apparatus, systems, techniques or methods described herein may be implemented in, as nonlimiting examples, hardware, software, firmware, special purpose circuits or logic, general purpose hardware or controller or other computing devices, or some combination thereof.

It should thus be appreciated that the exemplary embodiments of this disclosure may be realized in an apparatus that is embodied as an integrated circuit, where the integrated circuit may include circuitry (as well as possibly firmware) for embodying at least one or more of a data processor, a digital signal processor, baseband circuitry and radio frequency circuitry that are configurable so as to operate in accordance with the exemplary embodiments of this disclosure.

Claim 1:
A method performed by a clock distribution apparatus, the method comprising:
receiving (S201) a first clock signal, wherein the first clock signal is from a third clock source through a first transmission path in a network;
receiving (S202) a second clock signal, wherein the second clock signal is from the third clock source through a second transmission path in the network;
calculating (S203) an offset difference between the first clock signal and the second clock signal;
determining (S205') whether a network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network;
compensating (S204) the second clock signal, based on the offset difference, wherein compensating (S204) comprises compensating (S2042) a local clock of the clock distribution apparatus with the offset difference, when it is determined that the network connection between the third clock source and the clock distribution apparatus is switched from the first transmission path in the network to the second transmission path in the network; and
outputting (S206) a clock signal, based on the compensated second clock signal.