Master-slave node time difference validity judgment method and device

By acquiring and processing the time parameters of the master and slave nodes, and calculating and filtering the time difference value, the problem of time difference calculation error in long-distance wireless high dynamic scenarios is solved, thereby improving the time synchronization accuracy and stability of the master and slave nodes.

CN121397705APending Publication Date: 2026-01-23TIANJIN JINHANG COMP TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511587676.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-03
Publication Date
2026-01-23

AI Technical Summary

Technical Problem

In long-distance, high-dynamic wireless scenarios, the time difference calculation of master and slave nodes is easily affected by calculation errors and external noise interference, resulting in spurious jumps in the calculated time difference value and affecting the time synchronization performance of master and slave nodes.

Method used

By acquiring the time parameters during the master-slave node time synchronization process, the current actual time difference and the predicted time difference are calculated. Valid time difference values ​​are identified using preset thresholds and filtering processes, and sudden jumps in data are eliminated to ensure that subsequent time synchronization is based on a time difference close to the actual time difference.

Benefits of technology

It effectively identifies and filters time difference jumps caused by calculation errors and noise interference, ensuring time synchronization accuracy, reducing time frequency tracking loop fluctuations, and improving the time synchronization stability between master and slave nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121397705A_ABST
    Figure CN121397705A_ABST
Patent Text Reader

Abstract

The invention relates to a master-slave node time difference validity judgment method and device. The method comprises the following steps: acquiring time parameters in a time synchronization process of a master node and a slave node; calculating a current actual time difference value between the master node and the slave node based on the time parameter; calculating a current predicted time difference value of the master node and the slave node based on the time parameter; obtaining a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; if the current time difference deviation value is smaller than a preset threshold, the current actual time difference value is judged to be effective, time difference kick caused by calculation errors, external noise and interference can be accurately recognized and filtered, and the problems that time frequency tracking loops of master and slave nodes fluctuate due to convex jump of an existing time difference calculation value, the larger the scene dynamics is, the larger the time difference calculation value is, the larger the time difference calculation value is, and the higher the time difference calculation value is, can be solved. And the time synchronization performance between the master node and the slave node is seriously influenced due to the larger fluctuation of the time frequency tracking loop.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of communication technology, in particular to a master-slave node time difference validity determination method and device. BACKGROUND

[0002] The master-slave node time difference refers to the time difference value of the local clocks of the master node and the slave node, which is a core index for measuring the time synchronization degree of the two, and the smaller the time difference, the higher the synchronization accuracy. If the time difference is too large or fluctuates frequently, it will directly affect the accuracy of collaborative tasks such as communication and data interaction.

[0003] However, in a long-distance wireless high-dynamic scenario, the time difference calculation process of the master-slave node is easily affected by calculation errors, external noise and interference, resulting in convex jumps in the time difference calculation value of the master-slave node. The convex jump of the time difference calculation value will cause the time and frequency tracking loop of the master-slave node to fluctuate, and the greater the scene dynamics, the greater the time and frequency tracking loop fluctuation, which seriously affects the time synchronization performance between the master-slave nodes. SUMMARY

[0004] The present application provides a master-slave node time difference validity determination method and device, which can solve the problem that the convex jump of the existing time difference calculation value causes the time and frequency tracking loop of the master-slave node to fluctuate, and the greater the scene dynamics, the greater the time and frequency tracking loop fluctuation, which seriously affects the time synchronization performance between the master-slave nodes.

[0005] In a first aspect, the present application provides a master-slave node time difference validity determination method, comprising: obtaining time parameters in the time synchronization process of the master node and the slave node; calculating a current actual time difference value of the master node and the slave node based on the time parameters; calculating a current predicted time difference value of the master node and the slave node based on the time parameters; obtaining a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; if the current time difference deviation value is less than a preset threshold, determining that the current actual time difference value is valid.

[0006] In some embodiments, the calculation of the current actual time difference value of the master node and the slave node based on the time parameters is specifically: based on the time parameters and the current actual time difference formula calculating the current actual time difference value of the master node and the slave node ; wherein T1 i+1 is the time stamp of the (i+1)th slave node sending NTP request, T2 i+1T3 is a time stamp for receiving an NTP request by the i+1th master node i+1 T4 is a time stamp for replying an NTP request by the i+1th master node i+1 T5 is a time stamp for receiving an NTP reply packet by the i+1th slave node

[0007] In some embodiments, the current predicted time difference value between the master node and the slave node is calculated based on the time parameter, specifically: a plurality of historical actual time difference values between the master node and the slave node are calculated based on the time parameter; the current predicted time difference value between the master node and the slave node is calculated based on the plurality of historical actual time difference values.

[0008] In some embodiments, the current predicted time difference value between the master node and the slave node is calculated based on the plurality of historical actual time difference values, specifically: the plurality of historical actual time difference values are obtained; a current predicted time difference formula is based on the plurality of historical actual time difference values and the current predicted time difference value the current predicted time difference value between the master node and the slave node is calculated ; wherein, is a coefficient weight, is the i+1th predicted time difference value.

[0009] In some embodiments, the plurality of historical actual time difference values are obtained, further comprising: a weight formula of the coefficient weight is set .

[0010] In some embodiments, if the current time difference deviation value is less than a preset threshold, it is determined that the current actual time difference value is valid, further comprising: the valid current actual time difference value is filtered to obtain a filtered time difference value; the clock source of the slave node is adjusted based on the filtered time difference value, so that the slave node is time-synchronized with the master node.

[0011] In a second aspect, the application provides a master-slave node time difference validity determination method, characterized in that, comprising: obtaining a time parameter in a master-slave node time synchronization process; calculating a current actual time difference value between the master node and the slave node based on the time parameter; calculating a current predicted time difference value between the master node and the slave node based on the time parameter; obtaining a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; If the current time difference deviation value is greater than or equal to a preset threshold, it is determined that the current actual time difference value is invalid.

[0012] In a third aspect, the present application provides a master-slave node time difference validity determination apparatus, comprising: a time difference calculation module, configured to acquire time parameters in a time synchronization process of a master node and a slave node; and calculate a current actual time difference value of the master node and the slave node based on the time parameters; a time difference prediction module, configured to calculate a current predicted time difference value of the master node and the slave node based on the time parameters; a threshold comparison module, configured to obtain a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; and if the current time difference deviation value is less than a preset threshold, it is determined that the current actual time difference value is valid.

[0013] In a fourth aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the master-slave node time difference validity determination method according to any one of the first aspect.

[0014] In a fifth aspect, the present application provides a computer readable storage medium, which stores a computer program, and the computer program implements the master-slave node time difference validity determination method according to any one of the first aspect when executed in a computer processor.

[0015] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art: The master-slave node time difference validity determination method and apparatus provided by the embodiments of the present application can acquire time parameters in a time synchronization process of a master node and a slave node; calculate a current actual time difference value of the master node and the slave node based on the time parameters; calculate a current predicted time difference value of the master node and the slave node based on the time parameters; obtain a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; and if the current time difference deviation value is less than a preset threshold, it is determined that the current actual time difference value is valid. This can accurately identify and filter time difference sudden jumps caused by calculation errors, external noise and interference, and only keep valid actual time difference values that conform to historical rules to ensure that subsequent time synchronization is based on data close to the real time difference between the master node and the slave node, thereby guaranteeing synchronization accuracy from the source, and solving the problem of time and frequency tracking loop fluctuations of the master node and the slave node caused by the convex jump of the existing time difference calculation value, and the greater the scene dynamics, the greater the time and frequency tracking loop fluctuations, which seriously affects the time synchronization performance between the master node and the slave node. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings, which are incorporated herein and constitute part of this specification, illustrate embodiments consistent with the application and serve to explain the principles of the application, together with the description given below.

[0017] In order to more clearly demonstrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced below. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.

[0018] One or more embodiments are illustrated by way of example in the drawings and are not intended to be limiting of the embodiments of the application, as described herein. Like reference numbers in the various drawings are meant to indicate like elements. The drawings provided are for purposes of illustration only and are not exhaustive or limiting.

[0019] Figure 1 A flowchart of a master-slave node time difference validity determination method provided by an embodiment of the present application; Figure 2 A schematic diagram of a master-slave node time synchronization method provided by an embodiment of the present application; Figure 3 A flowchart of a master-slave node time difference validity determination method provided by an embodiment of the present application; Figure 4 A structural schematic diagram of a master-slave node time difference validity determination device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0020] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0021] The following disclosure provides many different embodiments, or examples, for implementing different structures of the present application. For the purpose of simplification, the components and arrangements of the specific examples are described in the following description. Of course, they are only examples and are not intended to limit the present application. In addition, the present application can repeatedly refer to numbers and / or letters in different examples. Such repetition is for the purpose of simplification and clarity, and does not indicate the relationship between the various embodiments and / or arrangements discussed.

[0022] The master-slave node time difference refers to a time difference value of respective local clocks of the master node and the slave node, and is a core index for measuring a time synchronization degree of the two. The smaller the time difference is, the higher the synchronization accuracy is. A too large time difference or frequent fluctuation will directly affect the accuracy of collaborative tasks such as communication and data interaction.

[0023] However, in a long-distance wireless high-dynamic scene (for example, a high-speed mobile vehicle-mounted communication node, a low-altitude unmanned aerial vehicle communication link, a cross-regional long-distance wireless transmission, etc.), the time difference calculation process of the master node and the slave node faces multiple interferences, and data anomalies are prone to occur. On the one hand, random noise of a wireless channel and external electromagnetic interference will directly distort a timestamp signal, causing a time difference calculation deviation. On the other hand, a Doppler frequency offset caused by high-speed movement of a node, dynamic changes of a link transmission delay, and calculation errors caused by fluctuation of hardware computing power will further cause a time difference calculation value to suddenly jump (i.e., time difference sudden jump).

[0024] Such a time difference sudden jump will directly act on a time frequency tracking loop of the master node and the slave node. The sudden jump signal breaks the stable balance of the time frequency tracking loop, forces the loop to frequently adjust a clock phase and a frequency to adapt to an abnormal time difference, and further causes a loop fluctuation. The stronger the scene dynamics (for example, the faster the node moves, and the more intense the channel interference is), the higher the amplitude and frequency of the time difference sudden jump are, and the larger the fluctuation range of the tracking loop is. Ultimately, such a fluctuation will seriously damage a clock synchronization accuracy of the master node and the slave node, cause a data transmission timing disorder, interrupt a collaborative service, and even affect the operation stability of the entire communication system.

[0025] In a first aspect, as shown in FIG. 1, Figure 1 、 2 In view of the above technical problems, the embodiment of the present application provides a master-slave node time difference validity determination method, which comprises the following steps: S101: acquiring a time parameter in a time synchronization process of a master node and a slave node; S102: calculating a current actual time difference value of the master node and the slave node based on the time parameter; S103: calculating a current predicted time difference value of the master node and the slave node based on the time parameter; S104: obtaining a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; S105: if the current time difference deviation value is less than a preset threshold, determining that the current actual time difference value is valid.

[0026] It should be noted that the embodiment of the present application can accurately identify the time difference jump caused by calculation error, wireless noise and dynamic interference (such as jump data which directly destroys the stability of time synchronization) by comparing the current actual time difference value with the current predicted time difference value. The embodiment of the present application filters out the time difference jump by comparing the current time difference deviation value with the preset threshold T (i.e. whether the condition is met, if yes, the time difference calculation value is effective) and only retains the effective actual time difference value conforming to the historical rule, thereby ensuring that the subsequent time synchronization is based on the data close to the real time difference between the master node and the slave node, and guaranteeing the synchronization accuracy from the source. In addition, the current time difference is predicted based on the historical time parameter, so that the determination standard has dynamic adaptability. Even if the scene dynamicity is enhanced, the stable and effective data can be screened out by comparing the predicted value with the actual value, thereby reducing the impact of dynamic interference on the synchronization accuracy.

[0027] It should be noted that if the invalid time difference jump data enters the subsequent time frequency tracking loop, the clock phase and frequency will be frequently adjusted, thereby causing a large fluctuation. The embodiment of the present application can directly block the influence of invalid data on the tracking loop by pre-judgment and screening of effective data, so that the loop is adjusted only based on the stable and effective time difference value, thereby significantly reducing the fluctuation amplitude of the loop and improving the long-term stability of the clock synchronization between the master node and the slave node.

[0028] In some embodiments, the current actual time difference value between the master node and the slave node is calculated based on the time parameter, specifically as follows. The current actual time difference value between the master node and the slave node is calculated based on the time parameter and the current actual time difference formula ; wherein T1 i+1 is the NTP request timestamp sent by the slave node for the i+1th time, T2 i+1 is the NTP request timestamp received by the master node for the i+1th time, T3 i+1 is the NTP request timestamp replied by the master node for the i+1th time, and T4 i+1 is the NTP reply packet timestamp received by the slave node for the i+1th time.

[0029] It should be noted that, as shown in Figure 2 the time parameter includes the NTP request timestamp T1 i sent by the slave node for the ith time (with the slave node time as the reference), the NTP request timestamp T2 i received by the master node for the ith time (with the master node time as the reference), the NTP request timestamp T3 i replied by the master node for the ith time (with the master node time as the reference), and the NTP reply packet timestamp T4 i ​The ith NTP request packet transmission delay d1 (with reference to the slave node time) i The ith NTP reply packet transmission delay d2 i The time difference t between the master node and the slave node i .

[0030] It should be noted that the time difference calculation utilizes the NTP protocol to implement the time synchronization process, and through the continuous round-trip time correction between the slave node and the master node, it is ensured that the two are always in a state of time synchronization. The time synchronization mode is as shown in Figure 2 , and the time difference is calculated using four known parameters (as shown in Figure 2 ): T1 i , T2 i , T3 i , and T4 i . i represents the ith time difference calculation, i = 1, 2, …, and then: ……… (Formula 1) ……… (Formula 2) Assuming that the transmission distance remains the same during the information transmission process, that is: ……………………… (Formula 3) The time difference t i can be calculated as follows:

[0031] Therefore, the current actual time difference formula is .

[0032] It should be noted that "(T2 i+1 -T1 i+1 )" in the current actual time difference formula represents the link time (including transmission delay) from when the slave node sends a request to when the master node receives the request, and "(T4 i+1 -T3 i+1 )" represents the link time (also including transmission delay) from when the master node sends a reply to when the slave node receives the reply. Through the calculation logic of subtracting the two and then taking half, the symmetric transmission delay in the bidirectional link can be effectively offset, thereby stripping out the clock time difference between the master node and the slave node, avoiding the transmission delay from masking the true time difference, and significantly improving the calculation accuracy. Among them, the four time stamps required in the current actual time difference formula are all parameters generated in the NTP protocol interaction process, and no additional hardware modules (such as high-precision clock chips or additional sensors) are needed for calculation. Existing master and slave node devices (such as routers and Internet of Things gateways) that support the NTP protocol can directly collect these time stamps without the need for hardware modification, thereby reducing the deployment cost and engineering implementation difficulty of the scheme and facilitating implementation in existing communication systems.

[0033] In some embodiments, the time parameter is used to calculate a current predicted time difference value between the master node and the slave node, specifically: a plurality of historical actual time difference values between the master node and the slave node are calculated based on the time parameter; a current predicted time difference value between the master node and the slave node is calculated based on a plurality of the historical actual time difference values.

[0034] It should be noted that the embodiments of the present application first calculate a plurality of the historical actual time difference values based on the time parameter. The historical actual time difference values are all effective data reflecting the real time difference between the master node and the slave node in the past (and the sudden jump interference has been eliminated after the effectiveness determination in the foregoing), which can more objectively present the change rule (such as the slow drift trend of the clock) of the time difference between the master node and the slave node than the assumption or single data speculation, and provides basic data support close to the actual synchronization situation for the current predicted time difference value, thereby improving the prediction accuracy from the source.

[0035] It should be noted that the embodiments of the present application use a plurality of the historical actual time difference values for prediction instead of a single historical value, which can weaken the accidental deviation (such as a slight deviation of the historical time difference caused by a slight noise) of the single historical value. For example, if a historical value appears a small abnormality due to a temporary interference, the comprehensive calculation (such as weighted average, trend fitting) of a plurality of historical data can dilute the influence of the abnormality, so that the current predicted time difference value is more close to the real change trend of the time difference between the master node and the slave node, thereby improving the prediction accuracy.

[0036] In some embodiments, the current predicted time difference value between the master node and the slave node is calculated based on a plurality of the historical actual time difference values, specifically: a plurality of the historical actual time difference values are obtained; a current predicted time difference formula is used based on a plurality of the historical actual time difference values a current predicted time difference value between the master node and the slave node is calculated ; wherein, is a coefficient weight, is an (i+1)th predicted time difference value.

[0037] It should be noted that the current predicted time difference formula uses the coefficient weight to five historical actual time difference values (T1, T2, T3, T4, and T5) to ) is flexibly given a higher weight, and since the change trend of the master-slave node time difference (such as clock drift and dynamic fluctuations of the link) has short-term continuity, the recent data can better reflect the change trend of the current time difference. For example, if the i-th historical time difference has shown a slow increasing trend, the high weight can make the trend dominant in the predicted value, avoid the far-off outdated data from pulling the prediction direction, and make the current predicted time difference value closer to the change trend of the current real time difference, thereby improving the prediction accuracy.

[0038] It should be noted that even if some of the historical actual time difference values have slight accidental deviations (such as a slight fluctuation affected by transient noise), by reasonably setting the weight (such as giving low weight to the deviated data and high weight to the stable data), the interference of abnormal data on the prediction result can be greatly reduced. For example, if the i-2th historical value has a small abnormality due to transient interference, the corresponding weight value can be set to a small value, so that the proportion of the abnormal value in the summation process is reduced, and the stable i-1th and i-th data dominate the prediction result due to the high weight, so that the current predicted time difference value remains stable, and a single abnormal data does not cause a large deviation of the predicted value.

[0039] In some embodiments, the obtaining a plurality of the historical actual time difference values further includes: setting a weight formula of the coefficient weight .

[0040] It should be noted that the weight formula is a linear function, and the weight increases uniformly with j (the weight increases by 0.3 for every increase of 1 j), which avoids the problem of over-reliance on the latest data caused by non-linear weight (such as exponential increase). If the latest data has a slight accidental fluctuation, the weight of the linear increase can be balanced by the second-newest data (j=4, weight 0.5), so that the influence of the fluctuation on the predicted value is weakened. At the same time, the linearly changing weight can clearly convey the continuous change trend of the time difference (such as slow increase or slow decrease), so that the predicted value does not have a fault caused by sudden change of the weight, and the trend tracking and fluctuation smoothing are balanced.

[0041] In some embodiments, if the current time difference deviation value is less than a preset threshold, the current actual time difference value is determined to be valid, and the method further includes: filtering the valid current actual time difference value to obtain a filtered time difference value; adjusting the clock source of the slave node based on the filtered time difference value, so that the slave node is time-synchronized with the master node.

[0042] It should be noted that the current actual time difference value determined by the preset threshold is already removed from the jump interference, but small fluctuations (e.g., the normal time difference should be stable at 80 μs, and the actual effective data is small in 79.8 μs~80.2 μs) caused by random noise of the wireless channel and hardware sampling error may still remain. Through filtering processing (e.g., Kalman filtering, sliding average), such small fluctuations can be smoothed, and the filtered time difference value closer to the real time difference of the master and slave nodes is outputted. The preset threshold T is generally determined by simulation and combined with actual debugging.

[0043] It should be noted that the filtered time difference value accurately reflects the real time difference between the current slave node and the master node. The clock adjustment module can directly calculate the clock deviation amount to be adjusted based on this value. If the filtered time difference value is positive, it means that the slave node clock is slower than the master node clock, and the adjustment target is to speed up the slave node clock to gradually reduce the difference. If the filtered time difference value is negative, it means that the slave node clock is faster than the master node clock, and the adjustment target is to slow down the slave node clock until the difference approaches 0. If the filtered time difference value approaches 0, it means that the master and slave clocks have been basically synchronized, and no large adjustment is needed, only small fine tuning is needed.

[0044] It should be noted that when adjusting the clock source of the slave node, when the filtered time difference value is large, the slave node clock is directly jumped to the master node time to quickly reduce the gap and perform coarse calibration. When the filtered time difference value is small, the time difference is gradually offset by adjusting the running frequency of the slave node clock. That is, if the slave node clock is fast (the time difference is negative, i.e., the slave node time > master node time), the crystal frequency or software timing frequency of the slave node clock is reduced to make it "run slower". If the slave node clock is slow (the time difference is positive, i.e., the slave node time < master node time), the crystal frequency or software timing frequency of the slave node clock is increased to make it "run faster". Thus, the adjustment process is more smooth, and the business continuity will not be affected by the clock jump.

[0045] In summary, the master-slave node time difference effectiveness determination method provided by the embodiments of the present application obtains time parameters in the time synchronization process of the master node and the slave node; calculates a current actual time difference value of the master node and the slave node based on the time parameters; calculates a current predicted time difference value of the master node and the slave node based on the time parameters; obtains a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; if the current time difference deviation value is less than a preset threshold, it is determined that the current actual time difference value is effective, which can accurately identify and filter time difference sudden jumps caused by calculation errors, external noise and interference, and only effective actual time difference values meeting historical rules are retained to ensure that subsequent time synchronization is based on data close to the real time difference of the master-slave node, thereby guaranteeing synchronization accuracy from the source, and the problem of time and frequency tracking loop fluctuation of the master-slave node caused by the convex jump of the existing time difference calculation value can be solved, and the greater the scene dynamics, the greater the time and frequency tracking loop fluctuation, which seriously affects the time synchronization performance between the master-slave node.

[0046] In a second aspect, the present application provides a master-slave node time difference effectiveness determination method, comprising: S201: obtaining time parameters in the time synchronization process of the master node and the slave node; S202: calculating a current actual time difference value of the master node and the slave node based on the time parameters; S203: calculating a current predicted time difference value of the master node and the slave node based on the time parameters; S204: obtaining a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; S205: if the current time difference deviation value is greater than or equal to a preset threshold, determining that the current actual time difference value is invalid.

[0047] In a third aspect, as shown in the accompanying drawings, Figure 4 The present application provides a master-slave node time difference effectiveness determination device, comprising: A time difference calculation module 10 is configured to obtain time parameters in the time synchronization process of the master node and the slave node; and calculate a current actual time difference value of the master node and the slave node based on the time parameters. A time difference prediction module 20 is configured to calculate a current predicted time difference value of the master node and the slave node based on the time parameters. A threshold comparison module 30 is configured to obtain a current time difference deviation value based on the current actual time difference value and the current predicted time difference value; and if the current time difference deviation value is less than a preset threshold, determine that the current actual time difference value is effective.

[0048] In some embodiments, the calculation of the current actual time difference value of the master node and the slave node based on the time parameters is specifically: based on the time parameter and a current actual time difference formula calculating a current actual time difference value of the master node and the slave node ; wherein, T1 i+1 is an i+1th slave node sending NTP request timestamp, T2 i+1 is an i+1th master node receiving NTP request timestamp, T3 i+1 is an i+1th master node replying NTP request timestamp, T4 i+1 is an i+1th slave node receiving NTP reply packet timestamp.

[0049] In some embodiments, the current predicted time difference value of the master node and the slave node is calculated based on the time parameter, specifically: a plurality of historical actual time difference values of the master node and the slave node are calculated based on the time parameter; a current predicted time difference value of the master node and the slave node is calculated based on a plurality of historical actual time difference values.

[0050] In some embodiments, the current predicted time difference value of the master node and the slave node is calculated based on a plurality of historical actual time difference values, specifically: a plurality of historical actual time difference values are obtained; a current predicted time difference value of the master node and the slave node is calculated based on a plurality of historical actual time difference values and a current predicted time difference formula calculating a current predicted time difference value of the master node and the slave node ; wherein, is a coefficient weight, is an i+1th predicted time difference value.

[0051] In some embodiments, the plurality of historical actual time difference values are obtained, further comprising: setting a weight formula of the coefficient weight .

[0052] In some embodiments, if the current time difference deviation value is less than a preset threshold, it is determined that the current actual time difference value is valid, further comprising: performing filtering processing on the valid current actual time difference value to obtain a filtered time difference value; adjusting a clock source of the slave node based on the filtered time difference value, so that the slave node is time-synchronized with the master node.

[0053] In a fourth aspect, the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the master-slave node time difference validity determination method according to any one of the first aspect when executing the program.

[0054] In a fifth aspect, the present application provides a computer readable storage medium, which stores a computer program, wherein the computer program implements the master-slave node time difference validity determination method according to any one of the first aspect when executed in a computer processor.

[0055] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the present embodiment scheme.

[0056] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by means of software plus a general hardware platform, and of course can also be implemented by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0057] It is to be understood that the terminology used herein is for the purpose of describing particular example embodiments only and is not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises", "comprising", "includes", "including" and "has" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order in which they are described unless specifically identified as an order dependent step. It is also to be understood that additional or alternative steps can be employed. The above-described embodiments are intended to be illustrative only and in no way limiting of the present application. Numerous modifications and variations are possible in light of the above teachings without departing from the spirit and scope of the present application. Therefore, the present application is not to be limited to the examples described herein but is to be accorded the full scope consistent with the language of the claims, wherein reference to an element in the singular is not intended to mean "one and only one" unless specifically so stated, but rather "one or more."

Claims

1. A method for determining the validity of time difference between master and slave nodes, characterized in that, include: Obtain time parameters during the time synchronization process between the master node and the slave node; Calculate the current actual time difference between the master node and the slave node based on the time parameters; Calculate the current predicted time difference between the master node and the slave node based on the time parameters; The current time difference deviation value is obtained based on the current actual time difference value and the current predicted time difference value; If the current time difference deviation value is less than a preset threshold, then the current actual time difference value is determined to be valid.

2. The method for determining the validity of the master-slave node time difference according to claim 1, characterized in that, The calculation of the current actual time difference between the master node and the slave node based on the time parameter specifically involves: Based on the aforementioned time parameters and the current actual time difference formula Calculate the current actual time difference between the master node and the slave node. ; Among them, T1 i+1 T2 is the timestamp of the (i+1)th time the slave node sends an NTP request. i+1 T3 is the timestamp of the (i+1)th time the master node receives the NTP request. i+1 For the (i+1)th master node's reply to the NTP request, the timestamp T4 is... i+1 This is the timestamp of the (i+1)th time the node receives an NTP reply packet.

3. The method for determining the validity of the master-slave node time difference according to claim 1, characterized in that, The calculation of the current predicted time difference between the master node and the slave node based on the time parameter specifically involves: Calculate multiple historical actual time difference values ​​between the master node and the slave node based on the time parameters; The current predicted time difference between the master node and the slave node is calculated based on multiple historical actual time difference values.

4. The method for determining the validity of the master-slave node time difference according to claim 3, characterized in that, The calculation of the current predicted time difference between the master node and the slave node based on multiple historical actual time difference values ​​specifically involves: Obtain multiple historical actual time difference values; Based on multiple historical actual time difference values ​​and the current predicted time difference formula Calculate the current prediction time difference between the master node and the slave node. ; in, For coefficient weights, This is the prediction time difference value for the (i+1)th time.

5. The method for determining the validity of the master-slave node time difference according to claim 4, characterized in that, The process of obtaining multiple historical actual time difference values ​​also includes: The weighting formula for setting the coefficient weights .

6. The method for determining the validity of the master-slave node time difference according to claim 1, characterized in that, The step of determining that the current actual time difference value is valid if the current time difference deviation value is less than a preset threshold further includes: The valid current actual time difference value is filtered to obtain the filtered time difference value; The clock source of the slave node is adjusted based on the filtered time difference value to synchronize the time of the slave node with that of the master node.

7. A method for determining the validity of time difference between master and slave nodes, characterized in that, include: Obtain time parameters during the time synchronization process between the master node and the slave node; Calculate the current actual time difference between the master node and the slave node based on the time parameters; Calculate the current predicted time difference between the master node and the slave node based on the time parameters; The current time difference deviation value is obtained based on the current actual time difference value and the current predicted time difference value; If the current time difference deviation value is greater than or equal to a preset threshold, then the current actual time difference value is determined to be invalid.

8. A device for determining the validity of time difference between master and slave nodes, characterized in that, include: The time difference calculation module is used to obtain time parameters during the time synchronization process between the master node and the slave node; Calculate the current actual time difference between the master node and the slave node based on the time parameters; The time difference prediction module is used to calculate the current predicted time difference between the master node and the slave node based on the time parameters; The threshold comparison module is used to obtain the current time difference deviation value based on the current actual time difference value and the current predicted time difference value; If the current time difference deviation value is less than a preset threshold, then the current actual time difference value is determined to be valid.

9. A computer device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the master-slave node time difference validity determination method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed in a computer processor, implements the master-slave node time difference validity determination method as described in any one of claims 1-7.