Patent Description:
In a mobile communications technology, time synchronization between devices needs to be ensured, to ensure correct data receiving and sending. For example, in both a long term evolution (long term evolution, LTE) system and a 5th generation mobile communications technology (the 5th generation mobile communication technology, <NUM>) system, strict time synchronization is required, to ensure normal service running. Higher time synchronization precision indicates a higher correct ratio of data receiving and sending and higher communication efficiency.

Currently, a solution of performing precise time synchronization based on the standard for a precision clock synchronization protocol for networked measurement and control systems formulated by the institute of electrical and electronics engineers (institute of electrical and electronics engineers, IEEE) (IEEE standard for a precision clock synchronization protocol for networked measurement and control systems, IEEE <NUM> protocol or <NUM> protocol) has been widely applied and has developed to the second version, which is referred to as the IEEE <NUM> version (version, v) <NUM> protocol or the 1588v2 protocol for short.

Content of the IEEE 1588v2 protocol is mainly a clock distribution technology. A clock source of the IEEE 1588v2 protocol may be a satellite system, and the satellite system may include a plurality of systems such as a global positioning system (global positioning system, GPS), a BeiDou navigation satellite system, and a global navigation satellite system (global navigation satellite system, GLONASS).

Further, <CIT> refers to a SOPC (System on a Programmable Chip) networking based sub-microsecond level clock synchronizing method and system.

Further, <CIT> refers to a method and a device for detecting a fault in a synchronization link. The method includes: setting one or more reference nodes corresponding to a node to be detected; when the node to be detected starts a detection function, acquiring reference time from the one or more reference nodes and acquiring synchronization time from a synchronization path; and determining, by the node to be detected, whether there is a fault in the synchronization link between the node to be detected and a Grandmaster Clock (GM) node by using all the reference time and the synchronization time.

However, due to factors such as an error of a bearer network device, a jitter error, and asymmetry between transmit and receive optical fibers, there is a specific error in precision of performing time synchronization based on the <NUM> protocol. Consequently, a time obtained through synchronization based on the <NUM> protocol cannot meet a requirement, caused by continuous development of technologies and increasing demands of people, of increasing synchronization time precision of mobile communications system services. The time synchronization solution that is based on the <NUM> protocol has time precision of microseconds, or even time precision less than microseconds. However, in an emerging technology such as LTE or <NUM>, a basic service has synchronization precision of +/-<NUM> microseconds, and a coordinated service even has synchronization precision of hundreds of nanoseconds.

Embodiments of this application provide a time synchronization offset adjustment method, a terminal, and a computer-readable storage medium. A <NUM> time synchronization offset can be adjusted, to improve <NUM> time precision. The above mentioned problem is solved by the subject matter of the independent claims. Further implementation forms are provided in the dependent claims.

According to a first aspect, a <NUM> time offset adjustment method is provided. The method includes: A <NUM> terminal may compensate for a <NUM> time obtained through synchronization. This reduces an error caused by asymmetric delays on transmit and receive links, and improves precision of the <NUM> time obtained through synchronization.

In an optional implementation, the method may be implemented in the following steps: A first <NUM> terminal obtains a first <NUM> time by synchronizing with an upper-level <NUM> device of the first <NUM> terminal; the first <NUM> terminal determines a <NUM> time offset value; and the first <NUM> terminal compensates for the first <NUM> time based on the <NUM> time offset value. Therefore, the first <NUM> terminal may compensate for an offset of the <NUM> time on a terminal side, to compensate for the <NUM> time at an edge of a synchronization network, that is, compensate for an offset caused by asymmetry of end to end (end to end, E2E) optical fibers, and compensate for a fixed offset inside a device in the synchronization network. Therefore, measurement and compensation do not need to be performed node by node, labor costs are greatly reduced, and precision of the <NUM> time is improved.

In another optional implementation, the method further includes: The first <NUM> terminal receives a first GPS time from a GPS clock source, where the <NUM> time offset value is a difference between the first <NUM> time and the first GPS time. According to this embodiment of this application, a <NUM> terminal performs compensation based on a GPS time, so that precision of a <NUM> time obtained after the compensation is close to or reaches precision of the GPS time, and precision of the <NUM> time is greatly improved.

In another optional implementation, the method further includes: The first <NUM> terminal sends the <NUM> time offset value to a second <NUM> terminal, where the <NUM> time offset value is used to compensate for a second <NUM> time, and the second <NUM> time is a <NUM> synchronization time obtained by the second <NUM> terminal by synchronizing with the upper-level <NUM> device of the first <NUM> terminal. According to this embodiment of this application, <NUM> terminals served by a same access layer device share a <NUM> time offset value, so that some base stations that cannot obtain a reference time by themselves compensate for a <NUM> time, and a network deployment difficulty is reduced.

In another optional implementation, the method further includes: The first <NUM> terminal receives first indication information from a <NUM> terminal management device, where the first indication information is used to indicate the first <NUM> terminal to send the <NUM> time offset value to the second <NUM> terminal. According to this embodiment of this application, <NUM> terminals share a <NUM> time offset value under control of a <NUM> terminal management device, so that resource utilization is improved and information disorder is avoided.

In another optional implementation, that the first <NUM> terminal sends the <NUM> time offset value to the second <NUM> terminal may specifically include: The first <NUM> terminal sends the <NUM> time offset value to the second <NUM> terminal through the <NUM> terminal management device. According to this embodiment of this application, a <NUM> terminal management device is used as an intermediate device to implement sharing and transfer of a <NUM> time offset value between <NUM> terminals, and unified management performed by the <NUM> terminal management device is facilitated.

In another optional implementation, that the first <NUM> terminal determines the <NUM> time offset value includes: The first <NUM> terminal receives the <NUM> time offset value from a third <NUM> terminal, where the <NUM> time offset value is a difference between a third <NUM> time and a third GPS time, the third <NUM> time is a <NUM> time obtained by the third <NUM> terminal by synchronizing with the upper-level <NUM> device of the first <NUM> terminal, and the third GPS time is a GPS time received by the third <NUM> terminal from a GPS clock source. According to this embodiment of this application, a <NUM> terminal determines a <NUM> time offset value through another <NUM> terminal served by a same access layer device, to implement sharing of the <NUM> time offset value between <NUM> terminals served by the same access layer device, so that a <NUM> terminal device that does not have a capability of obtaining a reference signal can also compensate for a <NUM> time, and a network deployment difficulty is reduced.

In another optional implementation, that the first <NUM> terminal receives the <NUM> time offset value from the third <NUM> terminal includes: The first <NUM> terminal receives the <NUM> time offset value from the third <NUM> terminal through a <NUM> terminal management device.

According to a second aspect, a <NUM> time offset adjustment method is provided. According to the method, a <NUM> time obtained through synchronization may be compensated for on an edge bearer device. This reduces an error caused by asymmetric delays on transmit and receive links, and improves precision of the <NUM> time obtained through synchronization.

In an optional implementation, the method may be specifically implemented in the following steps: A first <NUM> terminal obtains a first <NUM> time by synchronizing with an upper-level <NUM> device; the first <NUM> terminal receives a first GPS time from a GPS clock source; the first <NUM> terminal determines a <NUM> time offset value, where the <NUM> time offset value is a difference between the first <NUM> time and the first GPS time; and the first <NUM> terminal sends the <NUM> time offset value to the first access layer device, where the <NUM> time offset value is used to compensate for a fourth <NUM> time, and the fourth <NUM> time is a <NUM> time obtained by the first access layer device by synchronizing with an upper-level <NUM> device of the first access layer device. Therefore, the first access layer device may compensate for an offset of the <NUM> time at the end of a bearer network, to compensate for the <NUM> time at an edge of a synchronization network, that is, compensate for an offset caused by asymmetry of end to end (end to end, E2E) optical fibers, and compensate for a fixed offset inside a device in the synchronization network. Therefore, measurement and compensation do not need to be performed node by node, labor costs are greatly reduced, and precision of the <NUM> time is improved.

In another optional implementation, the method may alternatively be specifically implemented in the following steps: A first access layer device obtains a fourth <NUM> time by synchronizing with an upper-level <NUM> device of the first access layer device; the first access layer device receives a <NUM> time offset value; and the first access layer device compensates for the fourth <NUM> time based on the <NUM> time offset value. Therefore, the first access layer device may compensate for an offset of the <NUM> time at the end of a bearer network, to compensate for the <NUM> time at an edge of a synchronization network, that is, compensate for an offset caused by asymmetry of end to end (end to end, E2E) optical fibers, and compensate for a fixed offset inside a device in the synchronization network. Therefore, measurement and compensation do not need to be performed node by node, labor costs are greatly reduced, and precision of the <NUM> time is improved.

In another optional implementation, that the first access layer device compensates for the fourth <NUM> time based on the <NUM> time offset value includes: The first access layer device compensates for the fourth <NUM> time on a port between the first access layer device and the upper-level <NUM> device of the first access layer device based on the <NUM> time offset value; or the first access layer device compensates for the fourth <NUM> time on a port between the first access layer device and a <NUM> terminal based on the <NUM> time offset value; or if a system time of the first access layer device is updated to the fourth <NUM> time after the first access layer device obtains the fourth <NUM> time, the first access layer device compensates for the internal system time.

In another optional implementation, the method further includes: The first access layer device sends the <NUM> time offset value to a bearer network management device. According to this embodiment of this application, a bearer network management device may manage a bearer network device based on a <NUM> time offset value, for example, perform fault monitoring with reference to a network topology. The bearer network management device may also be used as an intermediate device to implement sharing of the <NUM> time offset value between access layer devices.

In another optional implementation, the method further includes: The first access layer device receives indication information from the bearer network management device, where the indication information is used to indicate the first access layer device to compensate for the fourth <NUM> time based on the <NUM> time offset value. According to this embodiment of this application, an access layer device may perform time compensation based on an indication of a bearer network management device, to facilitate unified management and improve system consistency.

In another optional implementation, that the first access layer device receives the <NUM> time offset value includes: The first access layer device receives the <NUM> time offset value from a first <NUM> terminal, where the <NUM> time offset value is a difference between a first <NUM> time and a first GPS time, the first <NUM> time is a <NUM> time obtained by the first <NUM> terminal by synchronizing with the first access layer device, and the first GPS time is a GPS time received by the first <NUM> terminal from a GPS clock source. According to this embodiment of this application, an access layer device may obtain a <NUM> time offset value from a <NUM> terminal managed by the access layer device, so that <NUM> time compensation is performed at the access layer device, and measurement and compensation are performed at the end.

In another optional implementation, the method further includes: The first access layer device sends the <NUM> time offset value to a second access layer device, where the <NUM> time offset value is used to compensate for a fifth <NUM> time obtained by the second access layer device by synchronizing with an upper-level <NUM> device of the second access layer device, where both the first access layer device and the second access layer device are located on a first access ring, and delays on transmit and receive links of the first access ring are symmetric. According to this embodiment of this application, access layer devices on an access ring share a <NUM> time offset value, so that a network deployment difficulty is further reduced.

In another optional implementation, that the first access layer device sends the <NUM> time offset value to the second access layer device includes: The first access layer device sends the <NUM> time offset value to the second access layer device through a bearer network management device. In this way, a bearer network management device may be used as an intermediate device to transmit a <NUM> time offset value, and the bearer network management device may manage transmission of the <NUM> time offset value.

In another optional implementation, that the first access layer device receives the <NUM> time offset value includes: The first access layer device receives the <NUM> time offset value from a third access layer device, where the <NUM> time offset value is a difference between a sixth <NUM> time and a sixth GPS time, the sixth <NUM> time is a <NUM> time obtained by a fourth <NUM> terminal by synchronizing with the third access layer device, and the sixth GPS time is a GPS time received by the fourth <NUM> terminal from a GPS clock source, where both the first access layer device and the third access layer device are located on a first access ring, and delays on transmit and receive links of the first access ring are symmetric.

In another optional implementation, that the first access layer device receives the <NUM> time offset value from the third access layer device includes: The first access layer device receives the <NUM> time offset value from the third access layer device through a bearer network management device.

According to a third aspect, a <NUM> time offset adjustment apparatus is provided. The apparatus includes: a synchronization unit, configured to obtain a first <NUM> time by synchronizing with an upper-level <NUM> device of the apparatus; a determining unit, configured to determine a <NUM> time offset value; and a compensation unit, configured to compensate for the first <NUM> time based on the <NUM> time offset value.

In an optional implementation, the apparatus further includes: a first receiving unit, configured to receive a first global positioning system GPS time from a GPS clock source, where the <NUM> time offset value is a difference between the first <NUM> time and the first GPS time.

In another optional implementation, the apparatus further includes: a first sending unit, configured to send the <NUM> time offset value to a second <NUM> terminal, where the <NUM> time offset value is used to compensate for a second <NUM> time, and the second <NUM> time is a <NUM> synchronization time obtained by the second <NUM> terminal by synchronizing with the upper-level <NUM> device of the apparatus.

In another optional implementation, the apparatus further includes: a second receiving unit, configured to receive first indication information from a <NUM> terminal management device, where the first indication information is used to indicate the first <NUM> terminal to send the <NUM> time offset value to the second <NUM> terminal.

In another optional implementation, the apparatus further includes:
a second sending unit, configured to send the <NUM> time offset value to the second <NUM> terminal through the <NUM> terminal management device.

In another optional implementation, the determining unit is specifically configured to:
receive the <NUM> time offset value from a third <NUM> terminal, where the <NUM> time offset value is a difference between a third <NUM> time and a third GPS time, the third <NUM> time is a <NUM> time obtained by the third <NUM> terminal by synchronizing with the upper-level <NUM> device of the apparatus, and the third GPS time is a GPS time received by the third <NUM> terminal from a GPS clock source.

In another optional implementation, the determining unit is specifically configured to:
receive the <NUM> time offset value from the third <NUM> terminal through a <NUM> terminal management device.

According to a fourth aspect, a <NUM> time offset adjustment apparatus is provided. The apparatus includes: a synchronization unit, configured to obtain a first <NUM> time by synchronizing with a first access layer device; a receiving unit, configured to receive a first GPS time from a GPS clock source; a determining unit, configured to determine a <NUM> time offset value, where the <NUM> time offset value is a difference between the first <NUM> time and the first GPS time; and a sending unit, configured to send the <NUM> time offset value to the first access layer device, where the <NUM> time offset value is used to compensate for a fourth <NUM> time, and the fourth <NUM> time is a <NUM> time obtained by the first access layer device by synchronizing with an upper-level <NUM> device of the first access layer device.

According to a fifth aspect, a <NUM> time offset adjustment apparatus is provided. The apparatus includes: an obtaining unit, configured to obtain a fourth <NUM> time by synchronizing with an upper-level <NUM> device of the apparatus; a receiving unit, configured to receive a <NUM> time offset value; and a compensation unit, configured to compensate for the fourth <NUM> time based on the <NUM> time offset value.

In an optional implementation, the compensation unit is specifically configured to: compensate for the fourth <NUM> time on a port between the apparatus and the upper-level <NUM> device based on the <NUM> time offset value; or compensate for the fourth <NUM> time on a port between the apparatus and a <NUM> terminal based on the <NUM> time offset value; or if a system time is updated to the fourth <NUM> time after the fourth <NUM> time is obtained, compensate for the system time.

In another optional implementation, the apparatus further includes: a sending unit, configured to send the <NUM> time offset value to a bearer network management device.

In another optional implementation, the receiving unit is further configured to: receive indication information from the bearer network management device, where the indication information is used to indicate the compensation unit to compensate for the fourth <NUM> time based on the <NUM> time offset value.

In another optional implementation, the receiving unit is specifically configured to: receive the <NUM> time offset value from a first <NUM> terminal, where the <NUM> time offset value is a difference between a first <NUM> time and a first GPS time, the first <NUM> time is a <NUM> time obtained by the first <NUM> terminal by synchronizing with the first access layer device, and the first GPS time is a GPS time received by the first <NUM> terminal from a GPS clock source.

In another optional implementation, the sending unit is further configured to: send the <NUM> time offset value to a second access layer device, where the <NUM> time offset value is used to compensate for a fifth <NUM> time obtained by the second access layer device by synchronizing with an upper-level <NUM> device of the second access layer device, where both the first access layer device and the second access layer device are located on a first access ring, and delays on transmit and receive links of the first access ring are symmetric.

In another optional implementation, the sending unit is further configured to: send the <NUM> time offset value to the second access layer device through a bearer network management device.

In another optional implementation, the receiving unit is further configured to: receive the <NUM> time offset value from a third access layer device, where the <NUM> time offset value is a difference between a sixth <NUM> time and a sixth GPS time, the sixth <NUM> time is a <NUM> time obtained by a fourth <NUM> terminal by synchronizing with the third access layer device, and the sixth GPS time is a GPS time received by the fourth <NUM> terminal from a GPS clock source, where both the first access layer device and the third access layer device are located on a first access ring, and delays on transmit and receive links of the first access ring are symmetric.

In another optional implementation, the receiving unit is specifically configured to: receive the <NUM> time offset value from the third access layer device through a bearer network management device.

According to a sixth aspect, a <NUM> terminal is provided. The terminal includes a communications module, a processor, and a memory, where the memory is configured to store a program; the communications module is configured to interact with an access layer device or a <NUM> terminal; and the processor is configured to execute the program stored in the memory, to control the <NUM> terminal to perform the method performed by the <NUM> terminal according to the first aspect or the second aspect.

According to a seventh aspect, another <NUM> terminal is provided. The terminal includes a communications module, a GPS transceiver, a processor, and a memory, where the memory is configured to store a program; the communications module is configured to interact with an access layer device, a <NUM> terminal, or a <NUM> terminal management device; the GPS transceiver is configured to receive a GPS time; and the processor is configured to execute the program stored in the memory, to control the <NUM> terminal to perform the method performed by the <NUM> terminal according to the first aspect or the second aspect.

According to an eighth aspect, an access layer device is provided. The access layer device includes a communications module, a processor, and a memory, where the memory is configured to store a program; the communications module is configured to interact with a <NUM> terminal, a bearer network device, or a bearer network management device; and the processor is configured to execute the program stored in the memory, to control the access layer device to perform the method performed by the access layer device according to the second aspect.

According to a ninth aspect, a computer-readable storage medium is provided. The computer-readable storage medium includes a computer-readable instruction; and when the computer instruction is executed by a processor, the method according to any one or more of the first aspect, the second aspect, or the third aspect is implemented.

According to a tenth aspect, a computer program product including an instruction is provided. The computer-readable storage medium stores a computer program; and when the program is run on a computer, the computer is enabled to perform the method according to any one or more of the first aspect, the second aspect, or the third aspect.

In the embodiments of this application, descriptions such as "first" or "second" are merely for clarity of description, and do not constitute any limitation in some cases. For example, a "first <NUM> terminal" and a "second <NUM> terminal" are merely intended to distinguish between different <NUM> terminals. During specific implementation, the "first <NUM> terminal" may also be referred to as a "second <NUM> terminal", and the "second <NUM> terminal" may also be referred to as a "first <NUM> terminal". Herein, "first" and "second" do not constitute a limitation on the <NUM> terminals.

The technical solutions provided in the embodiments of this application are applicable to a mobile communications system shown in <FIG>. With reference to <FIG>, the communications system includes a bearer network <NUM>, a <NUM> terminal <NUM>, and a clock server <NUM>. The <NUM> terminal <NUM> is connected to the bearer network <NUM>, and the bearer network <NUM> is connected to the clock server <NUM>. The bearer network <NUM> is located between the <NUM> terminal <NUM> and the clock server <NUM>, so that the <NUM> terminal obtains a <NUM> time through the bearer network.

The communications system supports the <NUM> protocol. The <NUM> protocol may be a <NUM> protocol of any version, or a protocol evolved based on the IEEE 1588v2 protocol or the 1588v2 protocol, for example, G. 827x series standards formulated by the international telecommunication union telecommunication standardization sector (international telecommunication union telecommunication standardization sector, ITU-T), including G. <NUM>, and G. 827x series standards relate to aspects such as a network architecture, a networking model, network-level and network element-level indicator requirements, a time server indicator requirement, and protection switchover for 1588v2 high-precision time synchronization.

The <NUM> terminal in the communications system may be a device that supports the <NUM> protocol. For example, the <NUM> terminal may be a base station or a PTN end transmission device. The base station may include a small cell, a macro base station, an indoor distributed base station, or the like.

The clock server <NUM> in the communications system may be a server that provides a clock in a process of performing time synchronization based on the <NUM> protocol. A clock source of the clock server may be a satellite system or a terrestrial system. The satellite system may be a GPS, a BeiDou navigation satellite system, a GLONASS, or the like. The terrestrial system may be a building integrated timing supply system (building integrated timing supply system, BITS) or the like.

Optionally, the communications system shown in <FIG> may further include another network device, and the another network device may be connected to a core layer <NUM>, the another network device may include a core network device (for example, a mobility management entity (mobility management entity, MME), or a core network service gateway (service gateway, SGW) or a core network internet gateway (packet gateway, PGW) in an evolved packet core (evolved packet core, EPC)).

Optionally, the communications system may further include one or more <NUM> terminal management devices <NUM> and a bearer network management device <NUM>. The <NUM> terminal management device <NUM> is connected to the <NUM> terminal through the bearer network <NUM>, to manage the <NUM> terminal. The bearer network management device <NUM> is connected to the bearer network <NUM> and manages the bearer network <NUM>.

Optionally, the bearer network <NUM> in the communications system may be designed based on a standard three-layer structure, and three layers are an access layer <NUM>, an aggregation layer <NUM>, and the core layer <NUM>.

For example, the core layer <NUM> mainly provides high-bandwidth service bearing and transmission, and completes interconnection and interworking with another network. The aggregation layer <NUM> mainly aggregates and distributes user service data to service access nodes, and classifies services into different service classes. The access layer <NUM> uses a plurality of access technologies, to perform bandwidth and service allocation, implement user access, and complete multiplexing and transmission of a plurality of services.

The access layer <NUM> may include one or more devices, and a device at the access layer <NUM> may be referred to as an access layer device. The aggregation layer <NUM> may include one or more devices, and a device at the aggregation layer <NUM> may be referred to as an aggregation layer device. The core layer <NUM> may include one or more devices, and a device at the core layer <NUM> may be referred to as a core layer device. The access layer device, the aggregation layer device, or the core layer device may be referred to as a bearer network device.

As shown in <FIG>, the access layer <NUM> and the aggregation layer <NUM> may establish a system by using a ring structure. The access layer <NUM> may include a plurality of access rings, and each access ring may include a plurality of access layer devices. The aggregation layer <NUM> may include a plurality of aggregation rings, and each aggregation ring may include a plurality of aggregation layer devices.

In <FIG>, the access layer <NUM> may include an access ring <NUM>, an access ring <NUM>, and the like, and the aggregation layer may include an aggregation ring <NUM> and the like. The access ring <NUM> may include access layer devices <NUM>, <NUM>, <NUM>, <NUM>, and the like. The access ring <NUM> may include access layer devices <NUM>, <NUM>, <NUM>, <NUM>, and the like. The aggregation layer may include aggregation layer devices <NUM>, <NUM>, <NUM>, <NUM>, and the like.

For example, the bearer network is networked by using a packet transport network (packet transport network, PTN) device. During networking, a ring is formed at the access layer at a gigabit ethernet (gigabit ethernet, GE) rate, a ring is formed at the aggregation layer at a <NUM> gigabit ethernet rate, and a dual-node ring connection structure is used to avoid a risk of a failure of a single node such as an aggregation node or a backbone node. At a backbone layer, each backbone layer node is directly connected to a related core layer node through a GE or <NUM> gigabit ethernet link provided by an optical transport network (optical transport network, OTN). A person skilled in the art may understand that this application is not limited to PTN device networking. For example, any network device such as a router may also be used for networking. This is not specifically limited in this application.

It should be noted that, in the system shown in <FIG>, the bearer network <NUM> is optional. When the bearer network <NUM> does not exist, the <NUM> terminal may be directly connected to the clock server.

In the communications systems shown in <FIG> and <FIG>, the <NUM> terminal may obtain a time from the clock server based on the <NUM> protocol. In a first implementation, the <NUM> terminal may obtain the time of the clock server through the bearer network in a hop-by-hop synchronization manner. For example, the clock server synchronizes the time to a bearer network device, and the bearer network device synchronizes the time to the <NUM> terminal. In a second implementation, the <NUM> terminal may directly perform time synchronization with the clock server, and the clock server directly synchronizes the time to the <NUM> terminal. In this process, if there is a bearer network device between the <NUM> terminal and the clock server, the intermediate bearer network device may transparently transmit information in the time synchronization process between the <NUM> device and the clock server.

The following further describes the first implementation with reference to <FIG>.

As shown in <FIG>, a core layer device <NUM> may obtain a <NUM> time from the clock server <NUM>. For example, the core layer device <NUM> may include a GPS module, and may receive a GPS time through the GPS module. Alternatively, the clock server <NUM> may be integrated into the core layer device; in this case, the core layer device <NUM> may be used as a clock server. The following uses a time synchronization process of a <NUM> terminal <NUM> as an example for description.

First, the core layer device <NUM> obtains a GPS time (which may alternatively be another satellite system time, and the GPS time is used as an example herein).

Then, the core layer device <NUM> serves as an upper-level <NUM> device and synchronizes a <NUM> time to a core layer device <NUM>. A process may be specifically: A port (an M port shown in <FIG>), in a <NUM> master working mode, of the core layer device <NUM> synchronizes the <NUM> time to a port (an S port shown in <FIG>), in a slave working mode, of the core layer device <NUM>; and after obtaining the <NUM> time, the core layer device <NUM> may send the <NUM> time to a port, in the <NUM> master working mode, of the core layer device <NUM>. A <NUM> time synchronization process between the following devices may be understood with reference to this process:.

The core layer device <NUM> serves as an upper-level <NUM> device and synchronizes the <NUM> time to an aggregation layer device <NUM>;.

In this embodiment of this application, a device that supports the <NUM> protocol may be referred to as a <NUM> device, and the <NUM> device may include a clock server, a core layer device, an aggregation layer device, an access layer device, a <NUM> terminal, or the like. Another <NUM> device in <FIG> also performs time synchronization in a same manner, and refer to the foregoing content.

The following further explains a synchronization process between a <NUM> device and an upper-level <NUM> device. The <NUM> device may include one or more clocks, for example, a clock of an internal system, a clock of an M port, and a clock of an S port. In S310, the upper-level <NUM> device sends a synchronization (synchronization, sync) packet at a moment t<NUM>, and includes a timestamp t<NUM> in the packet.

For example, the upper-level <NUM> device may include the timestamp t<NUM> of the clock of the M port in the packet.

S320: The <NUM> device receives the sync packet at a moment t<NUM>, generates a timestamp t<NUM>, and extracts the timestamp t<NUM> from the packet.

For example, the <NUM> device may generate the timestamp t<NUM> of the clock of the S port, and extract the timestamp t<NUM> from the packet.

S330: The <NUM> device sends a delay request (delay request, Delay_Req) packet at a moment t<NUM>, and generates a timestamp t<NUM>.

For example, the <NUM> device may generate the timestamp t<NUM> of the clock of the Sport.

S340: The upper-level <NUM> device receives the Delay_Req packet at a moment t<NUM>, generates a timestamp t<NUM>, then includes the timestamp t<NUM> in a delay response (delay response, Delay_Resp) packet, and returns the delay response packet to the lower-level <NUM> device.

S350: The <NUM> device receives the Delay_Resp packet, and extracts the timestamp t<NUM> from the packet.

For example, the <NUM> device may extract the timestamp t<NUM>, and the <NUM> device may calculate a time offset O between the <NUM> device and the upper-level <NUM> device by using t<NUM>, t<NUM>, t<NUM>, and t<NUM>.

It is assumed that a sending path delay from the upper-level <NUM> device to the <NUM> device is Dms, a sending path delay from the <NUM> device to the upper-level <NUM> device is Dsm, and the time offset between the <NUM> device and the upper-level <NUM> device is O. In this case: <MAT> <MAT> and<MAT>.

If Dms=Dsm, that is, delays on transmit and receive links between the <NUM> device and the upper-level <NUM> device are symmetric, <MAT>.

In this way, the <NUM> device may calculate the time offset O between the <NUM> device and the upper-level <NUM> device based on the four timestamps t<NUM>, t<NUM>, t<NUM>, and t<NUM>, and adjust a time of the <NUM> device based on O, to obtain a <NUM> time by performing time synchronization with the upper-level <NUM> device. For example, the <NUM> device may obtain the <NUM> time by increasing or decreasing the time of the <NUM> device by the time offset O, where the time of the <NUM> device may be a time of the internal system of the <NUM> device; and the <NUM> device synchronizes the <NUM> time obtained in the internal system to clocks of ports of the <NUM> device, for example, to the clock of the M port and the clock of the Sport.

For another example, when the <NUM> device performs time synchronization with the upper-level <NUM> device according to the ITU-T G. <NUM> protocol, three network node models are defined: a telecom grandmaster (telecommunication grandmaster clock, T-GM), a telecom boundary clock (T-BC), and a telecom time slave clock (T-TSC). The T-GM is a root clock in an area, that is, a tree with a master clock as a root is established, and the master clock is the best clock source in an entire network. For a specific calculation manner of time synchronization between devices, refer to the descriptions of <FIG>.

An internal system and a port of a <NUM> device may each include a clock. A time of the internal system may be a time of a clock of the internal system, a time of the port may be a time of a clock of the port, and the clock of the port may be used to generate a timestamp. In a time synchronization solution that is based on the <NUM> protocol, working modes of the port of the <NUM> device may include at least a <NUM> master (master) mode and a <NUM> slave (slave) mode. When the port works in the <NUM> slave (slave) mode, the clock of the port serves as a slave clock to synchronize with a clock of a port, in the master mode, of an upper-level device; when the port works in the <NUM> master (master) mode, the clock of the port serves as a master clock to provide a clock to the outside. In ports connecting the <NUM> device and the upper-level <NUM> device, a port of the <NUM> deviceworks in the <NUM> slave mode, and a port of the upper-level <NUM> device works in the master mode. The port of the <NUM> device obtains a <NUM> timestamp from the port of the upper-level <NUM> device and sends the timestamp to the internal system of the <NUM> device; after the internal system of the <NUM> device calculates a time offset O based on the timestamp, the clock of the internal system may be synchronized with based on the time offset O; and after the clock of the internal system is synchronized with, the clock of the internal system may be synchronized with a clock of the port of the <NUM> device. For example, in the <NUM> version (version, v) <NUM> protocol, <NUM> devices may include an ordinary clock (ordinary clock, OC) device and a boundary clock (boundary clock, BC) device. The OC device usually has only one physical interface to communicate with a network, and a working mode of the physical interface may be the master (master) mode or the slave (slave) mode. The BC device has a plurality of physical interfaces to communicate with the network, and each physical interface performs behavior similar to that of the interface of the OC device and can be connected to a plurality of sub-domains.

The <NUM> terminal <NUM> is an OC device, and the bearer network device (the bearer network device includes an upper-level device of the <NUM> terminal) in the bearer network <NUM> is a BC device.

For another example, in the ITU-T G. <NUM> protocol, a <NUM> device may be a T-GM device, a T-BC device, or a T-TSC device. The T-GM device may be considered as an OC device (which is a GM that has only one port, where the port works in the master mode) that can only work in the master mode. The T-GM device may alternatively be considered as a BC device (which is a GM that may have a plurality of ports, where the ports work in the master mode) that can only work in the master mode. The T-BC device may be a GM or may work in the slave mode to synchronize with another <NUM> clock. The T-TSC device may be considered as an OC device (which always works in the slave mode) that can only work in the slave mode.

It can be learned from the foregoing principle that time synchronization that is based on the <NUM> protocol is performed on a basis of symmetric delays on transmit and receive links between the <NUM> device and the clock server. If the delays on the transmit and receive links between the <NUM> device and the clock server are asymmetric, a synchronization offset is introduced, and the offset is equal to half of a difference between the delays on the transmit and receive links. There is a fixed offset inside an intermediate device between the <NUM> device and the clock server. Therefore, if a quantity of intermediate devices is larger, an accumulated fixed offset inside the devices is larger.

Asymmetry of <NUM>-meter transmit and receive optical fibers (that is, asymmetry of delays on transmit and receive links) introduces a <NUM>-microsecond time synchronization error, and there is another offset such as an offset inside a device in a multi-stage network. To be specific, in a process in which the <NUM> terminal performs time synchronization with the bearer network, devices from the clock server to the <NUM> device (the <NUM> terminal or an end access device) cross the access layer, the aggregation layer, and the core layer, leading to a very large accumulated fixed offset inside the devices; and a receive link and a transmit link from the end to the clock server are very long, leading to very high delays on the transmit and receive links, and because the receive link and the transmit link are usually not single-fiber bidirectional, and especially, links at the aggregation layer and the core layer are mostly two- fiber bidirectional, when the links are very long, a difference between the delays on the receive link and the transmit link is very large, causing relatively low precision of a <NUM> time obtained through synchronization based on the <NUM> protocol. Therefore, the time synchronization solution that is based on the <NUM> protocol cannot meet requirements of some services that have relatively high requirements on time precision. For example, a <NUM> basic service has synchronization precision of +/-<NUM> microseconds, and a <NUM> coordinated service has synchronization precision of hundreds of nanoseconds.

The foregoing describes the first implementation, that is, describes that the <NUM> terminal may obtain the time of the clock server through the bearer network in the hop-by-hop synchronization manner. The second implementation is similar to the first implementation, that is, an upper-level <NUM> device of the <NUM> device is the clock server. For a specific synchronization manner, refer to the content of <FIG>.

In addition, in the communications systems, a GPS receiver may be further deployed on each terminal, and each terminal obtains a high-precision GPS time source from the GPS, to implement time synchronization. In this solution, the terminal is directly connected to a GPS antenna and does not need to be connected to the GPS antenna through the bearer network.

However, to perform the time synchronization directly through the GPS, GPS receivers need to be deployed on all terminals, so that hardware costs are relatively high. In addition, when a GPS receiver of a current terminal is interfered with, an obtained GPS time is inaccurate. Therefore, when the current terminal sends or receives information, a service of the current terminal is affected, and a surrounding terminal is also interfered with, so that fault impact is amplified. In addition, the GPS is easily interfered with.

Based on this, the embodiments of this application provide a <NUM> time synchronization offset adjustment solution. A <NUM> time offset value may be determined, and a <NUM> time may be compensated for at an edge of a synchronization network based on the <NUM> time offset value, to improve synchronization precision of the <NUM> time and system stability.

In the embodiments of this application, a <NUM> device may be a device that supports the <NUM> protocol. For example, the <NUM> device may be a <NUM> terminal, a bearer network device that supports the <NUM> protocol, a clock server, or the like; and the bearer network device may be an access layer device, an aggregation layer device, a core layer device, or the like.

In the embodiments of this application, an upper-level device of a device is a device that synchronizes a <NUM> time to the device. For example, an upper-level <NUM> device of a <NUM> terminal may be an access layer device or a clock server; an upper-level <NUM> device of an access layer device may be an access layer device or an aggregation layer device; an upper-level <NUM> device of an aggregation layer device may be an aggregation layer device or a core layer device; and an upper-level <NUM> device of a core layer device may be a clock server.

In the embodiments of this application, that delays on transmit and receive links are symmetric means that a delay on a receive link is equal to a delay on a transmit link. For example, in a case in which links are single-fiber bidirectional, a delay on a receive link is equal to a delay on a transmit link.

To facilitate understanding of the embodiments of this application, the following further describes and explains specific embodiments with reference to the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of this application.

In an embodiment, a <NUM> time obtained through synchronization may be compensated for on a <NUM> terminal. This reduces an error caused by asymmetric delays on transmit and receive links and an offset inside an intermediate device, and improves precision of the <NUM> time obtained through synchronization.

<FIG> is a signaling exchange diagram of a <NUM> time synchronization offset adjustment method according to an embodiment of this application. The method shown in <FIG> is an example in which a <NUM> terminal compensates for a <NUM> time obtained through synchronization. As shown in <FIG>, the method specifically includes the following steps.

S410: A first <NUM> terminal obtains a first <NUM> time by synchronizing with an upper-level <NUM> device.

For example, with reference to <FIG>, the first <NUM> terminal may be any <NUM> terminal in <FIG>.

A manner of obtaining the first <NUM> time may be the time synchronization manner shown with reference to <FIG>, where the upper-level <NUM> device may include a clock server or an access layer device.

S420: The first <NUM> terminal determines a <NUM> time offset value.

The <NUM> time offset value may be an offset between a <NUM> time and a reference time. The reference time may be another time different from the <NUM> time, for example, a time with higher precision than the <NUM> time. For example, the reference time may be a time received from a satellite system, or may be a synchronization time obtained in another time synchronization manner. The satellite system may be a GPS, a BeiDou navigation satellite system, a GLONASS, or the like.

In addition, the <NUM> time offset value may be a difference between a <NUM> time of an internal system of the first <NUM> terminal and a reference time that are at a same moment, or may be a difference between a <NUM> time of a port of the first <NUM> terminal and a reference time that are at a same moment.

The <NUM> time offset value may be determined before the first <NUM> time is obtained, or may be determined after the first <NUM> time is obtained.

The <NUM> time offset value may be updated periodically. An update frequency may be determined based on actual service and system requirements.

In addition, the first <NUM> terminal may be a <NUM> terminal that has a capability of obtaining a reference time, or a <NUM> terminal that does not have the capability of obtaining a reference time.

When the first <NUM> terminal is a <NUM> terminal that has the capability of obtaining a reference time, the first <NUM> terminal may directly obtain a reference time, and determine a difference between a <NUM> time obtained through synchronization and the obtained reference time that are at a same moment. For example, refer to related content of S510 and S512 shown with reference to <FIG>.

When the first <NUM> terminal is a <NUM> terminal that does not have the capability of obtaining a reference time, the first <NUM> terminal may directly receive a <NUM> time offset value, and the <NUM> time offset value may be received from a <NUM> terminal that is served by a first access layer device and that has the capability of obtaining a reference time, or may be received, through a <NUM> terminal management device, from a <NUM> terminal that is served by a first access layer device and that has the capability of obtaining a reference time. Upper-level devices of <NUM> terminals served by the first access layer device may be the first access layer device. Therefore, compared with an error between a core layer device and a <NUM> terminal, an error between time points obtained through synchronization by the <NUM> terminals served by the first access layer device may be ignored, especially, an error caused by asymmetric delays on transmit and receive links may be ignored. Therefore, the <NUM> time offset value may be shared by the <NUM> terminals served by the same access layer device. For example, refer to an embodiment shown with reference to <FIG>, and an example in which the reference time is a GPS time is used for detailed description.

S430: The first <NUM> terminal compensates for the first <NUM> time based on the <NUM> time offset value.

Compensation means that a <NUM> time obtained through synchronization is compensated for by Δt, where Δt is a <NUM> time offset value. Therefore, after the compensation, the <NUM> time obtained through synchronization is consistent with a current reference time, and synchronization precision of the <NUM> time is the same as that of the reference time. For example, a <NUM> time obtained through synchronization by the port of the first <NUM> terminal may be compensated for by Δt, and a <NUM> time obtained through synchronization by the internal system of the first <NUM> terminal from the port is a <NUM> time obtained after compensation. Alternatively, a <NUM> time obtained through synchronization by the internal system of the first <NUM> terminal may be compensated for by Δt, and the internal system of the first <NUM> terminal synchronizes a <NUM> time obtained after compensation to the port.

In this embodiment of this application, the <NUM> time offset value used for compensation is an accumulated value of static offsets of E2E paths in a synchronization network, and the static offset of the synchronization network includes a fixed offset (which changes after being reset) inside a bearer network device and an offset (an offset caused by asymmetry of optical fibers) outside a device. When obtaining a <NUM> time, a <NUM> terminal compensates for the <NUM> time based on a <NUM> time offset value between the <NUM> time and a reference time with higher time precision, that is, compensates for an offset caused by asymmetry of E2E optical fibers, and compensates for a fixed offset inside a device. Therefore, measurement and compensation do not need to be performed node by node, labor costs are greatly reduced, and precision of a <NUM> time obtained after the compensation reaches or is close to the precision of the reference time.

A synchronization solution obtained by combining a GPS time synchronization solution with a <NUM> time synchronization solution has high reliability: A <NUM> standard clock source is located at a position different from that of a <NUM> device, and provides a stable and reliable clock source for a base station, so that geographic redundancy can be provided, and GPS interference can be effectively resisted.

<FIG> is a signaling exchange diagram of another <NUM> time synchronization offset adjustment method according to an embodiment of this application. The method shown in <FIG> is an example of the embodiment shown in <FIG>. For example, S520 is an example of S420. For related content in S410 and S430 in <FIG>, refer to related content in S410 and S430 in <FIG>. Specifically, in this embodiment of this application, an example in which a first <NUM> terminal has a capability of obtaining a reference time, the reference time is a GPS time, and an upper-level <NUM> device is an access layer device is used for description. It should be noted that the reference time may be another time, for example, a BeiDou navigation satellite system time or a GLONASS time, or may be a time obtained by using another time synchronization protocol; and the upper-level <NUM> device may alternatively be another <NUM> device, for example, a clock server. This is not limited in this embodiment of this application. The method may further include the following steps.

S510: The first <NUM> terminal receives a first GPS time from a GPS clock source.

The first <NUM> terminal may locally receive a GPS time. For example, with reference to <FIG>, in this embodiment of this application, the first <NUM> terminal may be a <NUM> terminal <NUM>, a <NUM> terminal <NUM>, a <NUM> terminal <NUM>, or the like, and the <NUM> terminal <NUM>, the <NUM> terminal <NUM>, or the <NUM> terminal <NUM> may directly receive a GPS time from a satellite system <NUM>.

For example, determining of a <NUM> time offset value may be performed aperiodically or periodically. Based on this, the first <NUM> terminal may aperiodically or periodically receive a GPS time from the GPS clock source.

For another example, the <NUM> time offset value may be determined according to an instruction of a <NUM> terminal management device. Based on this, before step S510, the method may further include the following step: S530: The first <NUM> terminal receives first indication information from the <NUM> terminal management device, where the first indication information is used to indicate the first <NUM> terminal to send the <NUM> time offset value to a second <NUM> terminal. The second <NUM> terminal may be any <NUM> terminal, other than the first <NUM> terminal, served by a first access layer device.

Step S420 may be specifically: S520: The first <NUM> terminal determines the <NUM> time offset value based on the first GPS time.

The <NUM> time offset value may be a difference between a first <NUM> time and the first GPS time. In this case, the first <NUM> time and the first GPS time are received at a same moment. The <NUM> time offset value may alternatively be an offset value between the first GPS time and a <NUM> time obtained before the first <NUM> time is obtained. In this case, a moment at which the first GPS time is received is before a moment at which the first <NUM> time is obtained. The <NUM> time offset value may alternatively be a time offset value between the first GPS time and a <NUM> time obtained after the first <NUM> time is obtained. In this case, a moment at which the first GPS time is received is after a moment at which the first <NUM> time is obtained.

A <NUM> time and a GPS time may use two different time scales. For example, the <NUM> time uses a precision time synchronization protocol (precision time synchronization protocol, PTP) time scale, and the GPS time uses a GPS time scale. In this case, after time points of the two time scales are obtained, a fixed difference between the two time scales needs to be eliminated. For example, the time points are converted to use a same time scale, and then a difference between the two time points is obtained through comparison.

Considering that a GPS signal may be interfered with, when the <NUM> time offset value is determined, an offset value between a received GPS time and a received <NUM> time may be observed in a time period. Compared with a plurality of <NUM> time offset values determined based on GPS time points received at other adjacent moments in the observation period, if a <NUM> time offset value determined based on a GPS time received at a current moment is more stable, it is considered that the <NUM> time offset value determined based on the GPS time received at the current moment (namely, the first GPS time) is reliable. Compared with a plurality of <NUM> time offset values determined based on GPS time points received at other adjacent moments, if a <NUM> time offset value determined based on a GPS time received at a current moment changes greatly, it is considered that the <NUM> time offset value determined based on the GPS time received at the current moment is unreliable, and the first <NUM> terminal needs to continue to receive a GPS time from the GPS clock source, and determines whether a <NUM> time offset value determined based on the newly received GPS time is reliable until it is determined that a reliable <NUM> time offset value is obtained.

In addition, when the first <NUM> terminal has the capability of obtaining a reference time, the first <NUM> terminal may send the <NUM> time offset value to another <NUM> terminal served by the first access layer device, so that the another <NUM> terminal served by the first access layer device compensates for a <NUM> time obtained through synchronization. In this way, a <NUM> terminal that does not have the capability of obtaining a reference time can also compensate for a <NUM> time obtained through synchronization. Specifically, the method may further include the following step: S540: The first <NUM> terminal may send the <NUM> time offset value to the second <NUM> terminal, where the <NUM> time offset value is used to compensate for a second <NUM> time, and the second <NUM> time is a <NUM> synchronization time obtained by the second <NUM> terminal by synchronizing with the upper-level <NUM> device based on the <NUM> protocol.

For example, with reference to <FIG>, after determining a <NUM> time offset value based on the GPS time, the <NUM> terminal <NUM> may send the <NUM> time offset value to a <NUM> terminal <NUM> or a <NUM> terminal <NUM> connected to an access layer device <NUM>.

In a process in which the first <NUM> terminal performs <NUM> time synchronization with the first access layer device based on the <NUM> protocol, the first access layer device may send a <NUM> identifier (identity, ID) of the first access layer device to the first <NUM> terminal. Similarly, when the another <NUM> terminal served by the first access layer device performs <NUM> time synchronization with the first access layer device based on the <NUM> protocol, the another <NUM> terminal may also obtain the <NUM> ID, sent by the first access layer device, of the first access layer device. <NUM> terminals may summarize received <NUM> IDs to the <NUM> terminal management device. A <NUM> terminal may determine that a <NUM> terminal that obtains a <NUM> ID, of an access layer device, the same as that of the <NUM> terminal is served by a same access layer device as the <NUM> terminal, and the <NUM> terminal management device may notify the <NUM> device of an identifier or a communication address (for example, a media access control (media access control, MAC) address) of another <NUM> terminal served by the same access layer device as the <NUM> device.

The first <NUM> terminal may directly send the <NUM> time offset value determined by the first <NUM> terminal to another <NUM> terminal served by a same access layer device. For example, the first <NUM> terminal may send the <NUM> time offset value to the another <NUM> terminal through an X2 interface.

The first <NUM> terminal may alternatively send the <NUM> time offset value to the another <NUM> terminal through the <NUM> terminal management device. Specifically, the first <NUM> terminal may send the <NUM> time offset value to the <NUM> terminal management device; the <NUM> terminal management device determines, based on an identifier of the first <NUM> terminal and a network topology relationship, the second <NUM> terminal connected to the same access layer device as the first <NUM> terminal, and sends the <NUM> time offset value to the second <NUM> terminal; and the second <NUM> terminal performs <NUM> time synchronization based on the <NUM> time offset value.

If there are a plurality of <NUM> terminals that are served by a same access layer device and that have a capability of obtaining a GPS time from a GPS clock source, the <NUM> terminal management device may designate a <NUM> terminal to determine a <NUM> time offset value, the designated <NUM> terminal transfers and shares the offset value, and then another <NUM> terminal served by the access layer device uses the shared <NUM> time offset value to perform compensation. Alternatively, the <NUM> terminals that have the capability of obtaining a GPS time from a GPS clock source transfer and share <NUM> time offset values determined by the <NUM> terminals, a <NUM> terminal that has the capability of obtaining a GPS time from a GPS clock source preferentially uses a value determined by the <NUM> terminal to perform compensation, and a <NUM> terminal that does not have the capability of obtaining a GPS time from a GPS clock source uses an average value of the <NUM> time offset values shared by all the <NUM> terminals that are served by the same access layer device and that have the capability of obtaining a GPS time from a GPS clock source to perform compensation.

For example, with reference to <FIG>, <NUM> terminals connected to an access layer device <NUM> include the <NUM> terminal <NUM>, the <NUM> terminal <NUM>, and a <NUM> terminal <NUM>. The <NUM> terminal <NUM> and the <NUM> terminal <NUM> have the capability of obtaining a GPS time, so that either of the <NUM> terminal <NUM> and the <NUM> terminal <NUM> may be designated by the <NUM> terminal management device to determine a <NUM> time offset value, and the <NUM> terminal <NUM>, the <NUM> terminal <NUM>, and the <NUM> terminal <NUM> share the <NUM> time offset value. Alternatively, the <NUM> terminal <NUM> and the <NUM> terminal <NUM> each determine a <NUM> time offset value, and the <NUM> terminal <NUM>, the <NUM> terminal <NUM>, and the <NUM> terminal <NUM> share the <NUM> time offset value. In this case, the <NUM> terminal <NUM> or the <NUM> terminal <NUM> preferentially uses the <NUM> time offset value determined by the <NUM> terminal <NUM> or the <NUM> terminal <NUM> to perform compensation, and the <NUM> terminal <NUM> uses an average value of the two <NUM> time offset values determined by the <NUM> terminal <NUM> and the <NUM> terminal <NUM> to perform compensation.

Determining of a <NUM> time offset value, compensation for a <NUM> time, and transferring of the <NUM> time offset value may be performed aperiodically or periodically, or may be performed according to an instruction.

According to this embodiment of this application, a <NUM> terminal that has a capability of obtaining a GPS time obtains a GPS time. Because precision of the GPS time is higher than precision of a <NUM> time, the GPS time may be used as a reference time, and an offset between the GPS time and the <NUM> time is determined, that is, a <NUM> time offset value is determined. In this way, the <NUM> time may be compensated for at the end, so that the precision of the <NUM> time may reach or be close to the precision of the GPS time. In addition, the <NUM> terminal may send the obtained <NUM> time offset value to another <NUM> device, and another <NUM> device that does not have the capability of obtaining a GPS time can also compensate for a <NUM> time.

<FIG> is a signaling exchange diagram of another <NUM> time synchronization offset adjustment method according to an embodiment of this application. The method shown in <FIG> is an example of the embodiment shown in <FIG>. For example, S610 is an example of S420. For related content in S410 and S430 in <FIG>, refer to related content in S410 and S430 in <FIG>. Specifically, in this embodiment of this application, an example in which a first <NUM> terminal does not have a capability of obtaining a reference time, the reference time is a GPS time, and an upper-level <NUM> device is an access layer device is used for description. It should be noted that the reference time may be another time, for example, a BeiDou navigation satellite system time or a GLONASS time, or may be a time obtained by using another time synchronization protocol; and the upper-level <NUM> device may alternatively be another <NUM> device, for example, a clock server. This is not limited in this embodiment of this application. The method may specifically include the following steps.

S610: The first <NUM> terminal receives a <NUM> time offset value from a third <NUM> terminal. The <NUM> time offset value is a difference between a third <NUM> time and a third GPS time, the third <NUM> time is a <NUM> time obtained by the third <NUM> terminal by synchronizing with the upper-level <NUM> device, and the third GPS time is a GPS time received by the third <NUM> terminal from a GPS clock source.

For example, with reference to <FIG>, the first <NUM> terminal may be a <NUM> terminal <NUM> or a <NUM> terminal <NUM>. In this case, the third <NUM> terminal may be a <NUM> terminal <NUM>.

The first <NUM> terminal may directly receive the <NUM> time offset value from the third <NUM> terminal. For example, the first <NUM> terminal may receive the <NUM> time offset value through an X2 interface.

The first <NUM> terminal may alternatively receive the <NUM> time offset value from the third <NUM> terminal through a <NUM> terminal management device.

For a manner in which the third <NUM> terminal determines the <NUM> time offset value, refer to related content of a manner in which the first <NUM> terminal determines the <NUM> time offset value in <FIG>.

In another embodiment, a <NUM> time obtained through synchronization may be compensated for on an edge bearer device. This reduces an error caused by asymmetric delays on transmit and receive links, and improves precision of the <NUM> time obtained through synchronization.

<FIG> is a signaling exchange diagram of another <NUM> time synchronization offset adjustment method according to an embodiment of this application. The method shown in <FIG> is an example in which an edge bearer device compensates for a <NUM> time obtained through synchronization. The edge bearer device is an access layer device. As shown in <FIG>, the method specifically includes the following steps.

S710: A first <NUM> terminal obtains a first <NUM> time by synchronizing with a first access layer device.

For example, with reference to <FIG>, the first access layer device may be an upper-level <NUM> device of the first <NUM> terminal, the first <NUM> terminal may be a <NUM> terminal <NUM>, a <NUM> terminal <NUM>, a <NUM> terminal <NUM>, or the like, and the first access layer device may be an upper-level <NUM> device, namely, an access layer device <NUM>, of the <NUM> terminal <NUM>, or the first access layer device may be an upper-level <NUM> device, namely, an access layer device <NUM>, of the <NUM> terminal <NUM> and the <NUM> terminal <NUM>.

A manner of obtaining the first <NUM> time may be the time synchronization manner shown with reference to <FIG>. Details are not described again.

S720: The first <NUM> terminal receives a first GPS time from a GPS clock source.

For step S720, refer to related descriptions in S510 in the embodiment shown in <FIG>. Details are not described again.

S730: The first <NUM> terminal determines a <NUM> time offset value. The <NUM> time offset value is a difference between the first <NUM> time and the first GPS time.

For step S730, refer to related descriptions in S520 in the embodiment shown in <FIG>. Details are not described again.

S740: The first <NUM> terminal sends the <NUM> time offset value to the first access layer device.

The first <NUM> terminal may report the <NUM> time offset value through a dedicated interface or a message.

The first <NUM> terminal may report the <NUM> time offset value aperiodically or periodically, or may report the <NUM> time offset value according to an instruction of a <NUM> terminal management device.

For example, with reference to <FIG>, the first <NUM> terminal may be the <NUM> terminal <NUM>, the <NUM> terminal <NUM>, or the <NUM> terminal <NUM>. The first access layer device may be the access layer device <NUM> or the access layer device <NUM>.

S750: The first access layer device obtains a second <NUM> time by synchronizing with an upper-level <NUM> device. The upper-level bearer network device is an upper-level device of the first access layer device.

The upper-level <NUM> device of the first access layer device may be an access layer device or an aggregation layer device. For example, with reference to <FIG>, an upper-level <NUM> device of the access layer device <NUM> is an access layer device, and an upper-level <NUM> device of the access layer device <NUM> is an aggregation layer device.

A manner of obtaining the second <NUM> time may be the time synchronization manner shown with reference to <FIG>. Details are not described again. In this embodiment of this application, because the first access layer device includes a clock of a port and a clock of an internal system, the second <NUM> time may be a <NUM> time obtained through synchronization by the clock of the port, or may be a <NUM> time obtained through synchronization by the clock of the internal system.

In addition, step S750 may be performed after the first access layer device receives the <NUM> time offset value, or may be performed before the <NUM> time offset value is received.

S760: The first access layer device compensates for the second <NUM> time based on the <NUM> time offset value.

The first access layer device may perform, based on the <NUM> time offset value, compensation in the internal system or on the port of the first access layer device. The port of the first access layer device may be classified into a client-side port or a line-side port. The client-side port is connected to a <NUM> device, and the line-side port is connected to a bearer network device. The bearer network device may be an access layer device or an aggregation layer device.

For example, after receiving the <NUM> time offset value, the first access layer device may compensate for a <NUM> time obtained through synchronization by the clock of the internal system of the first access layer device. After compensating for the <NUM> time obtained through synchronization, the first access layer device may synchronize a <NUM> time obtained after compensation to the clock of the port of the first access layer device. In this way, a <NUM> time obtained through synchronization by a <NUM> terminal from the port of the first access layer device is the <NUM> time obtained after compensation.

For another example, the first access layer device may compensate for a <NUM> time obtained through synchronization by a clock of the client-side port. In this case, a <NUM> time obtained through synchronization by the <NUM> terminal connected to the client-side port of the first access layer device from the port is a <NUM> time obtained after compensation.

In addition, when performing time synchronization with a <NUM> terminal, the first access layer device may further compensate, based on the <NUM> time offset value, for a timestamp sent to the <NUM> terminal. In this case, with reference to <FIG>, any one or more of a timestamp t<NUM> and a timestamp t<NUM> that are received by the <NUM> terminal are values obtained after compensation is performed based on the <NUM> time offset value, where the timestamp t<NUM> is obtained based on the <NUM> time offset value and a timestamp, at a moment t<NUM>, of the client-side port of the first access layer device, and the timestamp t<NUM> is obtained based on the <NUM> time offset value and a timestamp, at a moment t<NUM>, of the client-side port of the first access layer device.

For another example, the first access layer device may compensate, based on the <NUM> time offset value, for a <NUM> time obtained through synchronization by a clock of the line-side port, and synchronize a <NUM> time obtained after compensation on the line-side port with the clock of the internal system and the clock of the client-side port, to further synchronize the <NUM> time to a <NUM> terminal.

In addition, when the first access layer device performs <NUM> time synchronization with the upper-level bearer device, the first access layer device may compensate, based on the <NUM> time offset value, for a received timestamp sent by the upper-level bearer device. In this case, with reference to <FIG>, when a time offset O is calculated, the time offset O is calculated after compensation is performed, based on the <NUM> time offset value, for either or both of a timestamp t<NUM> and a timestamp t<NUM>, where the timestamp t<NUM> is a timestamp, at a moment t<NUM>, of a client-side port of the upper-level bearer device, and the timestamp t<NUM> is a timestamp, at a moment t<NUM>, of a line-side port of the upper-level bearer device. Alternatively, the time offset O may be calculated after compensation is performed, based on the <NUM> time offset value, for either or both of a timestamp t<NUM> and a timestamp t<NUM>, where the timestamp t<NUM> is a timestamp, at a moment t<NUM>, of the line-side port of the first access layer device, and the timestamp t<NUM> is a timestamp, at a moment t<NUM>, of the line-side port of the first access layer device.

For example, with reference to <FIG>, the first access layer device may be the access layer device <NUM>, and the first <NUM> terminal may be the <NUM> terminal <NUM>. The <NUM> terminal <NUM> may perform <NUM> time synchronization with the access layer device <NUM>, to obtain the first <NUM> time. The <NUM> terminal <NUM> may obtain the first GPS time through a satellite system <NUM>, and may determine the <NUM> time offset value based on the first <NUM> time and the first GPS time. The <NUM> terminal <NUM> may send the <NUM> time offset value to the access layer device <NUM>. The access layer device <NUM> may compensate for a <NUM> time obtained through synchronization from an access layer device <NUM>, or the access layer device may compensate for a <NUM> time synchronized to the <NUM> terminal <NUM>, a <NUM> terminal <NUM>, or a <NUM> terminal <NUM>. The access layer device <NUM> may alternatively compensate for a time inside the access layer device. When delays on transmit and receive links inside an access ring <NUM> are symmetric, the access layer device <NUM> may further synchronize the <NUM> time offset value to an access layer device <NUM>, the access layer device <NUM>, and an access layer device <NUM>.

In addition, there may be a plurality of <NUM> terminals that are served by the first access layer device and that have a capability of obtaining a GPS time. In this case, the <NUM> terminal management device may designate a <NUM> terminal to determine a <NUM> time offset value, and the designated <NUM> terminal transfers and shares the offset value, and sends the <NUM> time offset value to the first access layer device. Alternatively, the <NUM> terminals that have the capability of obtaining a GPS time from a GPS clock source determine and upload <NUM> time offset values. Based on this, when the first access layer device performs <NUM> time compensation, a <NUM> time offset value determined by a <NUM> terminal that has the capability of obtaining a GPS time from a GPS clock source is preferentially used to perform compensation on a port connected to the <NUM> terminal, and an average value of the <NUM> time offset values uploaded by the <NUM> terminals that are served by the first access layer device and that have the capability of obtaining a GPS time from a GPS clock source is used to perform compensation on a port connected to a <NUM> terminal that does not have the capability of obtaining a GPS time from a GPS clock source.

Then, the first access layer device may send the <NUM> time offset value to a bearer network management device, so that the bearer network management device monitors a bearer network device based on the <NUM> time offset value. In addition, the first access layer device may directly compensate for the second <NUM> time based on the <NUM> time offset value, or may compensate for the second <NUM> time based on an indication of the bearer network management device. The bearer network management device has identifiers of access layer devices. After receiving a <NUM> time offset value reported by an access layer device, the bearer network management device may indicate the access layer device to perform a compensation operation in an instruction triggering manner. Based on this, the method may include the following step: The first access layer device receives indication information from the bearer network management device, where the indication information is used to indicate the first access layer device to compensate for the second <NUM> synchronization time based on the <NUM> time offset value.

In another embodiment, when delays on transmit and receive links of an access ring are symmetric, access layer devices on the same access ring may share a <NUM> time offset value. Based on the foregoing steps, this embodiment of this application may further include the following steps.

S770: The first access layer device sends the <NUM> time offset value to a second access layer device, where both the first access layer device and the second access layer device are located on a first access ring, and delays on transmit and receive links of the first access ring are symmetric.

That delays on transmit and receive links of an access ring are symmetric may mean that a delay on a transmit link of the access ring and a delay on a receive link of the access ring are the same. For example, single-fiber bidirectional deployment may be used between the access layer devices on the access ring. For another example, whether the delays on the transmit and receive links of the access ring are symmetric may be determined by the bearer network management device, and the bearer network management device may determine, through measurement and calculation, or through predefinition, whether the delays on the transmit and receive links of the access ring are symmetric.

For example, with reference to <FIG>, delays on transmit and receive links of the access ring <NUM> or an access ring <NUM> are symmetric, the first access layer device may be the access layer device <NUM>, and the second access layer device may be the access layer device <NUM>, the access layer device <NUM>, or the access layer device <NUM>. Alternatively, the first access layer device is the access layer device <NUM>, and the second access layer device is an access layer device <NUM>, an access layer device <NUM>, or an access layer device <NUM>.

In addition, the first access layer device may send the <NUM> time offset value to the second access layer device through the bearer network management device. The bearer network management device has identifiers of access layer devices. After receiving the <NUM> time offset value reported by the first access layer device, the bearer network management device may send the <NUM> time offset value to the second access layer device that is on a same access ring as the first access layer device.

S780: The second access layer device obtains a third <NUM> time by synchronizing with an upper-level <NUM> device.

The upper-level <NUM> device of the second access layer device may be an access layer device or an aggregation layer device. For example, with reference to <FIG>, an upper-level <NUM> device of the access layer device <NUM> is an aggregation layer device, and an upper-level device of the access layer device <NUM> is an access layer device.

A manner of obtaining the third <NUM> time may be the time synchronization manner shown with reference to <FIG>. Details are not described again.

The upper-level <NUM> device is a core layer device or a clock server.

In addition, step S780 may be performed before the second access layer device receives the <NUM> time offset value, or may be performed after the second access layer device receives the <NUM> time offset value.

S790: The second access layer device compensates for the third <NUM> time based on the <NUM> time offset value.

The second access layer device may perform, based on the <NUM> time offset value, compensation in an internal system or on a port of the second access layer device. This process is similar to a process of performing <NUM> time compensation by the first access layer device in step S760, and the two processes may be understood with reference to each other.

If the second access layer device receives <NUM> time offset values sent by a plurality of access layer devices on the same access ring, the second access layer device may compensate for the third <NUM> time based on an average value of <NUM> time offset values sent by all access layer devices of the first access ring.

In addition, when an active/standby link change occurs in a bearer network due to factors such as fault-triggered switchover, a synchronization time offset may be caused. When compensation for a <NUM> time cannot be processed in real time, the following solution may be used to supplement the embodiment shown in <FIG>, to improve stability of the overall solution.

The bearer network senses the active/standby link change as soon as possible. Therefore, a bearer network device may measure a relative offset value between active and standby paths and perform compensation based on the relative offset value. This ensures that compensation can be performed for a standby path based on the relative offset value before and after link switching, so that a path (absolute) offset from an end device is consistent after the link change.

Specifically, a passive (passive) port may be configured on the standby path, the compensation offset (offset) between the active and standby paths is measured, and when switchover occurs in the bearer network, compensation is automatically performed on the port based on the relative offset between the active and standby paths before and after the switchover.

Ports are classified into three types: a master port (an M port in <FIG>), a slave port (an S port in <FIG>), and a passive port (a P port in <FIG>). The slave port obtains, through synchronization, a <NUM> time from an upper-level master port based on the <NUM> protocol.

Further, a passive port may be configured on a <NUM> ring breaking node (including a standby port that may be enabled due to path switching) at a core layer, an aggregation layer, or an access layer. With reference to <FIG>, a link between an aggregation layer device <NUM> and an aggregation layer device <NUM> is a standby link, and a port that is on the aggregation layer device <NUM> and that is connected to the aggregation layer device <NUM> may be configured as a passive port. When a link between the aggregation layer device <NUM> and an aggregation layer device <NUM> fails, the link between the aggregation layer device <NUM> and the aggregation layer device <NUM> is enabled, and compensation is performed on the passive port based on a compensation offset (offset) between the active and standby paths.

In addition, each passive port may report a measured offset offset (namely, an offset between ports of active and standby paths) to a transmission network control device. After a fault occurs, a path is automatically reselected. The transmission network control device performs compensation on a local passive port or a peer port of the local passive port based on an offset offset of the passive port before the fault. In addition, if the local passive port is changed to a slave port after path switchover, compensation is performed on the passive port based on the offset. If the peer port of the passive port is changed to a slave port after path switchover, compensation is performed on the peer port of the passive port based on a negative value of the offset. After the compensation, path offsets of a clock obtained by a base station are consistent before and after the switchover.

The passive port is defined based on the <NUM> protocol and can measure a delay offset between active and standby paths.

According to this embodiment of this application, the first access layer device may compensate for an offset of a <NUM> time at the end of a bearer network, to compensate for the <NUM> time at an edge of a synchronization network, that is, compensate for an offset caused by asymmetry of end to end (end to end, E2E) optical fibers, and compensate for a fixed offset inside a device in the synchronization network. Therefore, measurement and compensation do not need to be performed node by node, labor costs are greatly reduced, and precision of the <NUM> time is improved.

<FIG> is a schematic structural diagram of a <NUM> time offset adjustment apparatus according to an embodiment of this application. The apparatus may be configured to perform the method performed by the <NUM> terminal in <FIG>, <FIG>, or <FIG>. The apparatus specifically includes:.

Optionally, the apparatus further includes:
a first receiving unit, configured to receive a first global positioning system GPS time from a GPS clock source, where the <NUM> time offset value is a difference between the first <NUM> time and the first GPS time.

Optionally, the apparatus further includes:
a first sending unit, configured to send the <NUM> time offset value to a second <NUM> terminal, where the <NUM> time offset value is used to compensate for a second <NUM> time, and the second <NUM> time is a <NUM> synchronization time obtained by the second <NUM> terminal by synchronizing with the upper-level <NUM> device of the apparatus.

Optionally, the apparatus further includes:
a second receiving unit, configured to receive first indication information from a <NUM> terminal management device, where the first indication information is used to indicate the first <NUM> terminal to send the <NUM> time offset value to the second <NUM> terminal.

Optionally, the apparatus further includes:
a second sending unit, configured to send the <NUM> time offset value to the second <NUM> terminal through the <NUM> terminal management device.

Optionally, the determining unit <NUM> is specifically configured to:
receive the <NUM> time offset value from a third <NUM> terminal, where the <NUM> time offset value is a difference between a third <NUM> time and a third GPS time, the third <NUM> time is a <NUM> time obtained by the third <NUM> terminal by synchronizing with the upper-level <NUM> device of the apparatus, and the third GPS time is a GPS time received by the third <NUM> terminal from a GPS clock source.

Optionally, the determining unit <NUM> is specifically configured to:
receive the <NUM> time offset value from the third <NUM> terminal through a <NUM> terminal management device.

<FIG> is a schematic structural diagram of another <NUM> time offset adjustment apparatus according to an embodiment of this application. The apparatus may be configured to perform the method performed by the <NUM> terminal in <FIG>. The apparatus specifically includes:.

<FIG> is a schematic structural diagram of another <NUM> time offset adjustment apparatus according to an embodiment of this application. The apparatus may be configured to perform the method performed by the access layer device in <FIG>. The apparatus specifically includes:.

Optionally, the compensation unit <NUM> is specifically configured to:.

Optionally, the apparatus further includes:
a sending unit, configured to send the <NUM> time offset value to a bearer network management device.

Optionally, the receiving unit <NUM> is further configured to receive indication information from the bearer network management device, where the indication information is used to indicate the compensation unit <NUM> to compensate for the fourth <NUM> time based on the <NUM> time offset value.

Optionally, the receiving unit <NUM> is specifically configured to:
receive the <NUM> time offset value from a first <NUM> terminal, where the <NUM> time offset value is a difference between a first <NUM> time and a first GPS time, the first <NUM> time is a <NUM> time obtained by the first <NUM> terminal by synchronizing with the first access layer device, and the first GPS time is a GPS time received by the first <NUM> terminal from a GPS clock source.

Optionally, the sending unit is further configured to: send the <NUM> time offset value to a second access layer device, where the <NUM> time offset value is used to compensate for a fifth <NUM> time obtained by the second access layer device by synchronizing with an upper-level <NUM> device of the second access layer device, where
both the first access layer device and the second access layer device are located on a first access ring, and delays on transmit and receive links of the first access ring are symmetric.

Optionally, the sending unit is further configured to: send the <NUM> time offset value to the second access layer device through a bearer network management device.

Optionally, the receiving unit <NUM> is further configured to: receive the <NUM> time offset value from a third access layer device, where the <NUM> time offset value is a difference between a sixth <NUM> time and a sixth GPS time, the sixth <NUM> time is a <NUM> time obtained by a fourth <NUM> terminal by synchronizing with the third access layer device, and the sixth GPS time is a GPS time received by the fourth <NUM> terminal from a GPS clock source, where
both the first access layer device and the third access layer device are located on a first access ring, and delays on transmit and receive links of the first access ring are symmetric.

<FIG> is a schematic structural diagram of a <NUM> terminal according to an embodiment of this application. As shown in <FIG>, the <NUM> terminal includes a communications module <NUM>, a processor <NUM>, and a memory <NUM>, where the memory <NUM> is configured to store a program; the communications module <NUM> is configured to interact with an access layer device or a <NUM> terminal; and the processor <NUM> is configured to execute the program stored in the memory <NUM>, to control the <NUM> terminal to perform the method, in <FIG>, <FIG>, or <FIG>, performed by the <NUM> terminal that does not have the capability of obtaining a reference time.

<FIG> is a schematic structural diagram of another <NUM> terminal according to an embodiment of this application. The <NUM> terminal includes a communications module <NUM>, a GPS transceiver <NUM>, a processor <NUM>, and a memory <NUM>, where the memory <NUM> is configured to store a program; the communications module <NUM> is configured to interact with an access layer device, a <NUM> terminal, or a <NUM> terminal management device; the GPS transceiver <NUM> is configured to receive a GPS time; and the processor <NUM> is configured to execute the program stored in the memory <NUM>, to control the <NUM> terminal to perform the method, in <FIG>, <FIG>, <FIG>, or <FIG>, performed by the <NUM> terminal that has a capability of obtaining a reference time.

<FIG> is a schematic structural diagram of an access layer device according to an embodiment of this application. The access layer device includes a communications module <NUM>, a processor <NUM>, and a memory <NUM>. The memory <NUM> is configured to store a program. The communications module <NUM> is configured to interact with a <NUM> terminal, a bearer network device, or a bearer network management device. The communications module <NUM> may include a plurality of ports, which are separately used to communicate with the <NUM> terminal and the bearer network device. A working mode of a port through which the communications module <NUM> communicates with the <NUM> terminal may be a <NUM> master mode, and a working mode of a port through which the communications module <NUM> communicates with the bearer network device may be a <NUM> slave mode, or may be the <NUM> master mode. The bearer network device includes an access layer device. The processor <NUM> is configured to execute the program stored in the memory <NUM>, to control the access layer device to perform the method, in <FIG>, <FIG>, <FIG>, or <FIG>, performed by the access layer device.

All or some of the foregoing embodiments of this application may be implemented by software, hardware, firmware, or any combination thereof. When software is used to implement the embodiments, the embodiments may be implemented completely or partially in a form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the procedures or the functions according to the embodiments of this application are completely or partially generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or another programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a computer-readable medium to another computer-readable medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line (digital subscriber line, DSL)) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by a computer, or a data storage device, such as a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, a solid-state drive (solid state disk, SSD)), or the like.

Claim 1:
A time offset adjustment method performed by a first terminal of a communication system supporting the IEEE 1588v2 protocol or a protocol evolved based on the IEEE 1588v2 protocol, the method comprising the steps of:
• obtaining (S <NUM>) a first clock time by synchronizing with an upper-level device of the first terminal;
• receiving (S <NUM>) a first satellite system time from a satellite system clock source;
• determining (S <NUM>) a time offset value, wherein the time offset value is a difference between the first clock time and the first satellite system time;
• adjusting (S <NUM>) the first clock time based on the time offset value;
• sending (S <NUM>) the time offset value to a second terminal of the communication system, wherein the time offset value is used to adjust a second clock time, and the second clock time is a synchronization time obtained by the second terminal by synchronizing with the upper-level device of the first terminal.