TECHNICAL FIELD

This disclosure relates generally to clock synchronization, and more particularly to method and system for correcting clock skew using precision time protocol (PTP).

BACKGROUND

Communication network involving multiple devices often require accurate and synchronized timing, for example to facilitate event synchronization and data correlation. An asynchronous clock in a network device may happen due to various factors and may adversely impact proper functioning of the network device. For example, the asynchronous clock in the network device may result in packet loss, delay in data transmission/reception, and so forth. Synchronization of time is therefore important and may involve eliminating or minimizing a clock skew in the network device.

As will be appreciated, there are many techniques employed by a communication network (e.g., 4G, 5G backhaul and fronthaul, etc.) to perform time synchronization for multiple devices. One such technique may involve Precision Time Protocol (PTP) synchronization (sync) mode to keep time, phase and frequency synchronized across devices (e.g., IoT devices, medical devices, power grids, etc.) in the communication network. Typically, the PTP sync is achieved between a master device and a slave device by: a) the master device dynamically sharing an accurate time information with the slave device, b) the slave device dynamically determining a Round Trip Time (RTT) or path delay (PD) with the master device at regular intervals, and c) the slave device setting/adjusting an appropriate time based on the time received from master device and the RTT/PD determined by the slave device. The setting/adjusting of the time may be performed with the help of an PTP-Daemon (PTP-d) and PTP-servo running at the slave device. As will be appreciated, typically, the slave device has a cheaper or less accurate device clock, which deviates much with respect to the master device. This clock deviation (also referred to as clock skew) is primarily caused due to ageing and temperature effects on slave clock. Thus, for the device synchronization, only the time error due to the clock skew at the slave device should be adjusted by the PTP-d running at the slave device.

It may be critical for the PTP-d running at the slave device to accurately determine the RTT/PD, so as to set the accurate time at the slave device. However, due to network variations (i.e., network congestion, network disruptions, etc.) between the master and the slave device, accurate determination of the RTT/PD is challenging. In other words, the RTT/PD varies from time to time due to two main factors: a) network variations (NV) that may result in packet delay variations (PDVs), and b) clock deviation at the slave device. The clock correction in the slave device should be based on clock deviation/skew only and not on network congestion/disruptions. Hence, there is a need to isolate clock deviation/skew and to eliminate the PDVs from the RTT/PD determination, caused due to the network disruption/congestion, before determining the time adjustments required at the slave device. In short, the network variations must be considered or accounted for prior to setting/adjusting the time at the slave device.

As will be appreciated, many of the existing techniques does not have a deterministic mechanism to detect an instantaneous clock deviation/skew based on uplink and downlink path delays of PTP packets. Additionally, these existing techniques detects the instantaneous clock deviation/skew by determining variations in either uplink or downlink path delays. Further, none of the existing techniques effectively filter-out the variations in the RTT/PD caused due to the dynamic network variations during instantaneous clock deviation/skew correction. Therefore, there is a need of a mechanism that may dynamically detect variations in the path delays based on the instantaneous clock deviation/skew so as to determine an exact time to be adjusted at the slave device due to clock deviation.

SUMMARY

In one embodiment, a method of correcting a clock skew of a clock in a slave device using a precision time protocol (PTP) is disclosed. In one example, the method may include determining an uplink delay and a downlink delay, based on at least two packet transactions in the PTP protocol and conducted between the slave device and a master device within a pre-defined accumulator time window. The method may further include determining a change in the uplink delay and a change in the downlink delay with respect to a reference uplink delay and a reference downlink delay respectively. It should be noted that the reference uplink delay and the reference downlink delay correspond to a first pre-defined accumulator time window at a start of the slave device, or to a last pre-defined accumulator time window during a previous correction of the clock skew. The method may further include correcting the clock skew upon determining the change in the uplink delay to be about same in magnitude as and to be in opposite direction to the change in the downlink delay.

In another embodiment, a system for correcting a clock skew of a clock in a slave device using a precision time protocol (PTP) is disclosed. In one example, the system may include a processor and a memory communicatively coupled to the processor, wherein the memory stores processor-executable instructions, which, on execution, may cause the processor to determine an uplink delay and a downlink delay, based on at least two packet transactions in the PTP protocol and conducted between the slave device and a master device within a pre-defined accumulator time window. The processor-executable instructions, on execution, may further cause the processor to determine a change in the uplink delay and a change in the downlink delay with respect to a reference uplink delay and a reference downlink delay respectively. It should be noted that the reference uplink delay and the reference downlink delay correspond to a first pre-defined accumulator time window at a start of the slave device, or to a last pre-defined accumulator time window during a previous correction of the clock skew. The processor-executable instructions, on execution, may further cause the processor to correct the clock skew upon determining the change in the uplink delay to be about same in magnitude as and to be in opposite direction to the change in the downlink delay.

In yet another embodiment, a non-transitory computer-readable storage medium, storing computer-executable instructions, for correcting a clock skew of a clock in a slave device using a precision time protocol (PTP) is disclosed. The stored instructions, when executed by a processor, may cause the processor to perform operations including determining an uplink delay and a downlink delay, based on at least two packet transactions in the PTP protocol and conducted between the slave device and a master device within a pre-defined accumulator time window. The operations further include determining a change in the uplink delay and a change in the downlink delay with respect to a reference uplink delay and a reference downlink delay respectively. It should be noted that the reference uplink delay and the reference downlink delay correspond to a first pre-defined accumulator time window at a start of the slave device, or to a last pre-defined accumulator time window during a previous correction of the clock skew. The operations further include correcting the clock skew upon determining the change in the uplink delay to be about same in magnitude as and to be in opposite direction to the change in the downlink delay.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.

