Clock source selection method, apparatus and communication system

By determining the clock source according to the clock level and identification relationship, the problem of low time synchronization accuracy in the prior art is solved, and higher time synchronization accuracy and lower time deviation are achieved, which is suitable for 5G services.

WO2025103086A1PCT designated stage expired Publication Date: 2025-05-22HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/126144
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-11-13
Filing Date
2024-10-21
Publication Date
2025-05-22

AI Technical Summary

Technical Problem

In the existing 1588 synchronization technology, determining the clock source based on the optimal master clock source selection algorithm can easily lead to low time synchronization accuracy.

Method used

By obtaining the data set of clock level and identification, the clock source is determined according to the clock level threshold and identification relationship, which can be the root clock source or the main clock source, and the clock level threshold can be configured.

Benefits of technology

It improves the time synchronization accuracy, reduces the time deviation between different devices, and ensures that the time deviation between base stations is within 3us, which is suitable for 5G services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024126144_22052025_PF_FP_ABST
    Figure CN2024126144_22052025_PF_FP_ABST
Patent Text Reader

Abstract

A clock source selection method, an apparatus and a communication system, belonging to the technical field of communications. The method comprises: a first device acquires a first data set and a second data set, the first data set comprising a first clock level and a first clock identifier, and the second data set comprising a second clock identifier; and when the first clock level is not superior to a clock level threshold, the first device determines a clock source according to the first clock identifier and the second clock identifier, the clock level threshold being configurable. The present application can improve the time synchronization precision, and improve the flexibility of clock source selection.
Need to check novelty before this filing date? Find Prior Art

Description

Clock source selection method and device, and communication system

[0001] This application claims priority to Chinese patent application filed on November 13, 2023, with application number 202311517550.6 and application name “Clock source selection method and device, communication system”, all contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of communication technology, and in particular to a clock source selection method and device, and a communication system. Background Art

[0003] To ensure service transmission requirements, different devices in the network need to be time synchronized to minimize time deviations between them. For example, the time deviations between different base stations in the network should be within 3 microseconds. That is, the time deviation between each base station's time and an absolute time reference should be within + / - 1.5 microseconds (i.e., [-1.5 microseconds, +1.5 microseconds]). The absolute time reference can be the time of a satellite system, such as the Global Positioning System (GPS) or the BeiDou Positioning System.

[0004] Currently, 1588 synchronization technology can be used to achieve time synchronization between different devices. Specifically, two 1588 servers can be deployed in a network. Each 1588 server receives satellite signals from a satellite system and synchronizes with the satellite system's time based on the received satellite signals. Based on the status of the received satellite signals, each 1588 server sends a 1588 message carrying grandmaster (GM) clock information. Based on the GM information carried in the received 1588 message, devices in the network select one of the two 1588 servers as the clock source according to the best master clock (BMC) selection algorithm and synchronize with the clock source. The full name of the grandmaster clock is grandmaster clock, and its corresponding English abbreviation is GMC. In relevant standards, the full name of the grandmaster clock is abbreviated as grandmaster, and its corresponding English abbreviation is GM. The grandmaster clock is also called the grandmaster clock. Depending on the actual situation, the clock source selected by any device in the network can be either the grandmaster clock source or the master clock source. The master clock source is the previous hop device of the device (which may be a 1588 server or another network device) and is on the 1588 synchronization path. The root clock source is the source device tracked by the device (for example, a 1588 server).

[0005] However, determining the clock source based on the current BMC source selection algorithm can easily lead to low time synchronization accuracy.

[0006] Summary of the Invention

[0007] The present application provides a clock source selection method and device, and a communication system, which can improve time synchronization accuracy. The technical solution of the present application is as follows.

[0008] In a first aspect, a clock source selection method is provided, the method comprising: a first device obtaining a first data set and a second data set, the first data set including a first clock level and a first clock identifier, and the second data set including a second clock identifier; if the first clock level is not greater than a clock level threshold, the first device determining a clock source based on the first clock identifier and the second clock identifier, wherein the clock level threshold is configurable. After the first device determines the clock source, the first device performs time synchronization based on a clock message (e.g., a 1588 message) received from the clock source.

[0009] Among them, depending on the relationship between the first clock identifier and the second clock identifier, the clock source determined by the first device based on the first clock identifier and the second clock identifier can be a root clock source or a master clock source. For example, when the first clock identifier and the second clock identifier are different, the clock source determined by the first device based on the first clock identifier and the second clock identifier is the root clock source. When the first clock identifier and the second clock identifier are the same, the clock source determined by the first device based on the first clock identifier and the second clock identifier is the master clock source. The root clock source is GM, the master clock source is the previous hop device of the first device and the master clock source is in the clock synchronization path (for example, the 1588 synchronization path).

[0010] The technical solution provided by the present application indicates that when the first clock level is not better than the clock level threshold, the clock performance corresponding to the first clock level is relatively poor (for example, the clock accuracy is relatively low). Therefore, the first device determines the clock source based on the first clock identifier and the second clock identifier. As a result, when the first clock level is not better than the clock level threshold, the clock sources determined by different devices can be the same clock source. For example, when the first clock level is not better than the clock level threshold and the first clock identifier and the second clock identifier are different, the clock sources determined by different devices can be the same clock source. Different devices can track the same clock source, which can reduce the difference in time synchronization accuracy between different devices, improve time synchronization accuracy, and ensure that the time deviation between different devices (for example, base stations) is maintained within the required range (for example, 3us). In addition, because the clock level threshold is configurable, the first device has high flexibility in determining the clock source based on the first clock level and the flexibly configured clock level threshold, and can ensure that the clock level threshold is compatible with the current International Telecommunication Union-Telecommunication Standardization Sector (ITU-T) G.8275.1 standard and ITU-T G.8275.2 standard. This application can ensure that the time deviation between different devices (such as base stations) is maintained within the required range (such as 3us), ensuring that the fifth-generation mobile communication technology (5G) services can work normally.

[0011] Optionally, the first data set includes a first hop count, and the second data set includes a second hop count. The method further includes: when the first clock grade is greater than the clock grade threshold, the first device determines a clock source based on the first hop count and the second hop count. For example, the first device determines the clock source based on the first hop count and the second hop count according to the shortest path principle. The clock source determined by the first device based on the first hop count and the second hop count includes a root clock source and / or a master clock source. For example, the first data set corresponds to a first clock message, and the second data set corresponds to a second clock message. The first hop count is the number of hops traversed by the first clock message, and the second hop count is the number of hops traversed by the second clock message. The first device determines the minimum of the first and second hop counts, and determines the clock source based on the clock message corresponding to the minimum hop count. For example, the first device determines the transmission path of the clock message corresponding to the minimum hop count as a clock synchronization path (e.g., a 1588 synchronization path), and the first device determines the previous hop device on the clock synchronization path as the clock source. If the previous hop device is a clock server, the clock source is the master clock source and also the root clock source. If the previous-hop device is a device between the clock server and the first device, the clock source is the primary clock source, and the clock server is the root clock source. After the first device determines the clock source based on the clock message corresponding to the minimum hop count, the first device adjusts its time based on the time information carried in the clock message corresponding to the minimum hop count to synchronize with the clock source.

[0012] The technical solution provided by the present application indicates that when the first clock level is better than the clock level threshold, the clock performance corresponding to the first clock level is relatively good (for example, the clock accuracy is relatively high). Therefore, the first device determines the clock source based on the first hop count and the second hop count. This allows the clock message corresponding to the clock source determined by the first device (for example, the clock message received directly or indirectly from the clock source by the first device) to reach the first device through a smaller number of hops (for example, the minimum), which helps to improve the time synchronization accuracy of the first device (the clock accuracy error carried by the clock message deteriorates each time the clock message passes through a device. The clock message corresponding to the clock source determined by the first device passes through fewer devices when it reaches the first device, and the clock accuracy carried by the clock message is higher). In the present application, the clock message originates from a clock server, the clock message originating from any clock server originates from the clock server, the source end of the clock message originating from any clock server is the clock server, and the source address of the clock message originating from any clock server is the address of the clock server. The clock message originating from any clock server includes at least one of the following: a clock message generated by the clock server, a clock message generated based on the clock message generated by the clock server (for example, a new clock message obtained by modifying the clock message generated by the clock server, the modification including modifying, adding or deleting information in the clock message).

[0013] Optionally, the first clock level not being better than the clock level threshold includes the first clock level being greater than the clock level threshold. Correspondingly, the first clock level being better than the clock level threshold includes the first clock level being less than or equal to (i.e., not greater than) the clock level threshold. Optionally, the clock level threshold is a clock level used to characterize a state in which a clock device is normally tracking a time signal, for example, the clock level threshold is 6. The time signal may be a satellite signal. The clock device may be a clock server or other device with a clock function. For example, the clock device may be a clock server or a network device connected between the clock server and the first device.

[0014] The technical solution provided by the present application is that, when the clock level threshold is a clock level used to characterize the state of a clock device normally tracking a time signal and the first clock level is greater than the clock level threshold (that is, the first clock level is not better than the clock level threshold), it indicates that the clock performance of the clock device is relatively poor. For example, the clock device loses the time signal. Specifically, it may be that the clock device loses the time signal and the clock device is in a state of maintaining time availability (that is, the clock device loses the time signal and the clock performance of the clock device is available), or the clock device loses the time signal and the clock performance of the clock device is unavailable. In this case, the first device determines the clock source based on the first clock identifier and the second clock identifier, so that the clock sources determined by different devices can be the same clock source, and different devices can track the same clock source, which can improve the time synchronization accuracy and ensure that the time deviation between different devices (such as base stations) is maintained within the required range (for example, 3us). When the clock level threshold is a clock level used to characterize the state of a clock device tracking a time signal normally, and the first clock level is less than or equal to the clock level threshold (i.e., the first clock level is better than the clock level threshold), it indicates that the clock performance of the clock device is relatively good. For example, the clock device is in a state of tracking a time signal normally, and the clock device has not experienced time signal loss. In this case, the first device determines the clock source based on the first hop count and the second hop count. For example, the first device determines the clock source based on the first hop count and the second hop count according to the shortest path principle, thereby making the number of hops that the clock message corresponding to the clock source determined by the first device passes through when it reaches the first device smaller (e.g., minimum), which helps to improve the accuracy of time synchronization and ensure that the time deviation between different devices (e.g., base stations) is maintained within the required range (e.g., 3us). The availability or unavailability of the clock performance of the clock device refers to whether the performance of the time signal output by the clock device is available or unavailable.

[0015] Optionally, the first clock level not being better than the clock level threshold includes the first clock level being greater than or equal to (i.e., not less than) the clock level threshold. Correspondingly, the first clock level being better than the clock level threshold includes the first clock level being less than the clock level threshold. Optionally, the clock level threshold is a clock level used to characterize a state in which a time signal of a clock device is lost and the clock device is in a state of maintaining time availability, for example, the clock level threshold is 7. The time signal may be a satellite signal. The clock device may be a clock server or other device having a clock function. For example, the clock device may be a clock server or a network device connected between the clock server and the first device.

[0016] The technical solution provided by the present application, when the clock level threshold is a clock level used to characterize that a clock device has lost its time signal and the clock device is in a state where the time is available and the first clock level is greater than or equal to the clock level threshold (that is, the first clock level is not better than the clock level threshold), indicates that the clock performance of the clock device is relatively poor, for example, the clock device has lost its time signal and the clock device is in a state where the time is available (that is, the clock device has lost its time signal and the clock performance of the clock device is available), or the clock device has lost its time signal and the clock performance of the clock device is unavailable. In this case, the first device determines the clock source based on the first clock identifier and the second clock identifier, thereby enabling the clock sources determined by different devices to be the same clock source, and different devices to track the same clock source, thereby improving the time synchronization accuracy and ensuring that the time deviation between different devices is within the required range (for example, 3us). When the clock level threshold is a clock level used to characterize that a clock device has lost its time signal and that the clock device is in a state of maintaining time availability, and the first clock level is less than the clock level threshold (i.e., the first clock level is greater than the clock level threshold), it indicates that the clock performance of the clock device is relatively good. For example, the clock device is in a state of normal tracking of the time signal and has not lost its time signal. In this case, the first device determines the clock source based on the first hop count and the second hop count. For example, the first device determines the clock source based on the first hop count and the second hop count according to the shortest path principle, thereby reducing the number of hops (e.g., minimum) that a clock message corresponding to the clock source determined by the first device passes when it reaches the first device. This helps to improve time synchronization accuracy and ensure that the time deviation between different devices (e.g., base stations) is maintained within the required range (e.g., 3us). The availability or unavailability of the clock performance of the clock device refers to the availability or unavailability of the performance of the time signal output by the clock device.

[0017] Optionally, the first clock level not being better than the clock level threshold includes the first clock level not being in a clock level set, and the first clock level being better than the clock level threshold includes the first clock level being in the clock level set, and the clock level set is configurable. Optionally, the clock level threshold is in the clock level set, and the clock levels in the clock level set include: a clock level for characterizing a state in which a clock device is tracking a time signal normally, and / or a clock level for characterizing a state in which a time signal is lost and the clock device is available while maintaining time, and / or a default clock level. For example, the clock level for characterizing a state in which a clock device is tracking a time signal normally is 6, the clock level for characterizing a state in which a time signal is lost and the clock device is available while maintaining time is 7, the default clock level is 127, and the clock level set can be any one of the following: {6}, {7}, {127}, {6,127}, {7,127}, {6,7}, {6,7,127}.

[0018] The technical solution provided by the present application is that the clock level threshold is within the clock level set and the clock level set is configurable. Therefore, the clock level threshold is configurable, which can ensure that the clock level threshold is compatible with the current ITU-T G.8275.1 standard and ITU-T G.8275.2 standard. The configuration of the clock level threshold can be achieved by configuring the clock level set. By configuring the clock level threshold, different devices can be flexibly controlled to track the same clock server, or to track multiple clock servers (for example, two clock servers) according to the shortest path principle.

[0019] Optionally, the attribute set (defaultDS) of the first device includes a clock class set (clockClassSet) field, and the clockClassSet field is used to record the clock class set (clockClassSet). The defaultDS of the first device is the default dataset of the first device, and the clockClassSet field included in the defaultDS can be represented as the defaultDS.clockClassSet field.

[0020] Optionally, the attribute set (defaultDS) of the first device includes a clock class threshold (clockClassThreshold) field, which is used to record the clock class threshold (clockClassThreshold). The defaultDS of the first device is the default dataset of the first device, and the clockClassThreshold field included in the defaultDS can be expressed as the defaultDS.clockClassThreshold field. The clock class threshold is also called the clock class threshold.

[0021] Optionally, the first device determines the clock source based on the first clock identifier and the second clock identifier, including: when the first clock identifier and the second clock identifier are different, the first device determines the target clock identifier in the first clock identifier and the second clock identifier, and the first device determines the clock server identified by the target clock identifier as the clock source, and the clock source is the root clock source. For example, the first clock identifier and the second clock identifier are both expressed in numerical values ​​or characters, and the target clock identifier is the smallest clock identifier between the first clock identifier and the second clock identifier.

[0022] Optionally, the first device determines a clock source based on a first clock identifier and a second clock identifier, including: when the first clock identifier and the second clock identifier are the same, the first device determines the clock source based on a first hop count within the first data set and a second hop count within the second data set. The clock source determined by the first device based on the first hop count and the second hop count includes a root clock source and / or a master clock source. For example, the first data set corresponds to a first clock message, the second data set corresponds to a second clock message, the first hop count is the number of hops traversed by the first clock message, and the second hop count is the number of hops traversed by the second clock message. The first device determines the minimum hop count between the first hop count and the second hop count, and the first device determines the clock source based on the clock message corresponding to the minimum hop count. For example, the first device determines the transmission path of the clock message corresponding to the minimum hop count as a clock synchronization path (e.g., a 1588 synchronization path), and the first device determines the previous hop device on the clock synchronization path located on the first device as the clock source. If the previous hop device is a clock server, the clock source is the master clock source, and the clock source is also the root clock source. In the case that the previous-hop device is a device between the clock server and the first device, the clock source is a master clock source, and the clock server is a root clock source.

[0023] Among them, the first clock identifier and the second clock identifier are used to identify the clock server respectively; when the first clock identifier is different from the second clock identifier, it means that the clock server identified by the first clock identifier is different from the clock server identified by the second clock identifier (that is, they are not the same clock server); when the first clock identifier is the same as the second clock identifier, it means that the clock server identified by the first clock identifier is the same as the clock server identified by the second clock identifier (that is, they are the same clock server). Optionally, the first clock identifier and the second clock identifier are both expressed in numerical values ​​or characters. The fact that the first clock identifier is the same as the second clock identifier can also be described as the first clock identifier and the second clock identifier are equal, and the fact that the first clock identifier is different from the second clock identifier can also be described as the first clock identifier and the second clock identifier are not equal.

[0024] Optionally, the first device obtains the first data set and the second data set, including: the first device receives a first clock message and a second clock message, the first device generates the first data set according to the first clock message, and the first device generates the second data set according to the second clock message.

[0025] Optionally, the method further includes: when the first data set and the second data set meet preset conditions, the first device determines whether the first clock level is better than a clock level threshold.

[0026] Optionally, the first data set also includes at least one of the following: a first clock accuracy, a first clock offset scaled log variance, a first clock priority, and a first local priority; the second data set also includes at least one of the following: a second clock class, a second clock accuracy, a second clock offset scaled log variance, a second clock priority, and a second local priority; the first clock accuracy, the first clock offset scaled log variance, the first clock priority, the first local priority, the second clock class, the second clock accuracy, the second clock offset scaled log variance, the second clock priority, and the second local priority are all expressed in numerical values ​​or characters, and the preset conditions include at least one of the following: the first clock class is equal to the second clock class, the first clock accuracy is equal to the second clock accuracy, the first clock offset scaled log variance is equal to the second clock offset scaled log variance, the first clock priority is equal to the second clock priority, and the first local priority is equal to the second local priority.

[0027] Optionally, the first clock level, the first clock identifier, the first clock accuracy, the first clock offset ratio logarithmic variance, and the first clock priority are all GM information carried by the first clock message, and the second clock level, the second clock identifier, the second clock accuracy, the second clock offset ratio logarithmic variance, and the second clock priority are all GM information carried by the second clock message. The local priority is the priority of the port on which the device receives the clock message. For example, the first local priority is the priority of the port on which the first device receives the first clock message, and the second local priority is the priority of the port on which the first device receives the second clock message. For example, the first clock level is the GM clock class in the first data set, the first clock identification is the GM clock identity in the first data set, the first clock accuracy is the GM clock accuracy in the first data set, the first clock offset scaled log variance is the GM clock offset scaled log variance in the first data set, and the first clock priority is GM clock priority2 in the first data set; the second clock level is the GM clock class in the second data set, the second clock identification is the GM clock identity in the second data set, the second clock accuracy is the GM clock accuracy in the second data set, the second clock offset scaled log variance is the GM clock offset scaled log variance in the second data set, and the second clock priority is GM clock priority2 in the second data set.GM clock class, GM clock identity, GM clock accuracy, GM clock offset scaled log variance, and GM clock priority 2 are described in ITU-T G.8275.1 and ITU-T G.8275.2. In the Institute of Electrical and Electronics Engineers (IEEE) 1588 version 2 (v2) IEEE 1588v2 standard, the GM clock class is referred to as GM class, the GM clock identity is referred to as GM identity, the GM clock priority 2 is referred to as GM priority 2, the GM clock accuracy is referred to as GM accuracy, and the GM clock offset scaled log variance is referred to as GM offsetscaledlogvariance.

[0028] Optionally, the clock server is a 1588 server, and the clock message is a 1588 message. The full name of 1588 is IEEE 1588.

[0029] In a second aspect, a clock source selection apparatus is provided, applied to a first device. The clock source selection apparatus includes modules for executing the clock source selection method provided in the first aspect or any optional embodiment of the first aspect. These modules can be implemented based on software, hardware, or a combination of software and hardware, and these modules can be arbitrarily combined or divided based on the specific implementation.

[0030] In a third aspect, a clock source selection device is provided, which is applied to a first device and includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program stored in the memory so that the clock source selection device executes the clock source selection method provided in the first aspect or any optional method of the first aspect.

[0031] In a fourth aspect, a clock source selection apparatus is provided, applied to a first device, comprising a main control board and an interface board, the main control board and the interface board being configured to implement the clock source selection method provided in the first aspect or any optional embodiment of the first aspect. The interface board is also referred to as a circuit board.

[0032] In a fifth aspect, a communication system is provided, comprising a first device and at least two clock devices, wherein the first device comprises a clock source selection device as provided in the second to fourth aspects above, and the first device is used to determine a clock source in the at least two clock devices.

[0033] Optionally, the first device includes any one of the following: a network element (NE) or a base station. A network element is also referred to as a network device, and network elements and base stations are collectively referred to as communication devices. Network elements include routers, switches, packet transport network (PTN) equipment, optical transmission network (OTN) equipment, and the like.

[0034] In a sixth aspect, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed, the clock source selection method provided in the first aspect or any optional method of the first aspect is implemented.

[0035] In a seventh aspect, a computer program product is provided, which includes a program or code, and when the program or code is executed, it implements the clock source selection method provided by the first aspect or any optional method of the first aspect.

[0036] In an eighth aspect, a chip is provided, which includes a programmable logic circuit and / or program instructions, and when the chip is running, is used to implement the clock source selection method provided by the first aspect or any optional method of the first aspect.

[0037] The technical effects of the second to eighth aspects can refer to the technical effects of the first aspect and the optional implementation method of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] FIG1 is a schematic diagram of a 1588 network provided in an embodiment of the present application;

[0039] FIG2 is a schematic diagram of a 1588 network including a 1588 synchronization path provided by an embodiment of the present application;

[0040] FIG3 is a schematic diagram of another 1588 network including a 1588 synchronization path provided by an embodiment of the present application;

[0041] FIG4 is a flow chart of a clock source selection method provided in an embodiment of the present application;

[0042] FIG5 is a flowchart of another clock source selection method provided in an embodiment of the present application;

[0043] FIG6 is a flowchart of another clock source selection method provided in an embodiment of the present application;

[0044] FIG7 is a flowchart of another clock source selection method provided in an embodiment of the present application;

[0045] FIG8 is a flowchart of another clock source selection method provided in an embodiment of the present application;

[0046] FIG9 is a schematic diagram of a first device provided in an embodiment of the present application;

[0047] FIG10 is a schematic diagram of a clock source selection device provided in an embodiment of the present application;

[0048] FIG11 is a schematic diagram of another clock source selection device provided in an embodiment of the present application;

[0049] FIG12 is a schematic diagram of another clock source selection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The embodiments of the present application will be described in further detail below with reference to the accompanying drawings.

[0051] To ensure service transmission requirements, different devices in the network need to be time synchronized to minimize time deviations between them. For example, the current fifth-generation mobile communication technology (5G) requires that the time deviation between base stations be within 3us, that is, the time deviation between each base station's time and the absolute time reference is within + / -1.5us (i.e., [-1.5us, +1.5us]). Therefore, time synchronization is required to ensure that the time deviation between base stations meets this requirement. The absolute time reference can be the time of a satellite system, such as the Global Positioning System (GPS) or the BeiDou Positioning System.

[0052] Currently, two time synchronization technologies exist. One involves installing a satellite signal receiver, such as a GPS or BeiDou receiver, on the device requiring time synchronization (e.g., a base station). The device then synchronizes with the satellite system's time based on the satellite signals received by the receiver. This technology offers high time synchronization accuracy of approximately + / - 0.1us (i.e., [-0.1us, +0.1us]). However, satellite signals are susceptible to interference and can be spoofed, making this technology less secure.

[0053] Another technology is 1588 synchronization technology, which uses a 1588 server to synchronize time between different devices. For example, the 1588 server synchronizes time with the satellite system based on the received satellite signal, and the 1588 server transmits a 1588 message carrying time information to the base station through the bearer network based on the received satellite signal. The base station adjusts the time of the base station based on the time information carried in the received 1588 message to synchronize time. The time synchronization accuracy of the 1588 synchronization technology is around + / -1us (i.e. [-1us, +1us]), which can meet the synchronization requirement of + / -1.5us. In addition, the deployment location of the 1588 server is relatively safe, and interference and security attacks are relatively difficult. The time synchronization process is not easily interfered with or deceived, and has high security. To ensure the security of time synchronization, two 1588 servers are generally deployed in the network. The two 1588 servers each receive satellite signals from a satellite system and synchronize with the satellite system's time based on the received satellite signals. Furthermore, the two 1588 servers each send a 1588 message carrying time information based on the received satellite signals. The devices in the network (including network devices, base stations, etc.) select a clock source (i.e., select a clock source) based on the received 1588 message and synchronize with the selected clock source. For example, the device's time is adjusted based on the time information carried in the 1588 message received from the selected clock source to synchronize the time. The time information carried in the 1588 message sent by each 1588 server is the time information of the 1588 server. Network devices are also referred to as network elements (NEs), which include routers, switches, packet transport network (PTN) devices, optical transmission network (OTN) devices, etc. Network elements and base stations are collectively referred to as communication equipment. Depending on the specific situation, the clock source selected by any device on the network can be either a root clock source or a master clock source. The master clock source is the device's previous hop (which can be a 1588 server or another network device) and is on the 1588 synchronization path. The root clock source is the source device that the device tracks (for example, a 1588 server). During the transmission of 1588 messages on the network, the information carried in the 1588 messages may be modified by devices on the network. Devices can retransmit the 1588 messages after modifying them.

[0054] For the sake of convenience of description, the network that performs time synchronization based on the 1588 synchronization technology is called a 1588 synchronization network, or simply a 1588 network. Figure 1 is a schematic diagram of a 1588 network provided in an embodiment of the present application. As shown in Figure 1, the 1588 network includes 1588 servers 1 to 2, NE1 to 10 (i.e., network elements 1 to 10, network devices 1 to 10), and base stations 1 to 5. The 1588 servers 1 to 2 are respectively connected to the satellite system for communication, and the 1588 servers 1 to 2 are respectively connected to the base stations 1 to 5 for communication through NE1 to 10. The 1588 servers 1 to 2 are respectively used to receive satellite signals from the satellite system, synchronize with the time of the satellite system according to the received satellite signals, and transmit 1588 messages carrying time information to the base stations 1 to 5 through NE1 to 10 according to the received satellite signals. Each of base stations 1 to 5 is configured to select a clock source (i.e., select a clock source) based on the received 1588 message and perform time synchronization with the selected clock source. For example, the time of the base station is adjusted based on the time information carried in the 1588 message received from the selected clock source to synchronize with the clock source. In addition, each of NEs 1 to 10 also selects a clock source based on the received 1588 message and performs time synchronization with the selected clock source. That is, NEs 1 to 10 and base stations 1 to 5 are all devices that require time synchronization. Optionally, NEs 1 to 10 also generate and send a new 1588 message based on the information carried in the received 1588 message, which is similar to modifying and sending part of the content of the received 1588 message, such as modifying the information carried in the 1588 message (e.g., clock accuracy), the number of hops, etc. In the embodiment of the present application, a 1588 message originates from a 1588 server. A 1588 message originating from any 1588 server refers to a 1588 message originating from the 1588 server. The source end of the 1588 message originating from any 1588 server is the 1588 server, and the source address is the address of the 1588 server. Optionally, a 1588 message originating from any 1588 server includes at least one of the following: a 1588 message generated by the 1588 server, a newly generated 1588 message based on a 1588 message generated by the 1588 server (e.g., a new 1588 message obtained by modifying a 1588 message generated by the 1588 server, where the modification includes modifying, adding, or deleting information in the 1588 message).

[0055] In an optional embodiment, 1588 servers 1-2 each include a satellite signal receiver to receive satellite signals transmitted by a satellite system. The satellite system may include multiple satellites, each of which is configured to transmit satellite signals. Optionally, 1588 servers 1-2 are each communicatively connected to base stations 1-5 via a bearer network, with NEs 1-10 belonging to the bearer network. In one example, the bearer network includes an access layer network and a core layer network, with NEs 1-4 belonging to the core layer network and NEs 5-10 belonging to the access layer network.

[0056] Although 1588 servers also receive satellite signals from satellite systems, and the time synchronization process between devices in the 1588 network is also dependent on the satellite signals transmitted by the satellite system, the number of 1588 servers is relatively small, and their deployment locations are relatively secure, making interference and security attacks more difficult. Therefore, the time synchronization process between devices in the 1588 network is less susceptible to interference and spoofing, and is therefore highly secure. When the satellite signal is normal, the time synchronization accuracy of two 1588 servers can reach approximately + / - 0.1us, and both 1588 servers can serve as the root clock source. A normal satellite signal means that the satellite signal is not subject to interference or spoofing, or that the interference is minimal and the satellite signal is not subject to spoofing. For a 1588 server, a normal satellite signal includes at least one of the following: the server is able to receive satellite signals transmitted by at least a preset number of satellites, and the strength of the satellite signal received by the server is greater than a preset strength. When a satellite signal is present, the server is able to track the satellite signal normally and is in a state of normal tracking.

[0057] Currently, there are two clock source selection algorithms (or clock source selection schemes): the best master clock (BMC) selection algorithm defined in the Institute of Electrical and Electronics Engineers (IEEE) 1588 version 2 (v2) standard and the BMC selection algorithm defined in the International Telecommunication Union-Telecommunication Standardization Sector (ITU-T) G.8275.1 standard. Both BMC selection algorithms can be used by devices (including NEs, base stations, etc.) in a 1588 network to determine the clock source and the 1588 status of their own ports. This allows the 1588 synchronization path in the 1588 network to be determined based on the 1588 status of the ports of each device in the 1588 network. The BMC selection algorithm defined in the IEEE 1588v2 standard is also called the default BMC selection algorithm, or simply the default BMC. The 1588 state of a port is also called the 1588 port state. The 1588 state of a port includes the master (M) state, the slave (S) state, or the passive (P) state. A port in the M state is also called an M-port, a port in the S state is also called an S-port, and a port in the P state is also called a P-port.

[0058] However, in the BMC source selection algorithm defined in the IEEE 1588v2 standard, all devices in a 1588 network select the same 1588 server as the clock source (also known as the root clock source) for tracking. Therefore, all devices can only track the same 1588 server. As a result, some devices cannot track 1588 servers that are closer to them (i.e., 1588 servers with a shorter path to them) and can only track 1588 servers that are farther away (i.e., 1588 servers with a longer path to them). For example, some devices cannot select the 1588 server closest to them (i.e., the 1588 server with the shortest path to them) as the clock source (i.e., the root clock source) for tracking according to the shortest path principle. The accuracy of the clock information carried by a 1588 message degrades with each device it passes through. Therefore, rather than selecting a clock server that is farther away as the clock source (also known as the root clock source), selecting a clock server that is closer (for example, the closest) to the device as the clock source (also known as the root clock source) can improve time synchronization accuracy. In other words, for any device, the closer the 1588 server (that is, the one with the shorter path to the device) is to the device as the clock source (also known as the root clock source), the higher the time synchronization accuracy. The farther the 1588 server (that is, the one with the longer path to the device) is to the device as the clock source (also known as the root clock source), the lower the time synchronization accuracy. Because the BMC source selection algorithm defined in the IEEE 1588v2 standard prevents some devices from tracking closer 1588 servers, these devices suffer from lower time synchronization accuracy. In the BMC source selection algorithm defined in the ITU-T G.8275.1 standard, when multiple 1588 servers all experience time signal (e.g., satellite signal) loss and are all in a state where time is maintained and available (a state where time is maintained and available can be referred to as a time-maintaining state), for example, when the clock level of the multiple 1588 servers is all 7, all devices in the 1588 network select the 1588 server closest to them as the clock source (i.e., the root clock source) for tracking based on the shortest path principle. Therefore, different devices may track different 1588 servers among the multiple 1588 servers. Since the multiple 1588 servers are all in a time-maintaining state, the time deviations between the different 1588 servers among the multiple 1588 servers will become larger over time, resulting in larger time deviations between the devices tracking these different 1588 servers, which in turn results in lower time synchronization accuracy for the devices tracking these different 1588 servers.The BMC source selection algorithm in the ITU-T G.8275.2 standard is the same as the BMC source selection algorithm defined in the ITU-T G.8275.1 standard. Therefore, the BMC source selection algorithm in the G.8275.2 standard has the same problems as the BMC source selection algorithm defined in the ITU-T G.8275.1 standard.

[0059] In the BMC source selection algorithm defined in the IEEE 1588v2 standard and the ITU-T G.8275.1 standard, devices in a 1588 network generate a data set containing clock source selection information based on the 1588 messages they receive. Clock source selection is performed based on the clock source selection information in the data set. Each device then determines the 1588 status of its port based on the 1588 messages it receives and the clock source it selects. The clock source selection information includes at least one of time information and hop count (steps removed). The time information can be the time information of the 1588 server corresponding to the 1588 message, the time information can be the grandmaster (GM) information carried in the 1588 message, and the hop count can be the number of hops the 1588 message has traversed. For example, in the IEEE 1588v2 standard, GM information includes GM clock identity, GM clock priority 1, GM clock class, GM clock accuracy, GM clock offset scaled log variance, and GM clock priority 2. In the ITU-T G.8275.1 standard, GM information includes GM clock identity, GM clock class, GM clock accuracy, GM clock offset scaled log variance, and GM clock priority 2. In the ITU-T G.8275.1 standard, clock source selection information also includes local priority, which is the priority of the port on the device used to receive 1588 messages.It should be noted that, for the sake of unified description, the embodiments of the present application describe the GM information in the IEEE 1588v2 standard as GM clock identity, GM clock priority1, GM clock class, GM clock accuracy, GM clock offset scaled log variance and GM clock priority2. In the actual IEEE 1588v2 standard, GM clock class is referred to as GM class, GM clock identity is referred to as GM identity, GM clock priority2 is referred to as GM priority2, GM clock accuracy is referred to as GM accuracy, and GM clock offset scaled log variance is referred to as GM offsetscaledlogvariance.

[0060] The following briefly introduces the BMC source selection algorithm defined in the IEEE 1588v2 standard and the BMC source selection algorithm defined in the G.8275.1 standard with reference to the accompanying figures.

[0061] Please refer to Figure 2, which shows a schematic diagram of a 1588 network including a 1588 synchronization path provided by an embodiment of the present application. The 1588 synchronization path in the 1588 network is a 1588 synchronization path determined according to the BMC source selection algorithm defined in the IEEE 1588v2 standard. Figure 2 introduces the BMC source selection algorithm defined in the IEEE 1588v2 standard. In Figure 2, the small boxes in each device in NE1~10 and base stations 1~5 represent the ports of the device, and the letters "M", "S", and "P" in the small boxes represent the 1588 status of the port represented by the small box ("M" represents M state, "S" represents S state, and "P" represents P state). The meaning of the small boxes in 1588 servers 1~2 and the meaning of the letters in the small boxes are similar. As shown in Figure 2, 1588 servers 1~2 respectively receive satellite signals from the satellite system, synchronize with the time of the satellite system according to the received satellite signals, and transmit 1588 messages to base stations 1~5 through NE1~10 according to the received satellite signals. Each device among NEs 1-10 and base stations 1-5 generates a data set including clock source selection information based on the received 1588 message. Based on the clock source selection information in the data set, the device selects a clock source according to the BMC source selection algorithm defined in the IEEE 1588v2 standard. Furthermore, the device determines the 1588 status of its port (or sets the 1588 status of its port) based on the 1588 message received and the clock source selected by the device. 1588 servers 1-2 also set the 1588 status of their respective ports. For example, each 1588 server among 1588 servers 1 to 2 sets the 1588 state of the port in the 1588 server used for sending 1588 messages to the M state; each NE among NE1 to 10 sets the 1588 state of the port in the NE used for receiving 1588 messages from the clock source selected by the NE to the S state, and sets the 1588 state of the port in the NE used for sending 1588 messages from the clock source selected by the NE to the M state; each base station among base stations 1 to 5 sets the 1588 state of the port in the base station used for receiving 1588 messages from the clock source selected by the base station to the S state. Finally, the 1588 status of the respective ports set by 1588 servers 1~2, NE1~10 and base stations 1~5 is shown in Figure 2. Based on the 1588 status of the ports of 1588 servers 1~2, NE1~10 and base stations 1~5, the 1588 synchronization paths corresponding to each base station 1~5 can be determined. The 1588 synchronization path corresponding to each base station in base stations 1~5 is the transmission path of the 1588 message of the clock source selected by the base station from the clock source to the base station.For example, base station 1 corresponds to 1588 synchronization path 1, which is the transmission path of the 1588 message of the clock source (1588 server 1) selected by base station 1 from 1588 server 1 to base station 1; base station 2 corresponds to 1588 synchronization path 2, which is the transmission path of the 1588 message of the clock source (1588 server 1) selected by base station 2 from 1588 server 1 to base station 2; base station 3 corresponds to 1588 synchronization path 3, which is the transmission path of the 1588 message of the clock source (1588 server 1) selected by base station 3 from 1588 server 1 to base station 3, and so on. As shown in Figure 2, the clock sources selected by NE1-10 and base stations 1-5 are all 1588 server 1. NE1-10 and base stations 1-5 all track 1588 server 1 for time synchronization. 1588 server 2 is used as a backup. If 1588 server 1 fails or becomes unavailable, NE1-10 and base stations 1-5 switch to 1588 server 2 when selecting the clock source to track 1588 server 2.

[0062] Referring to Figure 2 , for example, 1588 messages sent by 1588 servers 1-2 all carry GM information and a hop count. The hop count carried in the 1588 messages increases hop by hop, and all or part of the GM information carried in the 1588 messages is updated hop by hop. For example, for any device among NEs 1-10 and base stations 1-5, the device receives 1588 messages A and 1588 messages B. The device generates dataset A based on 1588 message A and dataset B based on 1588 message B. Datasets A and B each include clock source selection information. The device selects a clock source based on the clock source selection information in datasets A and B according to the BMC source selection algorithm defined in the IEEE 1588v2 standard. The device then sets the 1588 status of its port based on the selected clock source. For example, assume that NE1 is the device. 1588 message A originates from 1588 server 1, and 1588 message B originates from 1588 server 2. Datasets A and B include the GM clock identifier, GM clock priority 1, GM clock level, GM clock accuracy, GM clock offset ratio logarithmic variance, GM clock priority 2, and hop count, respectively. The hop count in dataset A is the number of hops 1588 message A takes to reach NE1, and the hop count in dataset B is the number of hops 1588 message B takes to reach NE1. NE1 selects the clock source by comparing datasets A and B according to the BMC source selection algorithm defined in the IEEE 1588v2 standard. Specifically, NE1 determines whether the GM clock identifier in dataset A is the same as the GM clock identifier in dataset B. If the GM clock identifiers in dataset A and dataset B are the same, 1588 messages A and B originate from the same 1588 server. NE1 selects a clock source based on the shortest path principle, according to the hop counts in dataset A and dataset B. If the GM clock identifiers in dataset A and dataset B are different, 1588 messages A and B originate from different 1588 servers. NE1 then compares the GM clock priority 1 in dataset A with the GM clock priority 1 in dataset B, the GM clock level in dataset A with the GM clock level in dataset B, the GM clock accuracy in dataset A with the GM clock accuracy in dataset B, the logarithmic variance of the GM clock offset ratio in dataset A with the logarithmic variance of the GM clock offset ratio in dataset B, the GM clock priority 2 in dataset A with the GM clock priority 2 in dataset B, and the GM clock identifier in dataset A with the clock identifier in dataset B.If NE1 determines through comparison that the GM clock priority 1 in dataset A is the same as the GM clock priority 1 in dataset B, the GM clock level in dataset A is the same as the GM clock level in dataset B, the GM clock accuracy in dataset A is the same as the GM clock accuracy in dataset B, the GM clock offset ratio logarithmic variance in dataset A is the same as that in dataset B, and the GM clock priority 2 in dataset A is the same as that in dataset B, NE1 determines the 1588 server identified by the smallest clock identifier between the GM clock identifier in dataset A and the clock identifier in dataset B as the clock source. If NE1 determines through comparison that any of the GM information in dataset A, including the GM clock priority 1, GM clock level, GM clock accuracy, GM clock offset ratio logarithmic variance, and GM clock priority 2, is different from the corresponding GM information in dataset B, NE1 selects a clock source from 1588 server 1 or 1588 server 2 based on the GM information in dataset A and the corresponding GM information in dataset B. For example, the GM clock identifier, GM clock priority 1, GM clock level, GM clock accuracy, GM clock offset ratio logarithmic variance, GM clock priority 2, and hop count are all expressed in numerical values ​​or characters. Two identical GM clock identifiers can also be described as being equal to each other, two different GM clock identifiers can also be described as being unequal to each other, two identical GM clock priorities can also be described as being equal to each other, and two different GM clock priorities can also be described as being unequal to each other, and so on. When NE1 determines through comparison that the GM clock priority 1 in data set A is different from the GM clock priority 1 in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock priority 1 between the GM clock priority 1 in data set A and the GM clock priority 1 in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock priority 1 is the source end of the 1588 message including the smaller GM clock priority 1; when NE1 determines through comparison that the GM clock priority 1 in data set A is the same as the GM clock priority 1 in data set B, NE1 compares the GM clock level in data set A with the GM clock level in data set B.When NE1 determines through comparison that the GM clock level in data set A is different from the GM clock level in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock level between the GM clock level in data set A and the GM clock level in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock level is the source end of the 1588 message including the smaller GM clock level; when NE1 determines through comparison that the GM clock level in data set A is the same as the GM clock level in data set B, NE1 compares the GM clock accuracy in data set A with the GM clock accuracy in data set B. When NE1 determines through comparison that the GM clock accuracy in data set A is different from the GM clock accuracy in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock accuracy between the GM clock accuracy in data set A and the GM clock accuracy in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock accuracy is the source end of the 1588 message including the smaller GM clock accuracy; when NE1 determines through comparison that the GM clock accuracy in data set A is the same as the GM clock accuracy in data set B, NE1 compares the logarithmic variance of the GM clock offset ratio in data set A with the logarithmic variance of the GM clock offset ratio in data set B. When NE1 determines through comparison that the GM clock offset ratio logarithmic variance in data set A is different from the GM clock offset ratio logarithmic variance in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock offset ratio logarithmic variance in data set A or the GM clock offset ratio logarithmic variance in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock offset ratio logarithmic variance is the source end of the 1588 message including the smaller GM clock offset ratio logarithmic variance. When NE1 determines through comparison that the GM clock offset ratio logarithmic variance in data set A is the same as the GM clock offset ratio logarithmic variance in data set B, NE1 compares the GM clock priority 2 in data set A with the GM clock priority 2 in data set B. When NE1 determines through comparison that the GM clock priority 2 in data set A is different from the GM clock priority 2 in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock priority 2 between the GM clock priority 2 in data set A and the GM clock priority 2 in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock priority 2 is the source end of the 1588 message including the smaller GM clock priority 2; when NE1 determines through comparison that the GM clock priority 2 in data set A is the same as the GM clock priority 2 in data set B, NE1 compares the GM clock identifier in data set A with the clock identifier in data set B.This section only briefly describes the BMC source selection algorithm defined in the IEEE 1588v2 standard. For details, see the IEEE 1588v2 standard. For more details, see Dataset Comparison Algorithm Part 1 and Dataset Comparison Algorithm Part 2 (Part 2 mainly describes clock source selection based on the shortest path principle). The IEEE 1588v2 standard address is https: / / ieeexplore.ieee.org / document / 7949184.

[0063] Please refer to Figure 3, which shows a schematic diagram of another 1588 network including a 1588 synchronization path provided by an embodiment of the present application. The 1588 synchronization path in the 1588 network is a 1588 synchronization path determined according to the BMC source selection algorithm defined in the ITU-T G.8275.1 standard. Figure 3 introduces the BMC source selection algorithm defined in the ITU-T G.8275.1 standard. In Figure 3, the small boxes in each device in NE1~10 and base stations 1~5 represent the ports of the device, and the letters "M", "S", and "P" in the small boxes represent the 1588 status of the port represented by the small box ("M" represents the M state, "S" represents the S state, and "P" represents the P state). The meaning of the small boxes in 1588 servers 1~2 and the meaning of the letters in the small boxes are similar. As shown in Figure 3, 1588 servers 1-2 each receive satellite signals from a satellite system, synchronize with the satellite system's time based on the received satellite signals, and transmit 1588 messages to base stations 1-5 via NEs 1-10 based on the received satellite signals. Each device in NEs 1-10 and base stations 1-5 generates a data set containing clock source selection information based on the received 1588 messages. Based on the clock source selection information in the data set, the device selects a clock source using the BMC source selection algorithm defined in the ITU-T G.8275.1 standard. The device then sets the 1588 status of its port based on the received 1588 message and the clock source it selected. 1588 servers 1-2 also set the 1588 status of their respective ports. For example, each 1588 server among 1588 servers 1 to 2 sets the 1588 state of the port in the 1588 server used for sending 1588 messages to the M state; each NE among NE1 to 10 sets the 1588 state of the port in the NE used for receiving 1588 messages from the clock source selected by the NE to the S state, and sets the 1588 state of the port in the NE used for sending 1588 messages from the clock source selected by the NE to the M state; each base station among base stations 1 to 5 sets the 1588 state of the port in the base station used for receiving 1588 messages from the clock source selected by the base station to the S state. Finally, the 1588 status of the respective ports set by 1588 servers 1~2, NE1~10 and base stations 1~5 is shown in Figure 3. Based on the 1588 status of the ports of 1588 servers 1~2, NE1~10 and base stations 1~5, the 1588 synchronization paths corresponding to base stations 1~5 can be determined. The 1588 synchronization path corresponding to each base station in base stations 1~5 is the transmission path of the 1588 message of the clock source selected by the base station from the clock source to the base station.For example, base station 1 corresponds to 1588 synchronization path 1, which is the transmission path of the 1588 message of the clock source (1588 server 1) selected by base station 1 from 1588 server 1 to base station 1; base station 2 corresponds to 1588 synchronization path 2, which is the transmission path of the 1588 message of the clock source (1588 server 1) selected by base station 2 from 1588 server 1 to base station 2; base station 3 corresponds to 1588 synchronization path 3, which is the transmission path of the 1588 message of the clock source (1588 server 1) selected by base station 3 from 1588 server 1 to base station 2. The transmission path of the 1588 message from the source (1588 server 1) from 1588 server 1 to base station 3; base station 4 corresponds to 1588 synchronization path 4, 1588 synchronization path 4 is the transmission path of the 1588 message from the clock source (1588 server 2) selected by base station 4 from 1588 server 2 to base station 4; base station 5 corresponds to 1588 synchronization path 5, 1588 synchronization path 5 is the transmission path of the 1588 message from the clock source (1588 server 2) selected by base station 5 from 1588 server 2 to base station 5. Figure 3 shows that NE1, NE3, NE5, NE7, NE9, and base stations 1-3 all select 1588 server 1 as their clock source. They all track 1588 server 1 for time synchronization. NE2, NE4, NE6, NE8, NE10, and base stations 4-5 all select 1588 server 2 as their clock source. In other words, NE1-10 and base stations 1-5 all select the nearest 1588 server as their clock source for time synchronization.

[0064] Referring to Figure 3, for example, 1588 messages sent by 1588 servers 1-2 all carry GM information and hop counts. The hop count carried in the 1588 messages increases hop by hop, and all or part of the GM information carried in the 1588 messages is updated hop by hop. For example, for any device among NEs 1-10 and base stations 1-5, the device receives 1588 messages A and 1588 messages B. The device generates data set A based on 1588 message A and data set B based on 1588 message B. Data sets A and B each include clock source selection information. The device selects a clock source based on the clock source selection information in data set A and the clock source selection information in data set B according to the BMC source selection algorithm defined in the ITU-T G.8275.1 standard. The device then sets the 1588 status of its port based on the selected clock source. For example, assume that NE1 is the device. 1588 message A originates from 1588 server 1, and 1588 message B originates from 1588 server 2. Datasets A and B include the GM clock identifier, local priority, GM clock level, GM clock accuracy, GM clock offset ratio logarithmic variance, GM clock priority 2, and hop count, respectively. The hop count in dataset A is the number of hops 1588 message A takes to reach NE1, and the hop count in dataset B is the number of hops 1588 message B takes to reach NE1. The local priority in dataset A is the priority of the port on NE1 that receives 1588 message A, and the local priority in dataset B is the priority of the port on NE1 that receives 1588 message B. NE1 selects a clock source by comparing datasets A and B according to the BMC source selection algorithm defined in the ITU-T G.8275.1 standard. Specifically, NE1 sequentially compares the GM clock level in dataset A with the GM clock level in dataset B, the GM clock accuracy in dataset A with the GM clock accuracy in dataset B, the logarithmic variance of the GM clock offset ratio in dataset A with the logarithmic variance of the GM clock offset ratio in dataset B, the GM clock priority 2 in dataset A with the GM clock priority 2 in dataset B, and the local priority in dataset A with the local priority in dataset B.After NE1 determines through comparison that the GM clock level in dataset A is the same as that in dataset B, the GM clock accuracy in dataset A is the same as that in dataset B, the logarithmic variance of the GM clock offset ratio in dataset A is the same as that in dataset B, the GM clock priority 2 in dataset A is the same as that in dataset B, and the local priority in dataset A is the same as that in dataset B, NE1 then determines whether the GM clock level in dataset A is less than or equal to (i.e., ≤) 127. If the GM clock level in dataset A is less than or equal to (i.e., ≤) 127, NE1 performs the following operations based on the hop counts in dataset A and dataset B: The clock source is selected based on the shortest path principle. If the GM clock level in dataset A is greater than (i.e., >) 127, NE1 compares the GM clock identifier in dataset A with the GM clock identifier in dataset B. If the GM clock identifiers in dataset A and dataset B are identical, 1588 messages A and B originate from the same 1588 server. NE1 then selects a clock source based on the hop counts in dataset A and dataset B, based on the shortest path principle. If the GM clock identifiers in dataset A and dataset B are different, NE1 identifies the 1588 server identified by the smallest of the two GM clock identifiers in dataset A and dataset B as the clock source. If NE1 determines that any of the GM information in dataset A (GM clock level, GM clock accuracy, GM clock offset ratio logarithmic variance, GM clock priority 2, or local priority) differs from the corresponding GM information in dataset B, NE1 selects a clock source from 1588 server 1 or 1588 server 2 based on the GM information in dataset A and dataset B. For example, when NE1 determines through comparison that the GM clock level in data set A is different from the GM clock level in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock level between the GM clock level in data set A and the GM clock level in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock level is the source end of the 1588 message including the smaller GM clock level; when NE1 determines through comparison that the GM clock level in data set A is the same as the GM clock level in data set B, NE1 compares the GM clock accuracy in data set A with the GM clock accuracy in data set B.When NE1 determines through comparison that the GM clock accuracy in data set A is different from the GM clock accuracy in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock accuracy between the GM clock accuracy in data set A and the GM clock accuracy in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock accuracy is the source end of the 1588 message including the smaller GM clock accuracy; when NE1 determines through comparison that the GM clock accuracy in data set A is the same as the GM clock accuracy in data set B, NE1 compares the logarithmic variance of the GM clock offset ratio in data set A with the logarithmic variance of the GM clock offset ratio in data set B. When NE1 determines through comparison that the GM clock offset ratio logarithmic variance in data set A is different from the GM clock offset ratio logarithmic variance in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock offset ratio logarithmic variance in data set A or the GM clock offset ratio logarithmic variance in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock offset ratio logarithmic variance is the source end of the 1588 message including the smaller GM clock offset ratio logarithmic variance. When NE1 determines through comparison that the GM clock offset ratio logarithmic variance in data set A is the same as the GM clock offset ratio logarithmic variance in data set B, NE1 compares the GM clock priority 2 in data set A with the GM clock priority 2 in data set B. When NE1 determines through comparison that the GM clock priority 2 in data set A is different from the GM clock priority 2 in data set B, NE1 determines the 1588 server corresponding to the smaller GM clock priority 2 between the GM clock priority 2 in data set A and the GM clock priority 2 in data set B as the clock source, and the 1588 server corresponding to the smaller GM clock priority 2 is the source end of the 1588 message including the smaller GM clock priority 2; when NE1 determines through comparison that the GM clock priority 2 in data set A is the same as the GM clock priority 2 in data set B, NE1 compares the local priority in data set A with the local priority in data set B. When NE1 determines through comparison that the local priority in data set A is different from the local priority in data set B, NE1 determines the 1588 server corresponding to the smaller local priority between the local priority in data set A and the local priority in data set B as the clock source. The 1588 server corresponding to the smaller local priority is the source of the target 1588 message in 1588 message A and 1588 message B, and the target 1588 message is received by NE1 through the port of the smaller local priority. When NE1 determines through comparison that the local priority in data set A is the same as the local priority in data set B, NE1 determines whether the GM clock level in data set A is less than or equal to (i.e., ≤) 127.This section only briefly describes the BMC source selection algorithm defined in the ITU-T G.8275.1 standard. For details, refer to the ITU-T G.8275.1 standard. For more information, see Data Set Comparison Algorithm Part 1 and Data Set Comparison Algorithm Part 2. (Part 2 mainly describes the process of selecting a clock source based on the shortest path principle. Data Set Comparison Algorithm Part 2 in the ITU-T G.8275.1 standard is the same as Data Set Comparison Algorithm Part 2 in the IEEE 1588v2 standard.) The ITU-T G.8275.1 standard is located at https: / / www.itu.int / ITU-T / recommendations / rec.aspx?rec=15131. It should be noted that, when the satellite signal is normal, the GM clock level of 1588 server 1 is the same as the GM clock level of 1588 server 2, the GM clock accuracy of 1588 server 1 is the same as the GM clock accuracy of 1588 server 2, the logarithmic variance of the GM clock offset ratio of 1588 server 1 is the same as the logarithmic variance of the GM clock offset ratio of 1588 server 2, the GM clock priority 2 of 1588 server 1 and the GM clock priority 2 of 1588 server 2 can be configured to be the same, and the GM clock level of 1588 server 1 and the GM clock level of 1588 server 2 are both 6, and the priority of the port for receiving 1588 message A in NE1 can be configured to be the same as the priority of the port for receiving 1588 message B in NE1. For example, the priority of the port for receiving 1588 message A in NE1 can be configured to be the same as the priority of the port for receiving 1588 message B in NE1. The ports in dataset B all have a priority of 128. Therefore, the GM clock level in dataset A is the same as the GM clock level in dataset B, the GM clock accuracy in dataset A is the same as the GM clock accuracy in dataset B, the GM clock offset ratio logarithmic variance in dataset A is the same as that in dataset B, the GM clock priority 2 in dataset A is the same as that in dataset B, the local priority in dataset A is the same as that in dataset B, and the GM clock level in dataset A is 6. 1588 packet A originates from 1588 server 1, and dataset A corresponds to 1588 server 1. 1588 packet B originates from 1588 server 2, and dataset B corresponds to 1588 server 2. NE1 selects a clock source for tracking based on the shortest path principle according to the hop counts in datasets A and B, thereby improving time synchronization accuracy.The 1588 synchronization path shown in FIG3 is a 1588 synchronization path determined according to the 1588 states of the respective ports set by the 1588 servers 1 to 2, NEs 1 to 10, and base stations 1 to 5 when the satellite signal is normal.

[0065] The GM clock class is the clock class of a 1588 server and is also known as the telecom grandmaster (T-GM) clock class. The ITU-T G.8275.1 standard defines GM clock classes for various scenarios. These classes include 6, 7, 140, 150, and 160. Table 1 lists the meanings of these clock classes.

[0066] Table 1

[0067] Table 1 only lists several GM clock levels and their meanings by way of example. For a detailed description of the GM clock levels and their meanings, please refer to the ITU-TG.8275.1 standard, which will not be described in detail in the embodiments of this application.

[0068] According to the above description of the BMC source selection algorithm defined in the ITU-T G.8275.1 standard, if the GM clock level of 1588 server 1 is the same as that of 1588 server 2, the GM clock accuracy of 1588 server 1 is the same as that of 1588 server 2, the logarithmic variance of the GM clock offset ratio of 1588 server 1 is the same as that of 1588 server 2, the GM clock priority 2 of 1588 server 1 is the same as that of 1588 server 2, and the priority of the port for receiving 1588 packet A in the device is the same as the priority of the port for receiving 1588 packet B in NE1, if the GM clock level of 1588 server 1 and the GM clock level of 1588 server 2 are both 7 (the GM clock level is less than 127), according to ITU-T The BMC source selection algorithm defined in the G.8275.1 standard requires all devices to track the nearest 1588 server as their clock source, following the shortest path principle. This means some devices may track 1588 server 1, while others may track 1588 server 2. However, when the GM clock level of 1588 server 1 and 1588 server 2 are both 7, both servers are in a time-holding state. Over time, the time deviation between 1588 servers 1 and 2 increases, leading to increasing time deviations between devices tracking 1588 server 1 and 1588 server 2. Although the time synchronization accuracy of devices tracking different 1588 servers can meet the 3µs requirement, it is still not optimal. In addition, the clock level threshold (127) in the BMC source selection algorithm defined in the ITU-T G.8275.1 standard is fixed and cannot be configured. This results in a low level of flexibility for the BMC source selection algorithm defined in the G.8275.1 standard, and consequently, the device cannot flexibly select a clock source.

[0069] The embodiment of the present application provides a clock source selection method and device, and a communication system. In the clock source selection method, the clock level threshold is configurable. When the clock level in the data set is not better than the clock level threshold, the device determines the clock source based on the clock identifier. As a result, when the clock level is not better than the clock level threshold (for example, the clock level is greater than 6), the clock source determined by different devices can be the same clock source. Different devices can track the same clock source, reducing the difference in time synchronization accuracy between different devices and improving time synchronization accuracy. Moreover, since the clock level threshold is configurable, the device has high flexibility in determining the clock source based on the flexibly configured clock level threshold, and can ensure that the clock level threshold is compatible with the current G.8275.1 standard and ITU-T G.8275.2 standard. The embodiment of the present application can ensure that the time deviation between different devices (for example, base stations) is maintained within the required range (for example, + / -1.5us), ensuring that 5G services can operate normally.

[0070] The following introduces the technical solutions provided by the embodiments of the present application, and first introduces the application scenarios of the embodiments of the present application.

[0071] An application scenario of an embodiment of the present application provides a communication network, comprising at least one device and at least two clock servers. The at least two clock servers are respectively configured to receive satellite signals from a satellite system, perform time synchronization with the satellite system based on the received satellite signals, and send clock messages carrying time information based on the received satellite signals. Each of the at least one device is configured to select a clock source based on the received clock message (i.e., determine a clock source from the at least two clock servers) and perform time synchronization with the clock source, for example, adjusting the time of the device based on the time information carried in the clock message from the clock source to synchronize with the clock source. Optionally, each of the at least one device generates a data set including clock source selection information based on the received clock message, and performs clock source selection based on the clock source selection information in the data set. In one embodiment, the at least one device is a plurality of devices, comprising at least one network device and at least one base station. The at least two clock servers are respectively connected to the at least one base station via the at least one network device, and the time information carried in the clock message sent by each of the at least two clock servers is the time information of the clock server. For example, the at least two clock servers are both 1588 servers, the clock messages sent by the at least two clock servers are both 1588 messages, and the time information carried by the clock messages is GM information.

[0072] Optionally, each of the at least one device also sets the 1588 state of the port of the device according to the clock message (e.g., 1588 message) received by the device and the clock source selected by the device, and the at least two clock servers also set the 1588 state of their respective ports, so that the 1588 synchronization path in the communication network can be determined based on the 1588 state of the ports set by the at least two clock servers and the 1588 state of the ports set by the at least one device. As an example, the communication network provided by the application scenario of the embodiment of the present application is the 1588 network as shown in Figure 1. The embodiment of the present application can be applied to the 1588 network as shown in Figure 1. In this case, the 1588 network shown in Figure 1 is only used to illustrate the application scenario of the embodiment of the present application, and is not used to limit the technical solution of the embodiment of the present application. During the implementation process, the number of NEs, the number of base stations, and the relationship between NEs, base stations, and other devices in the 1588 network can be configured as needed; in addition, the 1588 network may also include other devices, such as a control device for network control. The control device integrates network management, service control, and network analysis functions. The control device can be a server, a server cluster consisting of multiple servers, or a cloud computing service center. In some embodiments, the control device is also referred to as a management device, network management device, controller, etc., which is not limited in the embodiments of this application.

[0073] It should be noted that, in the description of this application, the clock server closer to a device refers to the clock server with the shorter path to the device among at least two clock servers, and does not refer to the clock server that is physically closer to the device. For example, if clock server 1 and clock server 2 both send clock messages to a communication network, the clock server closer to device A in the communication network refers to the clock server with the shorter path to device A among clock server 1 and clock server 2, and does not refer to the clock server that is physically closer to device A. For example, if device A is physically closer to clock server 1 and farther from clock server 2, but there are more devices connected between device A and clock server 1 and fewer devices connected between device A and clock server 2, then clock server 2 is the clock server closer to device A as described in this embodiment of the application, and clock server 1 is not the clock server closer to device A as described in this embodiment of the application. Similarly, the clock server closest to a device refers to the clock server with the shortest path to the device among at least two clock servers, and does not refer to the clock server that is physically closest to the device. For example, if both clock server 1 and clock server 2 send clock messages to a communication network, the clock server closest to device A in the communication network refers to the clock server with the shortest path to device A between clock server 1 and clock server 2, and does not refer to the clock server physically closest to device A. For example, if device A is physically closest to clock server 1 and farther from clock server 2, but there are more devices connected between device A and clock server 1 and fewer devices connected between device A and clock server 2, then clock server 2 is the clock server closest to device A as described in the embodiments of this application, and clock server 1 is not the clock server closest to device A as described in the embodiments of this application. As an example, the communication network is the 1588 network shown in Figure 1, clock server 1 is 1588 server 1, clock server 2 is 1588 server 2, device A is any device among NE1~10 and base stations 1~5, the clock message is a 1588 message, the 1588 server closer to device A refers to the clock server with a shorter path to device A among 1588 server 1 and 1588 server 2, and the 1588 server closest to device A refers to the clock server with a shorter path to device A among 1588 server 1 and 1588 server 2.

[0074] The above is an introduction to the application scenarios of the embodiments of the present application. The following introduces an embodiment of the clock source selection method of the present application.

[0075] Please refer to Figure 4, which shows a flowchart of a clock source selection method provided in an embodiment of the present application. This embodiment takes the clock source selection method applied to the first device as an example, and the clock source selection method is executed by the first device. The first device is any network device or base station in the communication network, and the clock server involved in the following description is deployed in the communication network. For example, the communication network is a 1588 network as shown in Figure 1, and the first device is any NE among NE1~10 or any base station among base stations 1~5. The clock servers involved in the following description include at least one of 1588 server 1 and 1588 server 2. As shown in Figure 4, the clock source selection method includes the following steps S401 to S402.

[0076] S401. A first device obtains a first data set and a second data set, where the first data set includes a first clock level and a first clock identifier, and the second data set includes a second clock identifier.

[0077] Among them, the first clock identifier and the second clock identifier are used to identify the clock server respectively, and the first clock identifier and the second clock identifier can be the same or different, so that the clock server identified by the first clock identifier and the clock server identified by the second clock identifier are the same clock server or different clock servers. Specifically, when the first clock identifier and the second clock identifier are the same, the clock server identified by the first clock identifier and the clock server identified by the second clock identifier are the same clock server; when the first clock identifier and the second clock identifier are different, the clock server identified by the first clock identifier and the clock server identified by the second clock identifier are not the same clock server. For the sake of convenience of description, the clock server identified by the first clock identifier is referred to as the first clock server, and the clock server identified by the second clock identifier is referred to as the second clock server, so the first clock server and the second clock server are the same clock server or different clock servers.

[0078] Among them, the first clock level is the clock level of the clock server identified by the first clock identifier (that is, the first clock server), that is, the clock level of the first clock server. Optionally, the second data set also includes a second clock level, and the second clock level is the clock level of the clock server identified by the second clock identifier (that is, the second clock server). The first clock level and the second clock level may be the same or different. In one example, the clock server identified by the first clock identifier and the clock server identified by the second clock identifier are the same clock server, and the first clock level is the same as the second clock level. In another example, the clock server identified by the first clock identifier and the clock server identified by the second clock identifier are not the same clock server, and the first clock level is the same as the second clock level.

[0079] In an optional embodiment, a first device receives a first clock message and a second clock message, and the first device generates a first data set based on the first clock message, and the first device generates a second data set based on the second clock message. In one embodiment, the first clock message originates from a first clock server, and the second clock message originates from a second clock server, the first clock message carries a first clock level and a first clock identifier, and the second clock message carries a second clock level and a second clock identifier; the first device extracts the first clock level and the first clock identifier from the first clock message, and the first device generates a first data set based on the first clock level and the first clock identifier; the first device extracts the second clock level and the second clock identifier from the second clock message, and the first device generates a second data set based on the second clock level and the second clock identifier. In one embodiment, the first clock message and the second clock message respectively carry GM information, the GM information carried by the first clock message is the GM information of the first clock server, the GM information carried by the first clock message includes a first clock level and a first clock identifier, the GM information carried by the second clock message is the GM information of the second clock server, the GM information carried by the second clock message includes a second clock level and a second clock identifier; the first device extracts the GM information from the first clock message, and the first device generates a first data set based on the GM information extracted from the first clock message; and, the first device extracts the GM information from the second clock message, and the first device generates a second data set based on the GM information extracted from the second clock message.

[0080] In an optional embodiment, the first data set further includes at least one of the following: a first clock accuracy, a first clock offset ratio logarithmic variance, a first clock priority, a first local priority, and a first hop count. The first clock accuracy is the clock accuracy of the first clock server, the first clock offset ratio logarithmic variance is the clock offset ratio logarithmic variance of the first clock server, the first clock priority is the clock priority of the first clock server, the first local priority is the priority of a port (e.g., a first port) in the first device for receiving the first clock message, the first device receives the first clock message through the first port, and the first hop count is the number of hops the first clock message travels from the first clock server to the first device. For example, the GM information carried by the first clock message includes a first clock level, a first clock identifier, a first clock accuracy, a first clock offset ratio logarithmic variance and a first clock priority, and the first clock message also carries a first hop count. The first device determines the priority of the first port in the first device (that is, the first local priority). The first device extracts the GM information and the first hop count from the first clock message. The first device generates a first data set based on the first local priority, the GM information extracted from the first clock message and the first hop count extracted from the first clock message.

[0081] In an optional embodiment, the second data set further includes at least one of the following: a second clock accuracy, a second clock offset ratio logarithmic variance, a second clock priority, a second local priority, and a second hop count. The second clock accuracy is the clock accuracy of the second clock server, the second clock offset ratio logarithmic variance is the logarithmic variance of the clock offset ratio of the second clock server, the second clock priority is the clock priority of the second clock server, the second local priority is the priority of a port (e.g., a second port) on the first device for receiving the second clock message, and the first device receives the second clock message via the second port. The second hop count is the number of hops the second clock message travels from the second clock server to the first device. For example, the GM information carried by the second clock message includes a second clock level, a second clock identifier, a second clock accuracy, a second clock offset ratio logarithmic variance, and a second clock priority, and the second clock message also carries the second hop count. The first device determines the priority of the second port on the first device (i.e., the second local priority), extracts the GM information and the second hop count from the second clock message, and generates the second data set based on the second local priority, the GM information extracted from the second clock message, and the second hop count extracted from the second clock message.

[0082] In an optional embodiment, the first clock server and the second clock server are both 1588 servers, and the first clock message and the second clock message are both 1588 messages. The first clock class is the GM clock class of the first clock server, the first clock identity is the GM clock identity of the first clock server, the first clock accuracy is the GM clock accuracy of the first clock server, the first clock offset scaled log variance is the GM clock offset scaled log variance of the first clock server, and the first clock priority is GM clock priority 2 of the first clock server. The second clock class is the GM clock class of the second clock server, the second clock identity is the GM clock identity of the second clock server, the second clock accuracy is the GM clock accuracy of the second clock server, the second clock offset scaled log variance is the GM clock offset scaled log variance of the second clock server, and the second clock priority is GM clock priority 2 of the second clock server. GM clock class, GM clock identity, GM clock accuracy, GM clock offset scaled log variance, and GM clock priority2 are described in the ITU-T G.8275.1 standard and the ITU-T G.8275.2 standard. In the IEEE 1588v2 standard, the GM clock class is referred to as the GM class, the GM clock identity is referred to as the GM identity, the GM clock priority2 is referred to as the GM priority2, the GM clock accuracy is referred to as the GM accuracy, and the GM clock offset scaled log variance is referred to as the GM offsetscaledlogvariance. This application does not limit this.

[0083] After the first device obtains the first and second data sets, it performs clock source selection based on the first and second data sets, i.e., determines (or selects) a clock source. In a specific embodiment, the first device performs clock source selection based on the clock source selection information in the first and second data sets. The GM information and the first local priority in the first data set are both clock source selection information in the first data set, and the GM information and the second local priority in the second data set are both clock source selection information in the second data set. Please refer to the relevant description below for the implementation process of the first device performing clock source selection based on the first and second data sets.

[0084] S402. When the first clock level is not better than the clock level threshold, the first device determines a clock source according to the first clock identifier and the second clock identifier. The clock level threshold is configurable.

[0085] The first device determines whether the first clock level in the first data set is greater than a clock level threshold. If it is determined that the first clock level is not greater than the clock level threshold, the first device determines a clock source based on the first clock identifier in the first data set and the second clock identifier in the second data set. In this embodiment of the present application, the first clock level being less than the clock level threshold includes any of the following three situations.

[0086] The first case: the first clock level is not better than the clock level threshold includes that the first clock level is greater than the clock level threshold.

[0087] The clock level threshold is a clock level used to indicate a state in which a clock device is normally tracking a time signal. For example, if the clock level threshold is 6, the first clock level being no better than the clock level threshold means that the first clock level is greater than the clock level threshold. In a specific embodiment, the first device determines whether the first clock level is greater than the clock level threshold (e.g., 6). If it is determined that the first clock level is greater than the clock level threshold, the first device determines that the first clock level is no better than the clock level threshold.

[0088] The second case: the first clock level is not better than the clock level threshold includes that the first clock level is greater than or equal to the clock level threshold.

[0089] The clock level threshold is a clock level used to indicate that a clock device has lost its time signal and is in a state where the clock device is maintaining time availability. For example, if the clock level threshold is 7, the first clock level being no better than the clock level threshold means that the first clock level is greater than or equal to (i.e., ≥) the clock level threshold, i.e., the first clock level is no less than the clock level threshold. In a specific embodiment, the first device determines whether the first clock level is less than the clock level threshold (e.g., 7). If it is determined that the first clock level is not less than (i.e., greater than or equal to) the clock level threshold (e.g., 7), the first device determines that the first clock level is no better than the clock level threshold (e.g., 7).

[0090] The third case: the first clock level is not better than the clock level threshold, including the first clock level not being in the clock level set.

[0091] The clock level threshold is within the clock level set. The clock levels within the clock level set include: a clock level (e.g., 6) for characterizing a state in which a clock device is tracking a time signal normally, and / or a clock level (e.g., 7) for characterizing a state in which a clock device has lost a time signal and is maintaining time availability, and / or a default clock level (e.g., 127). For example, the clock level set is any one of the following: {6}, {7}, {127}, {6,127}, {7,127}, {6,7}, {6,7,127}.

[0092] In a specific embodiment, the first device determines whether the first clock level is in the clock level set. If it is determined that the first clock level is not in the clock level set, the first device determines that the first clock level is not better than the clock level threshold.

[0093] In the three aforementioned scenarios, the time signal may be a satellite signal, the clock device may be a clock server or a device with clock functionality connected between the first device and the clock server, and the clock device may be on a clock synchronization path (e.g., a 1588 synchronization path). For example, the clock device may be the previous-hop device of the first device and may be on a clock synchronization path (e.g., a 1588 synchronization path).

[0094] In an optional embodiment, the attribute set defaultDS of the first device includes at least one of a defaultDS.clockClassSet field and a defaultDS.clockClassThreshold field, the defaultDS.clockClassSet field is used to record the clock class set, and the defaultDS.clockClassThreshold field is used to record the clock class threshold.

[0095] In an embodiment of the present application, the clock source determined by the first device based on the first clock identifier and the second clock identifier can be a root clock source or a master clock source. The root clock source is a clock server. The master clock source is located between the clock server and the first device and is on a clock synchronization path (e.g., a 1588 synchronization path). For example, the master clock source is the previous hop device of the first device and is on a clock synchronization path (e.g., a 1588 synchronization path). The master clock source is the previous hop tracking source device of the first device. In an optional embodiment, when the first device determines that the first clock level is not better than the clock level threshold, the first device determines whether the first clock identifier and the second clock identifier are the same. When the first device determines that the first clock identifier and the second clock identifier are the same, the first device determines that the clock server identified by the first clock identifier (i.e., the first clock server) and the clock server identified by the second clock identifier (i.e., the second clock server) are the same clock server, and then the first device determines that the first clock message and the second clock message originate from the same clock server. The first device determines the clock source according to the shortest path principle. In this case, the clock source determined by the first device can be the master clock source. For example, the first device determines the clock synchronization path from the first device to the clock server according to the shortest path principle. For example, the first device determines the clock synchronization path from the first device to the clock server according to the shortest path principle based on the first hop count in the first data set and the second hop count in the second data set. The first device determines the clock source (i.e., the master clock source) based on the clock synchronization path. In one example, the first hop count is the number of hops that the first clock message travels from the first clock server to the first device, and the second hop count is the number of hops that the second clock message travels from the second clock server to the first device. The first device determines the minimum of the first and second hop counts. The first device determines the transmission path of the clock message corresponding to the minimum hop count as the clock synchronization path. The first device determines the previous hop device on the clock synchronization path located on the first device as the clock source. When the previous hop device is a clock server, the clock source is the master clock source, and the clock source is also the root clock source. Furthermore, the first device adjusts the time of the first device based on the time information carried by the clock message corresponding to the minimum hop count to synchronize with the clock source. When the first device determines that the first clock identifier is different from the second clock identifier, the first device determines that the clock server identified by the first clock identifier and the clock server identified by the second clock identifier are not the same clock server, and further determines that the first clock message and the second clock message originate from different clock servers. The first device determines the target clock identifier in the first clock identifier and the second clock identifier, and the first device determines the clock server identified by the target clock identifier as the clock source. In this case, the clock source determined by the first device is the root clock source.For example, the first clock identifier and the second clock identifier are both expressed in numerical values ​​or characters. The target clock identifier is the smallest clock identifier between the first clock identifier and the second clock identifier. The first clock identifier and the second clock identifier being the same can also be described as the first clock identifier and the second clock identifier being equal. The first clock identifier and the second clock identifier being different can also be described as the first clock identifier and the second clock identifier being unequal. This embodiment of the present application does not limit this.

[0096] In a specific embodiment, when the first device determines that the first clock level is not greater than the clock level threshold, the first device compares the first clock identifier with the second clock identifier. By comparing, the first device can determine the magnitude relationship between the first clock identifier and the second clock identifier. The magnitude relationship between the first clock identifier and the second clock identifier includes that the first clock identifier and the second clock identifier are equal (i.e., the same), the first clock identifier is greater than the second clock identifier, or the first clock identifier is less than the second clock identifier. When the first device determines that the first clock identifier and the second clock identifier are equal (i.e., the same), the first device determines the clock source according to the shortest path principle. The clock source determined by the first device may be the master clock source. When the first device determines that the first clock identifier is greater than the second clock identifier, the first device determines that the second clock identifier is the smallest clock identifier between the first clock identifier and the second clock identifier. Therefore, the first device determines that the second clock identifier is the target clock identifier. The first device determines the clock server identified by the second clock identifier (i.e., the second clock server) as the clock source. The clock source determined by the first device may be the root clock source. When the first device determines that the first clock identifier is smaller than the second clock identifier, the first device determines that the first clock identifier is the smallest clock identifier between the first clock identifier and the second clock identifier. Therefore, the first device determines that the first clock identifier is the target clock identifier. The first device determines the clock server identified by the first clock identifier (that is, the first clock server) as the clock source. The clock source determined by the first device can be the root clock source.

[0097] In an optional embodiment, after the first device obtains the first data set and the second data set, the first device determines whether the first data set and the second data set meet a preset condition. If it is determined that the first data set and the second data set meet the preset condition, the first device determines whether the first clock level in the first data set is better than the clock level threshold. In one embodiment, the first data set includes a first clock level and a first clock identifier, and also includes at least one of a first clock accuracy, a first clock offset ratio logarithmic variance, a first clock priority, a first local priority, and a first hop count. The second data set includes a second clock level and a second clock identifier, and also includes at least one of a second clock accuracy, a second clock offset ratio logarithmic variance, a second clock priority, a second local priority, and a second hop count. The first clock level, the first clock identifier, the first clock accuracy, the first clock offset ratio logarithmic variance, the first clock priority, the first local priority, the first number of hops, the second clock level, the second clock identifier, the second clock accuracy, the second clock offset ratio logarithmic variance, the second clock priority, the second local priority and the second number of hops are all expressed numerically. The preset condition includes at least one of the following: the first clock level is equal to the second clock level, the first clock accuracy is equal to the second clock accuracy, the first clock offset ratio logarithmic variance is equal to the second clock offset ratio logarithmic variance, the first clock priority is equal to the second clock priority, and the first local priority is equal to the second local priority. Specifically, the first data set includes a first clock level, a first clock identifier, a first clock accuracy, a first clock offset ratio logarithmic variance, a first clock priority, and a first local priority; the second data set includes a second clock level, a second clock identifier, a second clock accuracy, a second clock offset ratio logarithmic variance, a second clock priority, and a second local priority; the preset conditions include: the first clock level is equal to the second clock level, the first clock accuracy is equal to the second clock accuracy, the first clock offset ratio logarithmic variance is equal to the second clock offset ratio logarithmic variance, the first clock priority is equal to the second clock priority, and the first local priority is equal to the second local priority. That is, when the first clock level is equal to the second clock level, the first clock accuracy is equal to the second clock accuracy, the first clock offset ratio logarithmic variance is equal to the second clock offset ratio logarithmic variance, the first clock priority is equal to the second clock priority, and the first local priority is equal to the second local priority, the first device determines whether the first clock level in the first data set is better than the clock level threshold.

[0098] Optionally, the first data set includes a first hop count, the second data set includes a second hop count, and the clock source selection method further includes the following step S403.

[0099] S403. When the first clock level is better than the clock level threshold, the first device determines a clock source according to a first hop count in the first data set and a second hop count in the second data set.

[0100] The first device determines whether a first clock level within a first data set exceeds a clock level threshold. If the first clock level is determined to be greater than the clock level threshold, the first device determines a clock source based on a first hop count within the first data set and a second hop count within the second data set. In this embodiment of the present application, the first clock level exceeding the clock level threshold includes any of the following three situations.

[0101] The first case (corresponding to the first case in S402 where the first clock level is not better than the clock level threshold): the first clock level being better than the clock level threshold includes the first clock level being less than or equal to (ie, ≤) the clock level threshold.

[0102] The clock level threshold is a clock level used to characterize the state of a clock device normally tracking a time signal. For example, if the clock level threshold is 6, the first clock level being superior to the clock level threshold (e.g., 6) means that the first clock level is less than or equal to (i.e., ≤) the clock level threshold (e.g., 6), that is, the first clock level is not greater than the clock level threshold (e.g., 6). In a specific embodiment, the first device determines whether the first clock level is greater than the clock level threshold (e.g., 6). If it is determined that the first clock level is not greater than the clock level threshold (e.g., 6), the first device determines that the first clock level is superior to the clock level threshold (e.g., 6).

[0103] The second case (corresponding to the second case in S402 where the first clock level is not better than the clock level threshold): the first clock level being better than the clock level threshold includes the first clock level being less than the clock level threshold.

[0104] The clock level threshold is a clock level used to indicate that a clock device has lost a time signal and is maintaining a state in which the clock device is available. For example, the clock level threshold is 7, and the first clock level being superior to the clock level threshold means that the first clock level is less than the clock level threshold. In a specific embodiment, the first device determines whether the first clock level is less than the clock level threshold (for example, 7). If it is determined that the first clock level is less than the clock level threshold, the first device determines that the first clock level is superior to the clock level threshold.

[0105] The third case (corresponding to the third case in S402 where the first clock level is not better than the clock level threshold): the first clock level being better than the clock level threshold includes the first clock level being in the clock level set.

[0106] The clock level threshold is within the clock level set. The clock levels within the clock level set include: a clock level (e.g., 6) for characterizing a state in which a clock device is tracking a time signal normally; and / or a clock level (e.g., 7) for characterizing a state in which a clock device loses a time signal and the clock device is maintaining time availability; and / or a default clock level (e.g., 127). For example, the clock level set is any one of the following: {6}, {7}, {127}, {6,127}, {7,127}, {6,7}, {6,7,127}.

[0107] In a specific embodiment, the first device determines whether the first clock level is within the clock level set. If the first clock level is within the clock level set, the first device determines that the first clock level is greater than the clock level threshold.

[0108] In an embodiment of the present application, the clock source determined by the first device based on the first hop count in the first data set and the second hop count in the second data set can be a root clock source or a master clock source. The root clock source is a clock server. The master clock source is located between the clock server and the first device and the master clock source is on a clock synchronization path (e.g., a 1588 synchronization path). For example, the master clock source is the previous hop device of the first device and the master clock source is on a clock synchronization path (e.g., a 1588 synchronization path). The master clock source is the previous hop tracking source device of the first device. In an optional embodiment, when the first device determines that the first clock level is better than the clock level threshold, the first device determines the clock source according to the first hop count in the first data set and the second hop count in the second data set according to the shortest path principle. For example, the first hop count is the number of hops that the first clock message passes through from the first clock server to the first device, and the second hop count is the number of hops that the second clock message passes through from the second clock server to the first device. In one embodiment, the first data set further includes a first clock identifier, and the second data set further includes a second clock identifier. The first device determines the first clock server based on the first clock identifier, and the first device determines the second clock server based on the second clock identifier. The first clock server and the second clock server are not the same clock server. The first device determines the clock server closer to the first device (e.g., closest) between the first clock server and the second clock server according to the shortest path principle based on the first hop count in the first data set and the second hop count in the second data set as the clock source. In this case, the clock source determined by the first device is the root clock source. In another embodiment, the first data set further includes the first clock identifier, and the second data set further includes the second clock identifier. The first device determines the first clock server based on the first clock identifier, and the first device determines the second clock server based on the second clock identifier. The first clock server and the second clock server are the same clock server. The first device determines the minimum number of hops between the first and second hops. The first device determines the transmission path of the clock message corresponding to the minimum number of hops as the clock synchronization path. The first device determines the device located on the previous hop of the first device on the clock synchronization path as the clock source. In this case, the clock source determined by the first device is the master clock source. Furthermore, the first device adjusts its time based on the time information (e.g., GM information) carried in the clock message corresponding to the minimum hop count to synchronize with the clock source. The implementation process for the first device to determine the clock source based on the shortest path principle can be referenced to Part 2 of the Dataset Comparison Algorithm defined in the IEEE 1588v2 standard and will not be further described in detail in this embodiment of the present application.

[0109] In an optional embodiment, the preset condition in S402 includes the first clock level being equal to the second clock level. That is, when the first clock level is equal to the second clock level, the first device determines whether the first clock level in the first data set is greater than a clock level threshold. It is understood that, when the first clock level is equal to the second clock level, "the first device determines whether the first clock level in the first data set is greater than the clock level threshold" can be replaced with "the first device determines whether the second clock level in the second data set is greater than the clock level threshold." S402 can be replaced with "when the second clock level is not greater than the clock level threshold, the first device determines a clock source based on the first clock identifier and the second clock identifier." S403 can be replaced with "when the second clock level is greater than the clock level threshold, the first device determines a clock source based on the first hop count in the first data set and the second hop count in the second data set." That is, when the first clock level is equal to the second clock level, the first device can compare either the first clock level or the second clock level with the clock level threshold to determine whether to determine the clock source based on the clock identifier or the shortest path principle. This embodiment of the present application does not limit this.

[0110] In an embodiment of the present application, after a first device determines a clock source, the first device adjusts its time based on the time information (e.g., GM information) carried in a clock message received from the clock source to synchronize with the clock source. In one embodiment, if the first clock level is not greater than the clock level threshold and the first clock identifier is the same as the second clock identifier, the first device adjusts its time based on the time information carried in the clock message with the smallest number of hops between the first and second clock messages received to synchronize with the clock source.

[0111] In an optional embodiment, after the first device determines the clock source, it determines the 1588 state of the port of the first device based on the clock message received by the first device and the clock source determined by the first device, so that the 1588 synchronization path in the communication network can be determined based on the 1588 state of the port of each device determined by each device in the communication network where the first device is located. For example, the communication network where the first device is located is the 1588 network shown in Figure 1. When the first data set and the second data set meet the preset conditions and the first clock level is better than the clock level threshold, each device in the 1588 network determines the clock source according to the shortest path principle. The 1588 state of the port determined by each device in the 1588 network based on the received clock message and the determined clock source is shown in Figure 3. The 1588 synchronization path corresponding to base stations 1 to 5 determined based on the 1588 state of the port of each device in the 1588 network is shown in Figure 3. When the first data set and the second data set meet the preset conditions and the first clock level is not better than the clock level threshold and the first clock identifier is different from the second clock identifier, each device in the 1588 network determines the clock source according to the smallest clock identifier of the first clock identifier and the second clock identifier. The 1588 status of the port determined by each device in the 1588 network according to the received clock message and the determined clock source is shown in Figure 2. The 1588 synchronization path corresponding to base stations 1 to 5 determined based on the 1588 status of the port of each device in the 1588 network is shown in Figure 2.

[0112] In summary, the technical solution provided by the embodiment of the present application, when the first clock level is not better than the clock level threshold, indicates that the clock performance corresponding to the first clock level is relatively poor, so the first device determines the clock source based on the first clock identifier and the second clock identifier, thereby making it possible for the clock sources determined by different devices to be the same clock source (for example, the root clock source) when the first clock level is not better than the clock level threshold. For example, when the first clock level is not better than the clock level threshold and the first clock identifier is different from the second clock identifier, the clock sources determined by different devices can be the same root clock source. Different devices can track the same root clock source, which can reduce the difference in time synchronization accuracy between different devices and improve time synchronization accuracy. When the first clock level is better than the clock level threshold, it indicates that the clock performance corresponding to the first clock level is relatively good, so the first device determines the clock source based on the first hop count and the second hop count, thereby making it possible for the clock message corresponding to the clock source determined by the first device (for example, the clock message received by the first device from the clock source) to reach the first device with a smaller number of hops (for example, the minimum), which helps to improve the time synchronization accuracy of the first device. In addition, in the technical solution provided by the embodiment of the present application, the clock level threshold is configurable. Therefore, the device has a high degree of flexibility in determining the clock source based on the clock level and the flexibly configured clock level threshold, and can ensure that the clock level threshold is compatible with the current ITU-T G.8275.1 standard and ITU-T G.8275.2 standard. The technical solution provided by the embodiment of the present application can ensure that the time deviation between different devices (such as base stations) is maintained within the required range (such as 3us), ensuring that 5G services can operate normally.

[0113] It should be noted that "S401," "S402," and "S403" are merely step numbers in the embodiments of the present application and are not intended to limit the order in which the steps are executed. The order of the steps in the embodiments of the present application can be adjusted, and the number of steps can be increased or decreased as appropriate. For example, depending on the relationship between the first clock level and the clock level threshold, only one of S402 and S403 may be executed.

[0114] As previously described, if the first device determines that the first data set and the second data set meet the preset condition, it determines whether the first clock level in the first data set is greater than the clock level threshold, and then determines to execute S402 or S403 based on the determination result. In an optional embodiment, if the first device determines that the first data set and the second data set do not meet the preset condition, the first device determines that the clock server identified by the first clock identifier or the clock server identified by the second clock identifier is the clock source based on the condition that the first data set and the second data set do not meet.

[0115] Take the example of a first data set including a first clock level, a first clock identifier, a first clock accuracy, a first clock offset ratio logarithmic variance, a first clock priority, a first local priority and a first hop count, and a second data set including a second clock level, a second clock identifier, a second clock accuracy, a second clock offset ratio logarithmic variance, a second clock priority, a second local priority and a second hop count. For example, the first clock level and the second clock level are both GM clock levels, the first clock identifier and the second clock identifier are both GM clock identifiers, the first clock accuracy and the second clock accuracy are both GM clock accuracy, the first clock offset ratio logarithmic variance and the second clock offset ratio logarithmic variance are both GM clock offset ratio logarithmic variance, the first clock priority and the second clock priority are both GM clock priorities (for example, GM clock priority 2), the first clock level, the first clock identifier, the first clock accuracy, the first clock offset ratio logarithmic variance, the first clock priority, the first local priority, the first hop count, the second clock level, the second clock identifier, the second clock accuracy, the second clock offset ratio logarithmic variance, the second clock priority, the second local priority and the second hop count are all expressed in numerical values, and the preset conditions include the first clock level being equal to the second clock level, the first clock accuracy being equal to the second clock accuracy, the first clock offset ratio logarithmic variance being equal to the second clock offset ratio logarithmic variance, the first clock priority being equal to the second clock priority and the first local priority being equal to the second local priority. As an example, please refer to Figure 5, which shows a flowchart of another clock source selection method provided in an embodiment of the present application. The clock source selection method shown in Figure 5 is illustrated by the first device as an example.

[0116] As shown in FIG5 , after the first device obtains the first data set and the second data set, the first device sequentially compares the GM clock level in the first data set with the GM clock level in the second data set, the GM clock accuracy in the first data set with the GM clock accuracy in the second data set, the logarithmic variance of the GM clock offset ratio in the first data set with the logarithmic variance of the GM clock offset ratio in the second data set, the GM clock priority in the first data set with the GM clock priority in the second data set, and the local priority in the first data set (i.e., the first local priority) with the local priority in the second data set. If the first device determines through comparison that the GM clock level in the first data set is equal to the GM clock level in the second data set, the GM clock accuracy in the first data set is equal to the GM clock accuracy in the second data set, the logarithmic variance of the GM clock offset ratio in the first data set is equal to the logarithmic variance of the GM clock offset ratio in the second data set, the GM clock priority in the first data set is equal to the GM clock priority in the second data set, and the local priority in the first data set is equal to the local priority in the second data set, the first device determines that the first data set and the second data set meet preset conditions, and then the first device determines whether the GM clock level in the first data set is greater than the clock equality threshold. If it is determined that the GM clock level in the first data set is superior to the clock equality threshold, the first device selects a clock source based on the hop count in the first data set and the hop count in the second data set according to the shortest path principle. If the GM clock level in the first data set is not superior to the clock equality threshold, the first device determines the clock source based on the GM clock identifier in the first data set and the GM clock identifier in the second data set. Specifically, the first device compares the GM clock identifier in the first data set with the GM clock identifier in the second data set. If it is determined that the GM clock identifier in the first data set is equal to the GM clock identifier in the second data set, the first device selects a clock source and determines a clock synchronization path based on the hop count in the first data set and the hop count in the second data set according to the shortest path principle. If it is determined that the GM clock identifier in the first data set is greater than the GM clock identifier in the second data set, the first device determines that the clock server corresponding to the second data set is the clock source, and the clock server corresponding to the second data set is also the source of the second clock message. If it is determined that the GM clock identifier in the first data set is less than the GM clock identifier in the second data set, the first device determines that the clock server corresponding to the first data set is the clock source, and the clock server corresponding to the first data set is also the source of the first clock message. That is, when the first device determines that the GM clock identifier in the first data set is not equal to the GM clock identifier in the second data set, the first device determines the clock server identified by the smallest clock identifier between the GM clock identifier in the first data set and the clock identifier in the second data set as the clock source, and this clock source is the root clock source.

[0117] As shown in Figure 5, if the first device determines through comparison that any of the GM information in the first data set, including the GM clock level, GM clock accuracy, GM clock offset ratio logarithmic variance, GM clock priority, and local priority, is not equal to the corresponding GM information in the second data set, the first device selects a clock source based on the smaller of the GM information in the first data set and the corresponding GM information in the second data set. For example, if the first device determines through comparison that the GM clock level in the first data set is greater than the GM clock level in the second data set, the first device determines the clock server corresponding to the second data set as the clock source (i.e., determines the clock server corresponding to the GM clock level in the second data set as the clock source). If the first device determines through comparison that the GM clock level in the first data set is less than the GM clock level in the second data set, the first device determines the clock server corresponding to the first data set as the clock source (i.e., determines the clock server corresponding to the GM clock level in the first data set as the clock source). That is, if the first device determines through comparison that the GM clock level in the first data set is unequal to the GM clock level in the second data set, the first device determines the clock server corresponding to the smaller GM clock level of the GM clock level in the first data set as the clock source, and the clock server corresponding to the smaller GM clock level is the source of the clock message including the smaller GM clock level. If the first device determines through comparison that the GM clock level in the first data set is equal to the GM clock level in the second data set, the first device compares the GM clock accuracy in the first data set with the GM clock accuracy in the second data set. If the first device determines through comparison that the GM clock accuracy in the first data set is greater than the GM clock accuracy in the second data set, the first device determines the clock server corresponding to the second data set as the clock source (i.e., determines the clock server corresponding to the GM clock accuracy in the second data set as the clock source). If the first device determines through comparison that the GM clock accuracy in the first data set is less than the GM clock accuracy in the second data set, the first device determines the clock server corresponding to the first data set as the clock source (i.e., determines the clock server corresponding to the GM clock accuracy in the first data set as the clock source). That is, when the first device determines through comparison that the GM clock accuracy in the first data set is not equal to the GM clock accuracy in the second data set, the first device determines the clock server corresponding to the smaller GM clock accuracy between the GM clock accuracy in the first data set and the GM clock accuracy in the second data set as the clock source, and the clock server corresponding to the smaller GM clock accuracy is the source end of the clock message including the smaller GM clock accuracy.If the first device determines, through comparison, that the GM clock accuracy in the first data set is equal to the GM clock accuracy in the second data set, the first device compares the logarithmic variance of the GM clock offset ratio in the first data set with the logarithmic variance of the GM clock offset ratio in the second data set. Similarly, if the first device determines, through comparison, that the logarithmic variance of the GM clock offset ratio in the first data set is unequal to the logarithmic variance of the GM clock offset ratio in the second data set, the first device determines the clock server corresponding to the smaller logarithmic variance of the GM clock offset ratio in the first data set as the clock source, and the clock server corresponding to the smaller logarithmic variance of the GM clock offset ratio is the source of the clock message including the smaller logarithmic variance of the GM clock offset ratio. If the first device determines, through comparison, that the logarithmic variance of the GM clock offset ratio in the first data set is equal to the logarithmic variance of the GM clock offset ratio in the second data set, the first device compares the GM clock priority in the first data set with the GM clock priority in the second data set. If the first device determines, through comparison, that the GM clock priority in the first data set is unequal to the GM clock priority in the second data set, the first device determines the clock server corresponding to the smaller GM clock priority of the GM clock priority in the first data set and the GM clock priority in the second data set as the clock source. The clock server corresponding to the smaller GM clock priority is the source of the clock message containing the smaller GM clock priority. If the first device determines, through comparison, that the GM clock priority in the first data set is equal to the GM clock priority in the second data set, the first device compares the local priority in the first data set with the local priority in the second data set. If the first device determines, through comparison, that the local priority in the first data set is unequal to the local priority in the second data set, the first device determines the clock server corresponding to the smaller local priority of the local priority in the first data set and the local priority in the second data set as the clock source. The clock server corresponding to the smaller local priority is the source of the first clock message and the target clock message in the first clock message, which is received by the first device through the port with the smaller local priority. If the first device determines, through comparison, that the local priority in the first data set is equal to the local priority in the second data set, the first device determines whether the GM clock level in the first data set exceeds the clock level threshold.

[0118] As mentioned above, the clock level threshold is a clock level (e.g., 6) used to characterize the state in which the clock device is normally tracking the time signal. The first clock level not being better than the clock level threshold means that the first clock level is greater than the clock level threshold, and the first clock level being better than the clock level threshold means that the first clock level is less than or equal to (i.e., ≤) the clock level threshold. Alternatively, the clock level threshold is a clock level (e.g., 7) used to characterize the state in which the clock device has lost the time signal and the clock device is available while maintaining time. The first clock level not being better than the clock level threshold means that the first clock level is greater than or equal to (i.e., ≥) the clock level threshold, and the first clock level being better than the clock level threshold means that the first clock level is less than the clock level threshold. Alternatively, the clock level threshold is within the clock level set, the first clock level not being better than the clock level threshold includes that the first clock level is not within the clock level set, and the first clock level being better than the clock level threshold includes that the first clock level is within the clock level set. The clock device may be a clock server or a network device with clock functionality.

[0119] In one embodiment, the clock level threshold is 6, the first clock level is not better than the clock level threshold when the first clock level is greater than 6, and the first clock level is better than the clock level threshold when the first clock level is less than or equal to (i.e., ≤) 6. In this embodiment, the clock source selection method provided by the embodiment of the present application is shown in FIG6 . The difference between FIG6 and FIG5 is that the "determining whether the GM clock level in the first data set is better than the clock equal threshold" in FIG5 is replaced with "determining whether the GM clock level in the first data set is less than or equal to 6."

[0120] In another embodiment, the clock level threshold is 7, the first clock level is not better than the clock level threshold when the first clock level is greater than or equal to (i.e., ≥) 7, and the first clock level is better than the clock level threshold when the first clock level is less than 7. In this embodiment, the clock source selection method provided by the embodiment of the present application is shown in FIG7 . The difference between FIG7 and FIG5 is that the "determining whether the GM clock level in the first data set is better than the clock equal threshold" in FIG5 is replaced with "determining whether the GM clock level in the first data set is less than 7".

[0121] In another embodiment, the first clock level not being better than the clock level threshold includes the first clock level not being within the clock level set, and the first clock level being better than the clock level threshold includes the first clock level being within the clock level set. In this embodiment, the clock source selection method provided by the embodiment of the present application is shown in FIG8 . The difference between FIG8 and FIG5 is that the phrase "determining whether the GM clock level within the first data set is better than the clock equal threshold" in FIG5 is replaced with "determining whether the GM clock level within the first data set is within the clock level set."

[0122] For the relevant descriptions of the embodiments shown in FIG. 6 to FIG. 8 , reference may be made to the description of the embodiment shown in FIG. 5 , and no further details will be given here.

[0123] It should be noted that when the GM clock level of a clock device (such as a clock server) is greater than 6, for example, when the GM clock level of a clock device (such as a clock server) is greater than or equal to 7, the clock device (such as a clock server) loses time signal and is in a time holding state. With reference to the embodiments shown in FIG6 and FIG7 , it can be seen that: when the GM clock level in the first data set is greater than 6 (e.g., ≥7) and the GM clock identifier in the first data set is not equal to the GM clock identifier in the second data set, the first device determines the clock server identified by the smallest clock identifier between the GM clock identifier in the first data set and the GM clock identifier in the second data set as the clock source. Other devices in the communication network where the first device is located also determine the clock source accordingly. As a result, the clock sources determined by different devices in the communication network are the same clock server. Different devices in the communication network track the same clock server, which can ensure that the time deviation between different devices in the communication network (e.g., base stations) is maintained within 3 μs. When the GM clock level in the first data set is less than 6, the first device determines the clock source according to the shortest path principle. As a result, different devices in the communication network can determine different clock sources and track different clock servers. Each device tracks the clock server with the shortest path to itself, which can ensure time synchronization accuracy and ensure that the time deviation between different devices in the communication network (e.g., base stations) is maintained within 3 μs. That is, when the clock signal is relatively poor (for example, the GM clock level is greater than 6), the devices in the communication network track the same clock server; when the clock signal is good (for example, the GM clock level is less than or equal to 6), the devices in the communication network track the clock server with the shortest path to themselves, which helps to ensure the accuracy of time synchronization.

[0124] In an embodiment of the present application, the first device includes a main control board and at least one interface board. The main control board includes a clock source selection unit, the interface board includes a message transceiver unit and a network interface, the network interface is used to receive clock messages, the message transceiver unit is used to transmit clock messages between the network interface and the clock source selection unit, and the clock source selection unit is used to execute all or part of the steps of the clock source selection method provided in the embodiment of the present application to perform clock source selection, and determine the 1588 status of each network interface of the first device. For example, the clock source selection unit is used to generate a data set based on the clock message transmitted by the message transceiver unit, and then perform clock source selection based on the data set. For example, the clock source selection unit is a 1588 source selection unit, and the clock message is a 1588 message. As an example, the first device is shown in Figure 9.

[0125] The above is an introduction to the method embodiments of the present application. The following describes the device embodiments of the present application. The device of the present application can be used to perform the method of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments.

[0126] Please refer to Figure 10, which shows a schematic diagram of a clock source selection device 1000 provided in an embodiment of the present application. The clock source selection device 1000 is applied to a first device. For example, the clock source selection device 1000 is the first device or a functional component in the first device, for example, the clock source selection device 1000 is the clock source selection unit in the first device shown in Figure 9. The clock source selection device 1000 is used to execute the clock source selection method provided in any of the embodiments of Figures 4 to 8. For example, the first device is any NE among NE1 to 10 in the 1588 network shown in Figure 1 or any base station among base stations 1 to 5, and the clock servers involved in the following description include at least one of the 1588 server 1 and the 1588 server 2 in the 1588 network shown in Figure 1. Referring to Figure 10, the clock source selection device 1000 includes an acquisition module 1010 and a source selection module 1020.

[0127] The acquisition module 1010 is configured to acquire a first data set and a second data set, wherein the first data set includes a first clock level and a first clock identifier, and the second data set includes a second clock identifier. The functional implementation of the acquisition module 1010 may refer to the relevant description in S401 above.

[0128] The source selection module 1020 is configured to determine a clock source based on the first clock identifier and the second clock identifier when the first clock grade is not better than the clock grade threshold. The clock grade threshold is configurable. The implementation of the function of the source selection module 1020 can refer to the relevant description in S402 above.

[0129] Optionally, the first data set includes a first hop count, and the second data set includes a second hop count. Source selection module 1020 is further configured to determine a clock source based on the first hop count and the second hop count when the first clock grade is greater than the clock grade threshold. The implementation of the functions of source selection module 1020 may also refer to the relevant description in S403 above.

[0130] In an optional embodiment, the first clock level is not better than the clock level threshold includes that the first clock level is greater than the clock level threshold, and the first clock level is better than the clock level threshold includes that the first clock level is less than or equal to (i.e., not greater than) the clock level threshold, and the clock level threshold is a clock level used to characterize the state of the clock device normally tracking the time signal.

[0131] In another optional embodiment, the first clock level is not better than the clock level threshold includes that the first clock level is greater than or equal to (i.e., not less than) the clock level threshold, and the first clock level is better than the clock level threshold includes that the first clock level is less than the clock level threshold, and the clock level threshold is a clock level used to characterize a state in which a clock device loses a time signal and the clock device is in a state of maintaining time availability.

[0132] In another optional embodiment, the first clock level is not better than the clock level threshold, including that the first clock level is not in the clock level set, the first clock level is better than the clock level threshold, including that the first clock level is in the clock level set, the clock level threshold is in the clock level set, and the clock levels in the clock level set include: a clock level used to characterize the state of the clock device normally tracking the time signal, and / or, a clock level used to characterize the state of the clock device losing the time signal and the clock device being available in maintaining time, and / or, a default clock level.

[0133] Optionally, the clock device is a clock server (such as a 1588 server) or a device with a clock function in a time synchronization network.

[0134] Optionally, the attribute set defaultDS of the first device includes a clock class set defaultDS.clockClassSet field, and the defaultDS.clockClassSet field is used to record the clock class set.

[0135] Optionally, the attribute set defaultDS of the first device includes a clock class threshold defaultDS.clockClassThreshold field, and the defaultDS.clockClassThreshold field is used to record the clock class threshold.

[0136] In summary, the technical solution provided by the embodiment of the present application is that when the first clock level is not better than the clock level threshold, it means that the clock performance corresponding to the first clock level is relatively poor. Therefore, the first device determines the clock source based on the first clock identifier and the second clock identifier, thereby making it possible for the clock sources determined by different devices to be the same clock source when the first clock level is not better than the clock level threshold. For example, when the first clock level is not better than the clock level threshold and the first clock identifier is different from the second clock identifier, the clock sources determined by different devices can be the same root clock source. Different devices can track the same root clock source, which can reduce the difference in time synchronization accuracy between different devices and improve time synchronization accuracy. When the first clock level is better than the clock level threshold, it means that the clock performance corresponding to the first clock level is relatively good. Therefore, the first device determines the clock source based on the first hop count and the second hop count, thereby making it possible for the clock message corresponding to the clock source determined by the first device (for example, the clock message received by the first device from the clock source) to reach the first device with a smaller number of hops (for example, the minimum), which helps to improve the time synchronization accuracy of the first device. In addition, in the technical solution provided by the embodiment of the present application, the clock level threshold is configurable. Therefore, the device has a high degree of flexibility in determining the clock source based on the clock level and the flexibly configured clock level threshold, and can ensure that the clock level threshold is compatible with the current ITU-T G.8275.1 standard and ITU-T G.8275.2 standard. The technical solution provided by the embodiment of the present application can ensure that the time deviation between different devices (such as base stations) is maintained within the required range (such as 3us), ensuring that 5G services can operate normally.

[0137] The clock source selection device provided in the embodiment of the present application can also be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The above-mentioned PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The clock source selection device provided in the above-mentioned method embodiment can also be implemented by software. When the clock source selection method provided in the above-mentioned method embodiment is implemented by software, each module in the above-mentioned clock source selection device can also be a software module, which is not limited in the embodiment of the present application.

[0138] An embodiment of the present application provides a clock source selection device, comprising a memory and a processor. The memory is configured to store a computer program. The processor is configured to execute the computer program stored in the memory to cause the clock source selection device to perform a clock source selection method as provided in any one of the embodiments of FIG. 4 to FIG. 8 .

[0139] As an example, please refer to Figure 11, which shows a schematic diagram of another clock source selection device 1100 provided in an embodiment of the present application. The clock source selection device 1100 is a first device or a functional component in the first device, and the first device can be a network device. The clock source selection device 1100 is used to execute the clock source selection method provided in any of the embodiments of Figures 4 to 8. For example, the first device is any NE in the 1588 network shown in Figure 1. As shown in Figure 11, the clock source selection device 1100 includes a main control board 1110, an interface board 1130, and an interface board 1140. In the case of multiple interface boards, a switching fabric board (not shown in Figure 11) is also included. The switching fabric board is used to complete data exchange between the interface boards. The main control board is also called a main processing unit (MPU) or a route processor card, and the interface board is also called a line processing unit (LPU), a line card, a service board, or a circuit board. The switching fabric board is also called a switch fabric unit (SFU).

[0140] The main control board 1110 performs functions such as system management, device maintenance, and protocol processing. The interface boards 1130 and 1140 provide various service interfaces and implement message forwarding. These service interfaces include, for example, Packet Over SONET / SDH (POS) interfaces, Gigabit Ethernet (GE) interfaces, and Asynchronous Transfer Mode (ATM) interfaces. The main control board 1110 primarily includes three functional units: a system management and control unit, a system clock unit, and a system maintenance unit. The main control board 1110, interface boards 1130, and interface boards 1140 are interconnected via a system bus and the system backplane. The interface board 1130 includes one or more processors 1131. Processors 1131 control and manage the interface board 1130 and communicate with the central processing unit 1112 on the main control board 1110. The memory 1132 on the interface board 1130 stores forwarding information, such as the forwarding table. The interface board 1130 includes one or more network interfaces 1133 for receiving and sending messages. The specific implementation is not described here. As shown in Figure 11, the main control board 1110 also includes a memory 1114 for storing system management information, protocols, etc. In this application, the main control board 1110 includes a clock source selection unit (e.g., a 1588 source selection unit) to execute the clock source selection algorithm.

[0141] As shown in Figure 11 , this embodiment includes multiple interface boards and employs a distributed forwarding mechanism. Under this mechanism, operations on interface board 1140 are substantially similar to those on interface board 1130. For example, interface board 1140 includes one or more network interfaces 1143 for receiving and sending messages, a memory 1142 for storing a forwarding table, and a processor 1141 for controlling and managing interface board 1140 and communicating with a central processing unit 1112 on main control board 1110. For the sake of brevity, detailed description of interface board 1140 is omitted here.

[0142] In FIG11 , the processor 1131 in the interface board 1130 and / or the processor 1141 in the interface board 1140 can be dedicated hardware or chips, such as a network processor (NP) or an application-specific integrated circuit, to implement the aforementioned functions. This implementation is commonly referred to as utilizing dedicated hardware or chips for forwarding plane processing. In other embodiments, the processor 1131 in the interface board 1130 and / or the processor 1141 in the interface board 1140 can be a general-purpose processor, such as a central processing unit (CPU).

[0143] It should also be noted that there may be one or more main control boards, including a master and backup main control board. There may also be one or more interface boards. The higher the data processing capabilities of a network device, the more interface boards it provides. With multiple interface boards, they can communicate with each other through one or more switching fabric boards (SFMs). Multiple SFMs can be used to achieve load balancing and redundant backup. In a centralized forwarding architecture, network devices may not require SFMs; the interface boards handle service data processing for the entire system. In a distributed forwarding architecture, network devices include multiple interface boards, which can exchange data between them through SFMs, providing high-capacity data exchange and processing capabilities. Therefore, network devices with distributed architectures have greater data access and processing capabilities than those with centralized architectures. The architecture used depends on the network deployment scenario and is not specified here.

[0144] In an optional embodiment, the memory 1114 and / or the memory 1132 and / or the memory 1142 is a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1132 can exist independently and be connected to the processor 1131 via a communication bus, or it can be integrated with the processor 1131. The memory 1142 can exist independently and be connected to the processor 1141 via a communication bus, or it can be integrated with the processor 1141. The memory 1114 can exist independently and be connected to the central processing unit 1112 via a communication bus, or it can be integrated with the central processing unit 1112. This embodiment of the application is not limited to this.

[0145] The memory 1114 is used to store program code, and is controlled by the central processing unit 1112 to execute part or all of the steps of the method provided in the above embodiment. The central processing unit 1112 is used to execute the program code stored in the memory 1114. The program code may include one or more software modules. These one or more software modules may be the functional modules provided in the embodiment shown in Figure 7 above. Optionally, the memory 1132 may also be used to store program code, and is controlled by the processor 1131 to execute part or all of the steps of the method provided in the above embodiment. The memory 1142 may also be used to store program code, and is controlled by the processor 1141 to execute part or all of the steps of the method provided in the above embodiment. This embodiment of the application is not limited to this.

[0146] In an optional embodiment, the network interface 1133 and the network interface 1143 may be any transceiver-like device for communicating with other devices or networks, such as Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. A communication bus can be divided into an address bus, a data bus, a control bus, etc.

[0147] As another example, please refer to Figure 12, which shows a schematic diagram of another clock source selection device 1200 provided in an embodiment of the present application. The clock source selection device 1200 is a first device or a functional component in the first device. The first device can be a network device or a base station. For example, the first device is any NE or any base station in the 1588 network shown in Figure 1. The clock source selection device 1200 is used to execute the clock source selection method provided in any embodiment of Figures 4 to 8. As shown in Figure 12, the clock source selection device 1200 includes a processor 1202, a memory 1204, a communication interface 1206 and a bus 1208. The processor 1202, the memory 1204 and the communication interface 1206 are communicatively connected via the bus 1208. In other embodiments, the processor 1202, the memory 1204 and the communication interface 1206 can also be connected in other ways.

[0148] Memory 1204 is used to store computer program 12042, which may include instructions and data. Memory 1204 may be various types of storage media, such as RAM, ROM, non-volatile RAM (NVRAM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), flash memory, optical storage, and registers.

[0149] Among them, the processor 1202 can be a general-purpose processor. The general-purpose processor can be a processor that performs specific steps and / or operations by reading and executing a computer program (e.g., computer program 12042) stored in a memory (e.g., memory 1204). The general-purpose processor may use data stored in the memory during the execution of the above steps and / or operations. The stored computer program can be executed to implement the related functions of the aforementioned acquisition module 1010 and source selection module 1020. The general-purpose processor can be a CPU. The processor 1202 can also be a dedicated processor. A dedicated processor is a processor specially designed to perform specific steps and / or operations. The dedicated processor can be a digital signal processor (DSP), ASIC, or FPGA, etc. The processor 1202 can also be a multi-core processor. The processor 1202 includes at least one circuit to perform all or part of the steps of the above-mentioned embodiment method.

[0150] The communication interface 1206 may include an input / output (I / O) interface, a physical interface, and a logical interface, etc., for interconnecting components within the clock source selection apparatus 1200, as well as an interface for interconnecting the clock source selection apparatus 1200 with other devices (e.g., network devices). The physical interface may be a Gigabit Ethernet (GE) interface, which may be used to interconnect the clock source selection apparatus 1200 with other devices. The logical interface is an interface within the clock source selection apparatus 1200, which may be used to interconnect components within the clock source selection apparatus 1200. It is easy to understand that the communication interface 1206 may be used for communication between the clock source selection apparatus 1200 and other devices. For example, the communication interface 1206 is used to send and receive messages between the clock source selection apparatus 1200 and other devices.

[0151] Bus 1208 can be any type of communication bus, such as a system bus, for interconnecting processor 1202, memory 1204, and communication interface 1206. Bus 1208 can be classified as an address bus, a data bus, a control bus, and the like. For ease of illustration, FIG12 shows only one thick line, but this does not necessarily indicate that there is only one bus or only one type of bus.

[0152] The above-mentioned devices can be provided on separate chips, or at least partially or entirely on the same chip. Whether to provide each device independently on different chips or to integrate them on one or more chips often depends on the product design requirements. The embodiments of this application do not limit the specific implementation of the above-mentioned devices.

[0153] The clock source selection device 1200 shown in FIG12 is only an example, and the clock source selection device 1200 may also include other components. The clock source selection device 1200 selects a clock source by executing all or part of the steps of the method provided in the above embodiment to synchronize time with the clock source.

[0154] It should be noted that the ports, interfaces, network interfaces, communication interfaces, etc. involved in the description of the above embodiments may have the same meaning.

[0155] Based on the same inventive concept, an embodiment of the present application provides a communication system comprising a first device and at least two clock devices, wherein the first device comprises a clock source selection apparatus as shown in any one of Figures 10 to 12 , and the first device is configured to determine a clock source among the at least two clock devices. The at least two clock devices comprise at least one of a clock server and a network device with clock functionality.

[0156] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed (for example, by a network device, a base station, one or more processors, etc.), it implements all or part of the steps of the clock source selection method provided in the above method embodiment.

[0157] Based on the same inventive concept, an embodiment of the present application provides a computer program product, which includes a program or code. When the program or code is executed (for example, by a network device, a base station, one or more processors, etc.), it implements all or part of the steps of the clock source selection method provided in the above method embodiment.

[0158] The present application provides a chip including a programmable logic circuit and / or program instructions, which is used to implement all or part of the steps of the clock source selection method provided in the above method embodiment when the chip is running. Optionally, the chip is a processing chip.

[0159] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product, which includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium, or a semiconductor medium (e.g., a solid-state hard disk).

[0160] It should be understood that the term "at least one" in this application refers to one or more, and "a plurality of" refers to two or more. In this application, unless otherwise specified, the symbol " / " generally means or, for example, A / B can mean A or B. The term "and / or" in this application is merely a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, for the sake of clarity of description, this application uses words such as "first", "second", and "third" to distinguish between identical or similar items with basically the same functions and effects. Those skilled in the art will understand that words such as "first", "second", and "third" do not limit the quantity and execution order.

[0161] Different types of embodiments, such as method embodiments and device embodiments, provided in the embodiments of the present application can refer to each other. The order of operations of the method embodiments can be appropriately adjusted, and the operations can be increased or decreased in response to the situation. Any technician familiar with this technical field can easily think of different methods within the technical scope disclosed in this application, and they should all be covered within the scope of protection of this application, so they will not be repeated here.

[0162] In the corresponding embodiments provided in the present application, it should be understood that the disclosed devices and the like can be implemented through other structural methods. For example, the device embodiments described above are merely illustrative. For example, the division of modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. On the other hand, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical or other forms. The modules described as separate components may or may not be physically separated, and the components described as modules may or may not be physical modules, and may be located in one place or distributed on multiple network nodes. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0163] The above description is merely an exemplary embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included within the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A clock source selection method, characterized in that: The method comprises: The first device acquires a first data set and a second data set, where the first data set includes a first clock level and a first clock identifier, and the second data set includes a second clock identifier; When the first clock level is not better than a clock level threshold, the first device determines a clock source according to the first clock identifier and the second clock identifier, and the clock level threshold is configurable.

2. The method according to claim 1, characterized in that The first data set includes a first hop count, the second data set includes a second hop count, and the method further includes: when the first clock level is better than the clock level threshold, the first device determines a clock source according to the first hop count and the second hop count.

3. The method according to claim 1 or 2, characterized in that: The first clock level is not better than the clock level threshold includes that the first clock level is greater than the clock level threshold.

4. The method according to claim 3, characterized in that The clock level threshold is a clock level used to characterize a state in which a clock device normally tracks a time signal.

5. The method according to claim 1 or 2, characterized in that: The first clock level is not better than the clock level threshold includes that the first clock level is greater than or equal to the clock level threshold.

6. The method according to claim 5, characterized in that The clock level threshold is a clock level used to indicate that a time signal of a clock device is lost and the clock device is in a state of maintaining time availability.

7. The method according to claim 1 or 2, characterized in that: The first clock grade being not better than the clock grade threshold includes that the first clock grade is not in a clock grade set.

8. The method according to claim 7, characterized in that The clock level threshold is within the clock level set, and the clock levels within the clock level set include: a clock level used to characterize a state in which a clock device is normally tracking a time signal, and / or a clock level used to characterize a state in which a clock device has lost a time signal and the clock device is available while maintaining time, and / or a default clock level.

9. The method according to claim 8, characterized in that The attribute set defaultDS of the first device includes a clock class set defaultDS.clockClassSet field, and the defaultDS.clockClassSet field is used to record the clock class set.

10. The method according to any one of claims 1 to 9, characterized in that: The attribute set defaultDS of the first device includes a clock class threshold defaultDS.clockClassThreshold field, and the defaultDS.clockClassThreshold field is used to record the clock class threshold.

11. A clock source selection device, characterized in that: Applied to a first device, the apparatus comprises: An acquisition module, configured to acquire a first data set and a second data set, wherein the first data set includes a first clock level and a first clock identifier, and the second data set includes a second clock identifier; A source selection module is used to determine a clock source according to the first clock identifier and the second clock identifier when the first clock level is not better than a clock level threshold, and the clock level threshold is configurable.

12. The device according to claim 11, characterized in that The first data set includes a first hop count, the second data set includes a second hop count, and the source selection module is further used to determine a clock source according to the first hop count and the second hop count when the first clock level is better than the clock level threshold.

13. The device according to claim 11 or 12, characterized in that The first clock level is not better than the clock level threshold includes that the first clock level is greater than the clock level threshold.

14. The device according to claim 13, characterized in that The clock level threshold is a clock level used to characterize a state in which a clock device normally tracks a time signal.

15. The device according to claim 11 or 12, characterized in that The first clock level being not better than the clock level threshold includes the first clock level being greater than or equal to the clock level threshold.

16. The device according to claim 15, characterized in that The clock level threshold is a clock level used to indicate that a time signal of a clock device is lost and the clock device is in a state of maintaining time availability.

17. The device according to claim 11 or 12, characterized in that The first clock grade being not better than the clock grade threshold includes that the first clock grade is not in a clock grade set.

18. The device according to claim 17, characterized in that The clock level threshold is within the clock level set, and the clock levels within the clock level set include: a clock level used to characterize a state in which a clock device is normally tracking a time signal, and / or a clock level used to characterize a state in which a clock device has lost a time signal and the clock device is available while maintaining time, and / or a default clock level.

19. The device according to claim 18, characterized in that The attribute set defaultDS of the first device includes a clock class set defaultDS.clockClassSet field, and the defaultDS.clockClassSet field is used to record the clock class set.

20. The device according to any one of claims 11 to 19, characterized in that The attribute set defaultDS of the first device includes a clock class threshold defaultDS.clockClassThreshold field, and the defaultDS.clockClassThreshold field is used to record the clock class threshold.

21. A clock source selection device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is configured to execute the computer program stored in the memory so that the clock source selection device executes the method according to any one of claims 1 to 10.

22. A communication system, characterized in that: It comprises a first device and at least two clock devices, wherein the first device comprises the clock source selection apparatus as described in any one of claims 11 to 20, and the first device is used to determine a clock source in the at least two clock devices.

23. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 10 is implemented.

24. A computer program product, characterized in that The computer program product comprises a program or a code, and when the program or the code is executed, the method according to any one of claims 1 to 10 is implemented.

25. A chip, characterized in that: The chip implements the method according to any one of claims 1 to 10 when running.

Citation Information

Patent Citations

  • Clock source selection method and device and communication system

    CN119995762A

  • Method for determining Ethernet clock source and device for determining Ethernet clock source

    CN104426645A

  • Synchronization time source selection indication method, device and system

    CN105323086A

  • Method, device and system for processing time synchronization fault

    CN114258125A

  • Clock synchronization method and apparatus, computer device, and storage medium

    WO2021136149A1