Time source selection method and system based on time partition and computer equipment
By partitioning the time sources in the time synchronization device and selecting the time source with the smallest clock difference based on the deviation from the local clock, the problem of low flexibility in source selection in the existing technology is solved, and the accuracy and stability of time synchronization are achieved.
Patent Information
- Application Number
- CN202510744914.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-05
- Publication Date
- 2025-09-05
AI Technical Summary
Existing time synchronization devices select time sources by manually setting priorities, which is not very flexible and cannot respond to changes in time source quality in a timely manner, affecting device stability and signal performance.
A time partitioning method is used to perform partitioning by calculating the deviation between the time source and the local clock, eliminating time sources with large second-occurrence moment deviations and selecting the time source with the smallest clock difference as the optimal time source.
The flexibility and accuracy of source selection of time synchronization devices are improved, the steps of analyzing each valid time source one by one are reduced, the optimal time source is selected quickly, and stable operation of the equipment and signal performance are ensured.
Smart Images

Figure CN120602032A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of time synchronization of multiple time sources, and in particular to the technical field of a time source selection method, system and computer equipment based on time partitioning. Background Art
[0002] Time synchronization devices (clock systems) are used to ensure that each device in a network has accurate and consistent time. They receive time signals and transmit them to devices in the network to achieve time synchronization between multiple devices. Time synchronization devices need to select an accurate time source as a reference. Currently, time synchronization devices on the market use a priority scheme for time source selection. That is, when all time sources are valid, the highest priority time source is selected for device time synchronization. When the high-priority time source fails, the second-priority time source is selected for device time synchronization. When all time sources are invalid, the local clock is used for self-timekeeping.
[0003] This method of selecting sources based on preset priorities for multiple time sources is essentially a manual source selection method. Priorities are first manually preset, and then sources are selected based on the preset priorities. However, this method does not offer high flexibility in source selection. The time source selected by the time synchronization device depends entirely on the preset priorities, rather than on the real-time accuracy and quality of the time source. Therefore, there is no guarantee that the selected time source is the optimal source. Furthermore, when a high-priority time source experiences problems such as degraded signal quality or decreased accuracy, this method is unable to promptly respond to changes in time source quality and automatically switch time sources, potentially impacting the stable operation of the device and output signal performance. Summary of the Invention
[0004] Based on this, the purpose of the present invention is to provide a time source selection method based on time partitioning. By partitioning the acquired time sources, the deviations between each acquired time source and the local clock are collectively distributed, multiple time source intervals are defined, and time sources with large second-occurrence moment offsets are eliminated, thereby achieving the effect of selecting the optimal time source.
[0005] The present invention is implemented through the following technical solutions: On the one hand, the present invention provides a time source selection method based on time partitioning, comprising:
[0006] S10: Acquire multiple time sources and perform validity filtering calculation on each time source to obtain a set of valid time sources, where each time source has its corresponding time source code;
[0007] S20: Calculate the deviation between each valid time source in the valid time source set and the local clock to obtain the time source clock error of each valid time source;
[0008] S30: Calculating the time source deviation between two valid time sources based on the time source clock difference of each valid time source;
[0009] S40: Partitioning the valid time sources according to the time source clock error of each valid time source, the time source deviation between any two valid time sources, and a preset time source partition threshold, to obtain the number of time source partitions and the number of valid time sources in each partition;
[0010] S50: Acquire the interval with the most time sources as the target interval, and take the time source with the smallest time source clock error in the interval as the optimal time source.
[0011] Furthermore, the step S40 includes:
[0012] S401: sorting each valid time source according to the size of its time source clock difference;
[0013] S402: Selecting a valid time source as a time reference according to the sorted valid time source sequence, and partitioning the valid time source according to the time source deviation between the valid time source and other valid time sources and the time source partition threshold;
[0014] S403: Repeat step S402 until each valid time source is partitioned, and obtain the number of time source partitions and the number of valid time sources in each partition and their valid time source indexes.
[0015] Furthermore, after the first execution of step S402, the following steps are further included:
[0016] Determine whether the first time source partition includes all valid time source indexes. If so, end the partitioning; otherwise, execute step S403.
[0017] Furthermore, after step S403, the following steps are further included:
[0018] S404A: If there is a time source partition other than the first one that includes all valid time source indexes, perform permutation and combination calculations on the time source indexes of the two adjacent partitions before and after the partition to obtain a corrected time source partition ratio.
[0019] Furthermore, after step S403, the following steps are further included:
[0020] S404B: If there are repeated time source indexes between time source partitions and all valid time source indexes are not included, a time partition is established using the time source with the smallest time source clock error as the reference signal, and other valid time sources are calculated separately as partitions, so that the time source deviation between the time sources in each partition is less than the time source partition threshold.
[0021] On the other hand, the present invention also provides a time source selection system based on time partitioning, comprising:
[0022] Time source validity determination unit: used to obtain multiple time sources and perform validity filtering calculation on each time source to obtain a set of valid time sources, where each time source has its corresponding time source code;
[0023] A time source clock difference calculation unit is used to calculate the deviation between each valid time source in the valid time source set and the local clock, and obtain the time source clock difference of each valid time source;
[0024] Time source deviation calculation unit: calculates the time source deviation between two valid time sources based on the time source clock difference of each valid time source;
[0025] Time source partitioning unit: partitions the valid time sources according to the time source clock error of each valid time source, the time source deviation between two valid time sources, and a preset time source partitioning threshold, and obtains the number of time source partitions and the number of valid time sources in each partition;
[0026] Time source selection unit: obtains the interval with the most time sources as the target interval, and takes the time source with the smallest clock error within the interval as the optimal time source.
[0027] Furthermore, it also includes: a database update module: used to obtain the specific fault type determined by the data center and update the historical fault data in the database.
[0028] Furthermore, the time source partition unit includes:
[0029] Time source sorting subunit: sorts each valid time source according to the size of its time source clock difference;
[0030] Sorting and partitioning subunit: selects a valid time source as a time reference according to the sorted valid time source sequence, and partitions the valid time source according to the time source deviation between the valid time source and other valid time sources and the time source partitioning threshold;
[0031] Partition synthesis subunit: used to obtain the number of time source partitions and the number of valid time sources in each partition and their valid time source indexes after each valid time source is partitioned.
[0032] Furthermore, the time source partition unit further includes:
[0033] Full coverage partition subunit: used to perform permutation and combination calculations on the time source indexes of the two adjacent partitions before and after the partition if all valid time source indexes are included in the time source partition other than the first one, to obtain the corrected time source partition ratio.
[0034] Furthermore, the time source partition unit further includes:
[0035] Semi-covering partition subunit: used to establish a time partition using the time source with the smallest time source clock error as the reference signal if there is duplication of time source indexes between time source partitions and does not include all valid time source indexes. Other valid time sources are calculated separately for partitioning, so that the time source deviation between time sources in each partition is less than the time source partition threshold.
[0036] In another aspect, the present invention further provides a computer device comprising:
[0037] at least one memory and at least one processor;
[0038] The memory is used to store one or more programs;
[0039] When the one or more programs are executed by the at least one processor, the at least one processor implements the steps of a time source selection method based on time partitioning in any one of the above methods.
[0040] The present invention partitions the acquired time sources, collectively distributes the deviations between each acquired time source and the local clock, selects the interval with the largest distribution of valid actual sources within the interval as the interval of optimal time source distribution in combination with the accuracy requirements of the valid time sources themselves, and then performs a secondary judgment based on the clock differences between the time sources within the interval and the local clock, and selects the time source with the smallest deviation from the local clock as the optimal time source. This solves the problems of low source selection flexibility and difficulty in ensuring the accuracy of time source signals in the existing time synchronization method for equipment timing based on priority, and can reduce the operation steps of parsing each valid time source one by one by eliminating time sources with large second-occurrence moment deviations, thereby quickly selecting the optimal time source.
[0041] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A structural diagram of a time source selection system based on time partitioning provided by the present invention;
[0043] Figure 2 for Figure 1 An execution flow chart of the system shown;
[0044] Figure 3 This is a specific execution flow chart of step S40 of the present invention;
[0045] Figure 4This is a specific execution flow chart of step S40 in another embodiment of the present invention;
[0046] Figure 5 is the position of multiple time sources on a time axis with a local clock as a reference signal in an exemplary embodiment of the present invention;
[0047] Figure 6 This is the position of multiple time sources on the time axis with the local clock as the reference signal in another exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0048] It should be known that before the calibration process of the local clock of the time synchronization device with multiple time sources, there will be a validity judgment of the acquired time source. Only the time source that is judged to be valid can participate in the calibration of the local clock. This means that for each valid time source, it can be used as an instant time reference. Then, in order to judge the pros and cons of each signal source, it is necessary to analyze each valid time source one by one to obtain the optimal time source. However, if the pros and cons of the valid time source are to be judged, it is necessary to comprehensively consider multiple parameters of each valid time source (such as time source type, time source performance, quality, and location). This comprehensive consideration method is not only inefficient, but also has low operability. From another perspective, From this perspective, the relationship between the effective time source and the local clock is essentially to calibrate the local clock through the current time of the effective time source. Therefore, it can be judged based on the deviation between the effective time source and the local clock, and the effective time source is partitioned. By collectively distributing the deviation between each acquired time source and the local clock, multiple time source intervals are defined. Since the time source itself needs to meet the accuracy requirements, the interval with the most effective time sources can be considered as the interval with the optimal time source distribution. In this way, time sources with large deviations in the second occurrence moment can be quickly eliminated, thereby reducing the steps of parsing each effective time source one by one, and quickly selecting the optimal time source.
[0049] Before describing the present invention in detail, the following definitions are provided:
[0050] Timestamp counting uses timestamps to record the second time of each time source.
[0051] The time source clock offset converts the timestamp count to the time source's deviation from the local clock. This data serves as the time source base data, facilitating subsequent calculations of individual time source deviations.
[0052] Time source deviation, the time deviation between two time sources is called time source deviation.
[0053] See also Figure 1 and Figure 2 , Figure 1 This is a structural block diagram of a time source selection system based on time partitioning provided by the present invention; Figure 2 for Figure 1 The execution flow chart of the system shown in the figure; the time source selection system includes: a time source validity determination unit 10, a time source clock difference calculation unit 20, a time source deviation calculation unit 30, a time source partitioning unit 40 and a time source selection unit 50. The time source validity acquisition unit 10 determines the validity of the acquired time source, and eliminates it when any condition of the signal does not meet the validity rule. The time source clock difference calculation unit 20 takes the local clock as the 0 time and calculates the deviation of each valid time source relative to the local clock as the clock difference of each valid time source. The time source deviation calculation unit 30 calculates the deviation between each time source based on the time source clock difference; the time source partitioning unit 40 marks the position of each valid time source on the time axis with the time source deviation, and completes the partitioning of the valid time sources based on the deviation between the two time sources and a preset time source partitioning threshold; finally, the time source selection unit selects the optimal time source based on the partitioning status of the time source. The execution flow of each component of the time source selection system is as follows:
[0054] The time source validity acquisition unit 10 is used to execute step S10: acquire multiple time sources and perform validity filtering calculation on each time source to obtain a set of valid time sources, wherein each time source has its corresponding time source code.
[0055] The validity judgment of the time source usually includes the judgment of signal connection status, signal status and time source time jump. When any condition is not met, the time source is defined as invalid and does not participate in the time source selection algorithm.
[0056] The time source clock difference calculation unit 20 is configured to execute step S20: calculating the deviation between each valid time source in the valid time source set and the local clock to obtain the time source clock difference of each valid time source.
[0057] The time source clock difference is defined as the deviation between the time source and the local clock. When calculating the time source clock difference, an accumulator counter is used to form a timestamp. In the present invention, the accumulator counter adopts a 27-bit counter with a counting range of 0-227 (134217328) and a counter accuracy of 8ns, that is, the total time is 1073741824ns, ensuring that it can cover milliseconds, microseconds and nanoseconds. By recording the timestamp of the time when the PPS (pulse per second signal) signal of each time source arrives, the clock difference of each time source is calculated, which facilitates the subsequent calculation of the deviation of each time source. Assume that the valid time sources include time sources 1, 2, 3, and 4. Their timestamps are as follows: time source 1 counter value 642425, time source 2 counter value 642548, time source 3 counter value 642530, time source 4 counter value 642580, and local clock counter value 642535. The time source clock difference value is based on the local clock as time zero (because the PPS signal of the local clock is always present, while the PPS signal of the time source may have time-limited situations). The deviation of each clock source relative to the local clock is calculated and defined as the clock difference of each time source. The time source clock difference data is recorded in the time source data structure. The clock source clock difference calculation method is as follows:
[0058] Time source 1 clock error = (time source 1 counter value – local clock counter value) * counter accuracy = (642425 - 642535) * 8 = -880ns;
[0059] Time source 2 clock error = (time source 1 counter value – local clock counter value) * counter accuracy = (642548 - 642535) * 8 = 104 ns;
[0060] Time source 3 clock error = (time source 1 counter value – local clock counter value) * counter accuracy = (642530 - 642535) * 8 = -40ns;
[0061] Time source 4 clock difference = (time source 1 counter value – local clock counter value) * counter accuracy = (642580 - 642535) * 8 = 360 ns;
[0062] Local clock source clock error = (local clock counter value – local clock counter value) * counter accuracy = 0ns;
[0063] In the above manner, the deviation between each effective time source and the local clock is obtained.
[0064] The time source deviation calculation unit 30 is configured to execute step S30 : calculating the time source deviation between any two valid time sources according to the time source clock difference of each valid time source.
[0065] Time source deviation is the relative deviation between time sources. The time source deviation of a time source relative to the local clock is the clock difference of each time source. The time source deviation between two time sources is the relative deviation of the two time source clock differences. The specific time source deviation calculation example is as follows:
[0066] The time source deviation between time source 1 and time source 2 = time source 1 clock difference – time source 2 clock difference = -880ns - 104ns = -984ns;
[0067] The time source deviation between time source 1 and the local clock source = time source 1 clock deviation = -880 ns. The calculation method for the deviation of other time sources is the same as the above method.
[0068] The time source partitioning unit 40 is used to execute step S40: partition the valid time sources according to the time source clock error of each valid time source, the time source deviation between two valid time sources, and a preset time source partitioning threshold, to obtain the number of time source partitions and the number of valid time sources in each partition.
[0069] Time source partitioning is to analyze the distribution of time source accuracy and select the optimal time source based on the distribution analysis of time source accuracy.
[0070] See also Figure 3 , step S40 specifically includes:
[0071] S401: sorting each valid time source according to the size of its time source clock difference;
[0072] S402: Selecting a valid time source as a time reference according to the sorted valid time source sequence, and partitioning the valid time source according to the time source deviation between the valid time source and other valid time sources and the time source partition threshold;
[0073] In ascending order, using each valid time source as the time reference, record the number and index of time sources whose time deviation is less than the time source partition threshold (5us) upwards and downwards. All valid time sources within this range belong to the same partition.
[0074] S403: Repeat step S402 until each valid time source is partitioned, and obtain the number of time source partitions and the number of valid time sources in each partition and their valid time source indexes.
[0075] After the allocation is completed, the number of time source partitions and the number of valid time sources in each partition and their valid time source indexes can be obtained.
[0076] Preferably, after the first execution of step S402, the method further includes: determining whether the first time source partition includes all valid time source indexes, and if so, terminating the partitioning; otherwise, executing step S403.
[0077] When the first time source partition includes all valid time source indexes, all subsequent time sources will be within this interval. Therefore, there is no need to divide them one by one, which reduces the computational complexity of partitioning and improves the efficiency of time source selection.
[0078] The time source selection unit 50 is configured to execute step S50: obtaining an interval with the most time sources as a target interval, and taking the time source with the smallest time source clock error within the interval as the optimal time source.
[0079] Based on the number of valid time sources in each partition, the interval with the most time sources can be determined and used as the interval for the optimal time source distribution. Then, based on the index of the valid time source in this interval, the clock difference between the corresponding valid time source and the local clock is searched. The time source with the smallest clock difference is selected as the optimal time source to complete time synchronization.
[0080] The present invention partitions the acquired time sources, collectively distributes the deviations between each acquired time source and the local clock, selects the interval with the largest distribution of valid actual sources within the interval as the interval of optimal time source distribution in combination with the accuracy requirements of the valid time sources themselves, and then performs a secondary judgment based on the clock differences between the time sources within the interval and the local clock, and selects the time source with the smallest deviation from the local clock as the optimal time source. This solves the problems of low source selection flexibility and difficulty in ensuring the accuracy of time source signals in the existing time synchronization method for equipment timing based on priority, and can reduce the operation steps of parsing each valid time source one by one by eliminating time sources with large second-occurrence moment deviations, thereby quickly selecting the optimal time source.
[0081] Due to the uncertainty of time source distribution, it is possible that multiple time partitions with the same number of time sources exist within a time source partition during the partitioning process. In order to further narrow the range of optimal time sources, please refer to Figure 4 , the present invention further includes after step S403:
[0082] S404A: If there is a time source partition other than the first one that includes all valid time source indexes, perform permutation and combination calculations on the time source indexes of the two adjacent partitions before and after the partition to obtain a revised time source partition ratio. This step is performed by the full coverage partition sub-unit.
[0083] Define the time source priority as time source 1 > time source 2 > time source 3 > time source 4. Time source 2 is the local clock source. This example uses three valid time sources + the local clock source, for a total of four valid time sources. The same process applies to other valid time sources.
[0084] See also Figure 5 In this partitioning situation, after executing steps S401-S403, there are four time partitions as follows:
[0085] The number of valid time sources for the first time partition is 2, and the time source index includes time source 1 and time source 2;
[0086] The number of valid time sources for the second time partition is 4, and the time source index includes time source 1, time source 2, time source 3, and time source 4;
[0087] The number of valid time sources in the third time partition is 3, and the time source index includes time source 2, time source 3, and time source 4;
[0088] The number of valid time sources for the fourth time partition is 3, and the time source index includes time source 2, time source 3, and time source 4;
[0089] The second time partition contains all time source indexes, and performs statistical operations on the first and third time partitions. Therefore, the partition ratio is 1:3, that is, there are two time partitions in the end. The first includes time source 1, and the second includes time sources 2, 3, and 4. The time source with the smallest deviation from the local clock among the three time sources is selected as the reference clock, that is, time source 3 is selected as the reference clock.
[0090] Or after step S403, the following steps are included:
[0091] S404B: If time source indexes overlap between time source partitions and do not include all valid time source indexes, a time partition is established using the time source with the smallest clock error as the reference signal. Other valid time sources are then individually calculated to ensure that the time source deviations between time sources within each partition are less than the time source partition threshold. This step is performed by the semi-partition coverage sub-unit.
[0092] like Figure 6 As shown, there are five valid time sources defined, 1, 2, 3, 4, and 5. After executing steps S401-S403 in this partitioning situation, there are the following five time partitions:
[0093] The number of valid time sources for the first time partition is 3, and the time source index includes time source 1, time source 2, and time source 3;
[0094] The number of valid time sources for the second time partition is 3, and the time source index includes time source 1, time source 2, and time source 3;
[0095] The number of valid time sources for the third time partition is 4, and the time source index includes time source 1, time source 2, time source 3, and time source 4;
[0096] The number of valid time sources for the fourth time partition is 3, and the time source index includes time source 3, time source 4, and time source 5;
[0097] The number of valid time sources in the fifth time partition is 2, and the time source index includes time source 4 and time source 5.
[0098] At this point, the time sources overlap and no partition containing all the time sources is found. Time source partitioning is performed using the minimum time source clock error, with a partition ratio of 3:2. Time source 3 is then selected as the reference signal. In this case, the reference signal selected is time source 3, not time source 4. This shows that the algorithm has been successfully implemented. By performing a secondary division of the time partitions through the above steps, the partitioning accuracy is further improved, and the accuracy of the optimal time source can also be further improved. It should be noted that the accuracy of the time partitioning algorithm increases with the increase in the number of time sources. Based on statistical thinking, the distribution of time sources is statistically analyzed, and the optimal time source for the time synchronization device is selected in combination with the time source partition information.
[0099] Based on the same inventive concept described above, the present invention further provides an electronic device, which can be a terminal device such as a server, desktop computing device, or mobile computing device (e.g., laptop computing device, handheld computing device, tablet computer, netbook, etc.). The device includes one or more processors and a memory, wherein the processor is configured to execute a program to implement the above-described time source selection method based on time partitioning; and the memory is configured to store a computer program executable by the processor.
[0100] Based on the same inventive concept, the present invention also provides a computer-readable storage medium, corresponding to the embodiment of the aforementioned time source selection method based on time partitioning, wherein the computer-readable storage medium stores a computer program thereon, and when the program is executed by a processor, it implements the steps of the time source selection method based on time partitioning recorded in any of the aforementioned embodiments.
[0101] The present invention may take the form of a computer program product implemented on one or more storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-usable storage media include permanent and non-permanent, removable and non-removable media, and may be implemented by any method or technology for information storage. The information may be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
[0102] The above-described embodiments merely represent several implementations of the present invention. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art would be able to make numerous modifications and improvements without departing from the spirit of the present invention, and the present invention is intended to encompass such modifications and variations.
Claims
1. A time source selection method based on time partitioning, characterized in that: include: S10: Acquire multiple time sources and perform validity filtering calculation on each time source to obtain a set of valid time sources, wherein each time source has its corresponding time source code; S20: Calculate the deviation between each valid time source in the valid time source set and the local clock to obtain the time source clock error of each valid time source; S30: Calculating the time source deviation between two valid time sources based on the time source clock difference of each valid time source; S40: Partitioning the valid time sources according to the time source clock error of each valid time source, the time source deviation between any two valid time sources, and a preset time source partition threshold, to obtain the number of time source partitions and the number of valid time sources in each partition; S50: Acquire the interval with the most time sources as the target interval, and take the time source with the smallest time source clock error in the interval as the optimal time source.
2. The time source selection method based on time partitioning according to claim 1 is characterized in that: The step S40 includes: S401: sorting each valid time source according to the size of its time source clock difference; S402: Selecting a valid time source as a time reference according to the sorted valid time source sequence, and partitioning the valid time source according to the time source deviation between the valid time source and other valid time sources and the time source partition threshold; S403: Repeat step S402 until each valid time source is partitioned, and obtain the number of time source partitions and the number of valid time sources in each partition and their valid time source indexes.
3. The time source selection method based on time partitioning according to claim 2 is characterized in that: After the first execution of step S402, the method further includes: Determine whether the first time source partition includes all valid time source indexes. If so, end the partitioning; otherwise, execute step S403.
4. The time source selection method based on time partitioning according to claim 3 is characterized in that: After step S403, the following steps are further included: S404A: If there is a time source partition other than the first one that includes all valid time source indexes, perform permutation and combination calculations on the time source indexes of the two adjacent partitions before and after the partition to obtain a corrected time source partition ratio.
5. The time source selection method based on time partitioning according to claim 4 is characterized in that: After step S403, the following steps are further included: S404B: If there are repeated time source indexes between time source partitions and all valid time source indexes are not included, a time partition is established using the time source with the smallest time source clock error as the reference signal, and other valid time sources are calculated separately as partitions, so that the time source deviation between the time sources in each partition is less than the time source partition threshold.
6. A time source selection system based on time partitioning, characterized in that: include: Time source validity determination unit: used to obtain multiple time sources and perform validity filtering calculation on each time source to obtain a set of valid time sources, where each time source has its corresponding time source code; A time source clock difference calculation unit is used to calculate the deviation between each valid time source in the valid time source set and the local clock, and obtain the time source clock difference of each valid time source; Time source deviation calculation unit: calculates the time source deviation between two valid time sources based on the time source clock difference of each valid time source; Time source partitioning unit: partitions the valid time sources according to the time source clock error of each valid time source, the time source deviation between two valid time sources, and a preset time source partitioning threshold, and obtains the number of time source partitions and the number of valid time sources in each partition; Time source selection unit: obtains the interval with the most time sources as the target interval, and takes the time source with the smallest clock error within the interval as the optimal time source.
7. The time source selection system based on time partitioning according to claim 6, characterized in that: The time source partition unit includes: Time source sorting subunit: sorts each valid time source according to the size of its time source clock error; Sorting and partitioning subunit: selects a valid time source as a time reference according to the sorted valid time source sequence, and partitions the valid time source according to the time source deviation between the valid time source and other valid time sources and the time source partitioning threshold; Partition integration subunit: used to obtain the number of time source partitions and the number of valid time sources in each partition and their valid time source indexes after each valid time source is partitioned.
8. The time source selection system based on time partitioning according to claim 7, characterized in that: The time source partition unit further includes: Full coverage partition subunit: used to perform permutation and combination calculations on the time source indexes of the two adjacent partitions before and after the partition if all valid time source indexes are included in the time source partition other than the first one, to obtain the corrected time source partition ratio.
9. The time source selection system based on time partitioning according to claim 8, characterized in that: The time source partition unit further includes: Semi-covering partition subunit: used to establish a time partition using the time source with the smallest time source clock error as the reference signal if there is duplication of time source indexes between time source partitions and does not include all valid time source indexes. Other valid time sources are calculated separately for partitioning, so that the time source deviation between time sources in each partition is less than the time source partition threshold.
10. A computer device, characterized in that: include: at least one memory and at least one processor; The memory is used to store one or more programs; When the one or more programs are executed by the at least one processor, the at least one processor implements the steps of the time source selection method based on time partitioning as described in any one of claims 1 to 5.