CN113992295A - Method and system for realizing timing of multiple NTP (network time protocol) servers, computer equipment and storage medium - Google Patents

Method and system for realizing timing of multiple NTP (network time protocol) servers, computer equipment and storage medium Download PDF

Info

Publication number
CN113992295A
CN113992295A CN202111271321.1A CN202111271321A CN113992295A CN 113992295 A CN113992295 A CN 113992295A CN 202111271321 A CN202111271321 A CN 202111271321A CN 113992295 A CN113992295 A CN 113992295A
Authority
CN
China
Prior art keywords
ntp server
time
ntp
address
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111271321.1A
Other languages
Chinese (zh)
Other versions
CN113992295B (en
Inventor
李国文
王承
刘宗明
欧霞
钟强
李剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shibang Communication Co ltd
Original Assignee
Shibang Communication Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shibang Communication Co ltd filed Critical Shibang Communication Co ltd
Priority to CN202111271321.1A priority Critical patent/CN113992295B/en
Publication of CN113992295A publication Critical patent/CN113992295A/en
Application granted granted Critical
Publication of CN113992295B publication Critical patent/CN113992295B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

The invention discloses a method and a system for realizing timing of a plurality of NTP servers, computer equipment and a storage medium, wherein the method comprises the steps of establishing an NTP server list; selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address; judging whether the time acquisition of the NTP server is successful or not; and comparing the current NTP server time with the local time, and judging whether the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value. According to the method, the NTP server time is acquired by setting the plurality of NTP server addresses, after the time of one NTP server fails to be acquired, the NTP server time can be acquired according to the other NTP server address, the NTP server time is matched with the local time to be compared, and finally the local time is set, so that the fault tolerance of the system is effectively improved, the time synchronization reliability of the NTP server and a terminal is enhanced, the product quality is greatly improved, and the abnormal phenomenon of asynchronous broadcast sound is effectively reduced.

Description

Method and system for realizing timing of multiple NTP (network time protocol) servers, computer equipment and storage medium
Technical Field
The invention relates to the technical field of audio broadcasting, in particular to a method and a system for realizing timing of a multi-NTP server, computer equipment and a storage medium.
Background
In the application of the broadcasting field, there is a basic requirement that when a broadcasting task is played, each broadcasting terminal needs to ensure the consistency of sound, and the condition of uneven sound cannot occur.
Disclosure of Invention
Based on this, the present invention aims to provide a method and a system for implementing timing of a multi NTP server, a computer device and a storage medium, which ensure the time consistency of broadcast terminals and improve the sound synchronization when the broadcast terminals receive broadcast information.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows:
in a first aspect, a method for implementing timing of a multi NTP server is provided, which includes the following steps:
step S110, establishing an NTP server list;
step S120, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address;
step S130, judging whether the time acquisition of the NTP server is successful, if not, executing step S120; if yes, go to step S140;
step S140, comparing the current NTP server time with the local time, judging whether the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S120.
In a second aspect, a method for implementing timing of a multi NTP server is further provided, which includes the following steps:
step S210, establishing an NTP server list;
step S220, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address;
step S230, judging whether the time acquisition of the NTP server is successful, if not, switching to step S220; if yes, go to step S240;
step S240, setting kcount to 0, comparing the current NTP server time with the local time, determining whether an absolute value of a difference between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S250;
step S250, let kcount be kcount +1, determine whether kcount is lower than a preset number N, if yes, go to step S220; if not, the local time is replaced by the current NTP server time.
In a third aspect, a system for implementing timing of a multi NTP server is provided, which includes:
the NTP server list module is used for establishing an NTP server list;
the time synchronization component module is used for selecting an NTP server address from the NTP server list and acquiring NTP server time corresponding to the NTP server address; and
for replacing the local time with NTP server time;
the time synchronization component module selects another NTP server address from the NTP server list to acquire time of another NTP server when the time acquisition of the NTP server is unsuccessful;
the time synchronization component module is used for comparing the current NTP server time with the local time, and replacing the local time with the current NTP server time when the absolute value of the difference value between the current NTP server time and the local time is not higher than a preset value; when the absolute value of the difference between the current NTP server time and the local time is higher than a preset value, the time synchronization component module selects another NTP server address from the NTP server list to acquire another NTP server time.
In a fourth aspect, a computer device is provided, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the multi NTP server timing implementation method when executing the computer program.
In a fifth aspect, a storage medium is provided, which stores a computer program comprising program instructions that, when executed, implement the multi NTP server timing implementation method described above.
In summary, the method and system for implementing timing of multiple NTP servers, the computer device and the storage medium of the present invention acquire NTP server time by setting multiple NTP server addresses, and after failure of acquiring one of the NTP server times, the NTP server time can be acquired according to another NTP server address, and the NTP server time is compared with the local time in a matching manner, so as to finally implement the operation of setting the local time, thereby effectively improving the fault tolerance of the system, enhancing the reliability of time synchronization between the NTP server and the terminal, greatly improving the product quality, effectively reducing the abnormal phenomenon of asynchronous broadcast sound, and improving the stability of the product.
Drawings
Fig. 1 is a schematic flowchart of a first method for timing a multi NTP server according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a second method for timing a multi NTP server according to an embodiment of the present invention;
fig. 3 is a block diagram of a first multi-NTP server timing implementation system according to an embodiment of the present invention;
fig. 4 is a block diagram of a second multi-NTP server timing implementation system according to an embodiment of the present invention;
fig. 5 is a block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
For further understanding of the features and technical means of the present invention, as well as the specific objects and functions attained by the present invention, the present invention will be described in further detail with reference to the accompanying drawings and detailed description.
Fig. 1 is a schematic flow chart of a first method for implementing timing of a multi NTP server according to an embodiment of the present invention, and as shown in fig. 1, the method for implementing timing of a multi NTP server includes steps S110 to S140, which specifically include the following steps:
step S110, establishing an NTP server list; the NTP server list comprises a plurality of NTP server addresses, each NTP server address corresponds to one NTP server, and each NTP server address comprises a domain name address and an IP address.
When the DNS service of a service operator has a problem, the NTP server with the IP address can still normally access; when the IP address of the NTP server is changed, the NTP server with the domain name address can still normally access, and the condition that the NTP server cannot access through the domain name address or the DNS service of a service operator has problems is avoided, so that the utilization efficiency of the NTP server is effectively improved, and the fault tolerance of the system is effectively improved.
Step S120, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address; the multi-NTP server time correction implementation system comprises a time synchronization component module (Ntpdate), wherein the time synchronization component module accesses an NTP server by using an NTP server address and acquires NTP server time so as to conveniently synchronize the NTP server time to each broadcasting terminal, thereby realizing the time synchronization of each broadcasting terminal and further ensuring the consistency of broadcasting sound of each broadcasting terminal.
Step S130, judging whether the time acquisition of the NTP server is successful, if not, switching to step S120 to select another NTP server address from the NTP server list again to acquire the time of another NTP server; if yes, go to step S140; in this embodiment, the terminal may be a broadcast terminal.
If the time synchronization component module cannot access the NTP server through the NTP server address (for example, the NTP server cannot be accessed through the IP address, and meanwhile, the NTP server cannot be accessed through the domain name address due to a problem in the DNS service of a service operator), the time synchronization component module cannot normally acquire the time of the NTP server, and further cannot synchronize the time of the NTP server to each broadcast terminal, so that the time of each broadcast terminal cannot be synchronized; at this time, the time synchronization component module is required to select another NTP server address from the NTP server list again to acquire another NTP server time, so that the reliability is high, and the time correction effect of the broadcast terminal cannot be influenced because some NTP servers cannot access the time.
Step S140, comparing the current NTP server time with the local time, judging whether the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, the procedure goes to step S120 to select another NTP server address from the NTP server list again to obtain another NTP server time; the preset value can be set to be one of values in 5-10 min, or set to be other values according to actual needs, specifically, the preset value is set according to the position of the broadcast terminal, and the current NTP server time is the real-time NTP server time successfully acquired by the time synchronization component module.
Specifically, the current NTP server time is compared with the local time, and if the difference value between the current NTP server time and the local time is not large, the current NTP server time acquired by the time synchronization component module through the NTP server address is considered to be correct, the current NTP server time acquired by the time synchronization component module is set to the terminal, and the local time of the terminal is replaced by the current NTP server time; if the difference value between the time synchronization component module and the NTP server is larger, the time synchronization component module is required to select another NTP server address from the NTP server list again to acquire the time of another NTP server, the fault tolerance is strong, and even if the time of the NTP server is wrong, the time of the broadcast terminal cannot be influenced.
Fig. 2 is a schematic flow chart of a second method for implementing timing of a multi NTP server according to an embodiment of the present invention, and as shown in fig. 2, the method for implementing timing of a multi NTP server includes steps S210 to S250, which are specifically as follows:
step S210, establishing an NTP server list; the NTP server list comprises a plurality of NTP server addresses, each NTP server address corresponds to one NTP server, and each NTP server address comprises a domain name address and an IP address.
When the DNS service of a service operator has a problem, the NTP server with the IP address can still normally access; when the IP address of the NTP server is changed, the NTP server with the domain name address can still normally access, and the condition that the NTP server cannot access through the domain name address or the DNS service of a service operator has problems is avoided, so that the utilization efficiency of the NTP server is effectively improved, and the fault tolerance of the system is effectively improved.
Step S220, selecting an NTP server address from the NTP server list, and acquiring an NTP server time corresponding to the NTP server address.
Step S230, judging whether the time acquisition of the NTP server is successful, if not, switching to step S220; if yes, the process proceeds to step S240.
If the time synchronization component module cannot access the NTP server through the NTP server address, the time synchronization component module cannot normally acquire the time of the NTP server, and further cannot synchronize the time of the NTP server to each broadcast terminal, so that the time of each broadcast terminal cannot be synchronized; at the moment, the time synchronization component module is required to select another NTP server address from the NTP server list again to acquire the time of another NTP server, the reliability is high, and the time correction effect of the broadcast terminal cannot be influenced because some NTP servers cannot access the time;
step S240, setting kcount to be 0, comparing the current NTP server time with the local time, judging whether the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value, if not, replacing the local time with the current NTP server time, namely, setting the current NTP server time to the broadcast terminal; if yes, the process proceeds to step S250.
Step S250, let kcount be kcount +1, determine whether kcount is lower than a preset number N, if yes, go to step S220; if not, replacing the local time with the current NTP server time; wherein N is not less than 2, and N is 3.
Specifically, when the absolute value of the difference between the current NTP server time and the local time is higher than a preset value, adding 1 to the kcount count, that is, kcount ═ kcount + 1; when the absolute value of the difference value between the current NTP server time and the local time is continuously 3 times and is higher than the preset value, namely, kcount is 3, the current NTP server time acquired by the time synchronization component module can be judged to be correct, the local time is incorrect, then the current NTP server time is set for each broadcast terminal, so that the local time of each broadcast terminal is replaced, the consistency of broadcast sound of each broadcast terminal is further ensured, meanwhile, the fault tolerance is strong, and the broadcast terminal time cannot be influenced even if the NTP server time is wrong.
Other technical features of the second multi-NTP server timing implementation method are the same as those of the first multi-NTP server timing implementation method, and need not be described herein again.
Fig. 3 is a block diagram of a first multi-NTP server timing implementation system according to an embodiment of the present invention, and as shown in fig. 3, the system corresponds to the multi-NTP server timing implementation method, and the present invention further provides a multi-NTP server timing implementation system, where the multi-NTP server timing implementation system includes a module for executing the multi-NTP server timing implementation method, and the system may be configured in a terminal such as a computer device, and by applying the multi-NTP server timing implementation system according to the present invention, NTP server times are obtained by setting multiple NTP server addresses, and after failure of obtaining one of the NTP server times, NTP server times may be obtained according to another NTP server address, and in cooperation with comparing the NTP server times with local times, finally, a setting operation of local times is implemented, so as to effectively improve system fault tolerance and enhance reliability of time synchronization between an NTP server and the terminal, the quality of the product is greatly improved, the abnormal phenomenon of asynchronous broadcast sound is effectively reduced, and the stability of the product is improved.
Specifically, as shown in fig. 3, the multi NTP server timing implementation system includes an NTP server list module 110, a time synchronization component module 120, and an analysis and judgment module 130.
An NTP server list module 110, configured to establish an NTP server list;
a time synchronization component module 120, configured to select an NTP server address from the NTP server list, and obtain an NTP server time corresponding to the NTP server address; and
for replacing the local time with NTP server time; wherein, the local time is the real-time terminal time;
an analyzing and judging module 130, configured to judge whether time acquisition of the NTP server is successful, and when time acquisition of the NTP server is unsuccessful, the time synchronization component module 120 selects another NTP server address from the NTP server list to acquire another NTP server time;
and for comparing the current NTP server time with the local time, and when the absolute value of the difference between the current NTP server time and the local time is not higher than a preset value, the time synchronization component module 120 replaces the local time with the current NTP server time; when the absolute value of the difference between the current NTP server time and the local time is higher than the preset value, the time synchronization component module 120 selects another NTP server address from the NTP server list to acquire another NTP server time; wherein, the current NTP server time is the real-time NTP server time successfully acquired by the time synchronization component module 120.
When the DNS service of a service operator has a problem, the NTP server with the IP address can still normally access; when the IP address of the NTP server is changed, the NTP server with the domain name address can still normally access, and the condition that the NTP server cannot access through the domain name address or the DNS service of a service operator has problems is avoided, so that the utilization efficiency of the NTP server is effectively improved, and the fault tolerance of the system is effectively improved.
If the time synchronization component module 120 does not access the NTP server through the NTP server address, the time synchronization component module 120 may not normally obtain the time of the NTP server, and further, the time of the NTP server may not be synchronized to each broadcast terminal, so that the time of each broadcast terminal may not be synchronized; at this time, the time synchronization component module 120 is required to select another NTP server address from the NTP server list again to obtain another NTP server time, so that the reliability is high, and the timing effect of the broadcast terminal cannot be affected when some NTP servers cannot be accessed.
Fig. 4 is a block diagram of a second multi-NTP server timing implementation system according to an embodiment of the present invention. As shown in fig. 4, the timing implementation system for multiple NTP servers provided in this embodiment further includes a counting module 140, configured to set kcount to 0, and add 1 to the kcount count when an absolute value of a difference between the current NTP server time and the local time is higher than a preset value, that is, kcount to kcount + 1.
In one embodiment, the parsing and determining module 130 is further configured to determine whether the kcount is lower than a preset number N, and when the kcount is lower than the preset number N, the time synchronization component module 120 selects another NTP server address from the NTP server list to obtain another NTP server time; when kcount is not less than the preset number N, the time synchronization component module 120 replaces the local time with the current NTP server time.
Specifically, when the absolute value of the difference between the current NTP server time and the local time N consecutive times is higher than the preset value, in this embodiment, N is 3, it may be determined that the current NTP server time obtained by the time synchronization component module 120 is correct, and the local time is incorrect, and then the current NTP server time is set to each broadcast terminal, so as to replace the local time of each broadcast terminal, thereby ensuring the consistency of the broadcast sound of each broadcast terminal, and meanwhile, the fault tolerance is strong, even if the NTP server time has an error, the broadcast terminal time is not affected.
It should be noted that, as can be clearly understood by those skilled in the art, the specific implementation process of the multi NTP server timing implementation system and each module may refer to the corresponding description in the foregoing method embodiment, and for convenience and conciseness of description, no further description is provided herein.
Fig. 5 is a block diagram of an internal structure of a computer device according to an embodiment of the present invention, and as shown in fig. 5, the computer device according to the present invention includes a memory, a processor, and a network interface connected via a system bus, which are connected via the system bus; the memory is stored with a computer program, the processor is used for providing calculation and control capability to support the operation of the whole computer equipment, and the processor realizes the multi-NTP server timing realization method when executing the computer program.
The memory may include a non-volatile storage medium having an operating system stored thereon and an internal memory, and may further have a computer program stored thereon, which, when executed by the processor, may cause the processor to implement the multi-NTP server timing implementation method.
The internal memory may also store a computer program, and when the computer program is executed by the processor, the computer program may enable the processor to execute the multi NTP server timing implementation method. The network interface is for network communication with other computer devices. Those skilled in the art will appreciate that the configuration shown in fig. 5 is a block diagram of only a portion of the configuration associated with the present application and is not intended to limit the applicability of the present application to other computing devices, which may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
In one embodiment, the multi NTP server timing implementation method provided by the present application may be implemented as a computer program, which may be run on a computer device as shown in fig. 5. The memory of the computer device may store various program modules constituting the multi NTP server timing implementation system, such as the NTP server list module 110, the time synchronization component module 120, and the analysis and judgment module 130 shown in fig. 3. The computer program formed by the program modules enables the processor to execute the steps of the multi NTP server timing implementation system of the embodiments of the application described in the specification. For example, the computer device shown in fig. 5 may establish an NTP server list through the NTP server list module 110 in a multi-NTP server timing implementation system as shown in fig. 3; the time synchronization component module 120 selects an NTP server address from the NTP server list to obtain an NTP server time corresponding to the NTP server address; and replacing the local time with NTP server time; the analyzing and judging module 130 judges whether the NTP server time acquisition is successful, and when the NTP server time acquisition is unsuccessful, the time synchronization component module 120 selects another NTP server address from the NTP server list to acquire another NTP server time; comparing the current NTP server time with the local time, and when the absolute value of the difference between the current NTP server time and the local time is not higher than a preset value, replacing the local time with the current NTP server time by the time synchronization component module 120; when the absolute value of the difference between the current NTP server time and the local time is higher than the preset value, the time synchronization component module 120 selects another NTP server address from the NTP server list to obtain another NTP server time.
In one embodiment, a computer device is presented, comprising a memory and a processor, the memory and the processor storing a computer program which, when executed by the processor, causes the processor to perform the steps of: step S110, establishing an NTP server list; step S120, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address; step S130, judging whether the time acquisition of the NTP server is successful, if not, executing step S120; if yes, go to step S140; step S140, comparing the current NTP server time with the local time, judging whether the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S120.
In a further embodiment, a computer device is presented, comprising a memory and a processor, the memory and the processor storing a computer program which, when executed by the processor, causes the processor to perform the steps of: step S210, establishing an NTP server list; step S220, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address; step S230, judging whether the time acquisition of the NTP server is successful, if not, switching to step S220; if yes, go to step S240; step S240, setting kcount to 0, comparing the current NTP server time with the local time, determining whether an absolute value of a difference between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S250; step S250, let kcount be kcount +1, determine whether kcount is lower than a preset number N, if yes, go to step S220; if not, the local time is replaced by the current NTP server time.
It should be understood that in the embodiments of the present Application, the Processor may be a Central Processing Unit (CPU), and the Processor may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It will be understood by those skilled in the art that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware. The computer program includes program instructions, and the computer program may be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program comprises program instructions. The program instructions, when executed by the processor, cause the processor to perform the steps of: step S110, establishing an NTP server list; step S120, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address; step S130, judging whether the time acquisition of the NTP server is successful, if not, executing step S120; if yes, go to step S140; step S140, comparing the current NTP server time with the local time, judging whether the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S120.
In other embodiments, the storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program comprises program instructions. The program instructions, when executed by the processor, cause the processor to perform the steps of: step S210, establishing an NTP server list; step S220, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address; step S230, judging whether the time acquisition of the NTP server is successful, if not, switching to step S220; if yes, go to step S240; step S240, setting kcount to 0, comparing the current NTP server time with the local time, determining whether an absolute value of a difference between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S250; step S250, let kcount be kcount +1, determine whether kcount is lower than a preset number N, if yes, go to step S220; if not, the local time is replaced by the current NTP server time.
The storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, or an optical disk, which can store various computer readable storage media.
In summary, the method and system for implementing timing of multiple NTP servers, the computer device and the storage medium of the present invention acquire NTP server time by setting multiple NTP server addresses, and after the time acquisition of one of the NTP servers fails, the NTP server time can be acquired according to another NTP server address, and the NTP server time is compared with the local time, so as to finally implement the operation of setting the local time, thereby effectively improving the fault tolerance of the system, enhancing the reliability of time synchronization between the NTP server and the terminal, greatly improving the quality of the product, effectively reducing the abnormal phenomenon of asynchronous broadcast sound, and improving the stability of the product.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed system and method can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, various elements or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be merged, divided and deleted according to actual needs. In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing an apparatus (which may be a personal computer, a terminal, or a network computer device) to execute all or part of the steps of the method according to the embodiments of the present invention.
The above examples are merely illustrative of several embodiments of the present invention, and the description thereof is more specific and detailed, but not to be construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present invention should be subject to the appended claims.

Claims (10)

1. A multi-NTP server timing implementation method is characterized by comprising the following steps:
step S110, establishing an NTP server list;
step S120, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address;
step S130, judging whether the time acquisition of the NTP server is successful, if not, executing step S120; if yes, go to step S140;
step S140, comparing the current NTP server time with the local time, judging whether the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S120.
2. The multi-NTP server timing implementation method according to claim 1, characterized in that: the NTP server list comprises a plurality of NTP server addresses, each NTP server address corresponds to one NTP server, and each NTP server address comprises a domain name address and an IP address.
3. A multi-NTP server timing implementation method is characterized by comprising the following steps:
step S210, establishing an NTP server list;
step S220, selecting an NTP server address from the NTP server list, and acquiring NTP server time corresponding to the NTP server address;
step S230, judging whether the time acquisition of the NTP server is successful, if not, switching to step S220; if yes, go to step S240;
step S240, setting kcount to 0, comparing the current NTP server time with the local time, determining whether an absolute value of a difference between the current NTP server time and the local time is higher than a preset value, and if not, replacing the local time with the current NTP server time; if yes, go to step S250;
step S250, let kcount be kcount +1, determine whether kcount is lower than a preset number N, if yes, go to step S220; if not, the local time is replaced by the current NTP server time.
4. The multi-NTP server timing implementation method according to claim 3, characterized in that: the NTP server list comprises a plurality of NTP server addresses, each NTP server address corresponds to one NTP server, and each NTP server address comprises a domain name address and an IP address.
5. The multi-NTP server timing implementation method according to claim 3, characterized in that: and the preset number of times N is 3.
6. A time correction implementation system for a multi-NTP server is characterized by comprising:
the NTP server list module is used for establishing an NTP server list;
the time synchronization component module is used for selecting an NTP server address from the NTP server list and acquiring NTP server time corresponding to the NTP server address; and
for replacing the local time with NTP server time;
the time synchronization component module selects another NTP server address from the NTP server list to acquire time of another NTP server when the time acquisition of the NTP server is unsuccessful;
the time synchronization component module is used for comparing the current NTP server time with the local time, and replacing the local time with the current NTP server time when the absolute value of the difference value between the current NTP server time and the local time is not higher than a preset value; when the absolute value of the difference between the current NTP server time and the local time is higher than a preset value, the time synchronization component module selects another NTP server address from the NTP server list to acquire another NTP server time.
7. The multi-NTP server timing implementation system according to claim 6, characterized in that: the network node further comprises a counting module, wherein the counting module is used for setting the kcount to be 0, and when the absolute value of the difference value between the current NTP server time and the local time is higher than a preset value, the kcount is added by 1.
8. The multi-NTP server timing implementation system according to claim 7, characterized in that: the analysis judging module is further used for judging whether the kcount is lower than a preset number N, and when the kcount is lower than the preset number N, the time synchronization component module selects another NTP server address from the NTP server list to acquire another NTP server time; when kcount is not less than a preset number N, the time synchronization component module replaces the local time with the current NTP server time.
9. A computer device, characterized by: the computer device comprises a memory having stored thereon a computer program and a processor implementing the multi NTP server timing implementation method according to any one of claims 1-5 when executing the computer program.
10. A storage medium, characterized by: the storage medium stores a computer program comprising program instructions which, when executed, implement a multi NTP server timing implementation method according to any one of claims 1-5.
CN202111271321.1A 2021-10-29 2021-10-29 Multi-NTP server timing realization method and system, computer equipment and storage medium Active CN113992295B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111271321.1A CN113992295B (en) 2021-10-29 2021-10-29 Multi-NTP server timing realization method and system, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111271321.1A CN113992295B (en) 2021-10-29 2021-10-29 Multi-NTP server timing realization method and system, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113992295A true CN113992295A (en) 2022-01-28
CN113992295B CN113992295B (en) 2024-04-02

Family

ID=79744324

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111271321.1A Active CN113992295B (en) 2021-10-29 2021-10-29 Multi-NTP server timing realization method and system, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113992295B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050177591A1 (en) * 2004-02-06 2005-08-11 Akitsugu Kanda Storage system for managing data with predetermined retention periods
JP2007124029A (en) * 2005-10-25 2007-05-17 Nippon Telegr & Teleph Corp <Ntt> Time synchronization information or synchronizing clock generating supply method and apparatus
JP2010231310A (en) * 2009-03-26 2010-10-14 Nec Corp Time correction device, time correction system, time correction method, and program
CN105159728A (en) * 2015-09-25 2015-12-16 青岛海信宽带多媒体技术有限公司 Method and device for obtaining NTP time information based on android system
CN106993028A (en) * 2017-03-20 2017-07-28 山东浪潮商用系统有限公司 Network time acquisition methods, apparatus and system, computer-readable recording medium and storage control
CN108234057A (en) * 2018-01-24 2018-06-29 郑州云海信息技术有限公司 Method for synchronizing time, device and the storage medium of server based on BMC
CN109039518A (en) * 2018-08-21 2018-12-18 四川长虹电器股份有限公司 The ntp server address intelligent management of Android television system
CN110119335A (en) * 2019-03-27 2019-08-13 平安科技(深圳)有限公司 Server NTP process monitoring method, electronic device and storage medium
CN112751642A (en) * 2021-01-12 2021-05-04 北京云泰数通互联网科技有限公司 Clock synchronization method and device and electronic equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050177591A1 (en) * 2004-02-06 2005-08-11 Akitsugu Kanda Storage system for managing data with predetermined retention periods
JP2007124029A (en) * 2005-10-25 2007-05-17 Nippon Telegr & Teleph Corp <Ntt> Time synchronization information or synchronizing clock generating supply method and apparatus
JP2010231310A (en) * 2009-03-26 2010-10-14 Nec Corp Time correction device, time correction system, time correction method, and program
CN105159728A (en) * 2015-09-25 2015-12-16 青岛海信宽带多媒体技术有限公司 Method and device for obtaining NTP time information based on android system
CN106993028A (en) * 2017-03-20 2017-07-28 山东浪潮商用系统有限公司 Network time acquisition methods, apparatus and system, computer-readable recording medium and storage control
CN108234057A (en) * 2018-01-24 2018-06-29 郑州云海信息技术有限公司 Method for synchronizing time, device and the storage medium of server based on BMC
CN109039518A (en) * 2018-08-21 2018-12-18 四川长虹电器股份有限公司 The ntp server address intelligent management of Android television system
CN110119335A (en) * 2019-03-27 2019-08-13 平安科技(深圳)有限公司 Server NTP process monitoring method, electronic device and storage medium
CN112751642A (en) * 2021-01-12 2021-05-04 北京云泰数通互联网科技有限公司 Clock synchronization method and device and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
何承恩,王忠,岳佳欣: "《基于NTP的跨平台网络时间同步模块设计》", 《计算机仿真》, vol. 37, no. 11, 28 December 2020 (2020-12-28) *
侯炎坤: "《基于卫星授时的NTP网络时钟同步系统的研究》", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 16 May 2021 (2021-05-16) *

Also Published As

Publication number Publication date
CN113992295B (en) 2024-04-02

Similar Documents

Publication Publication Date Title
EP3664372A1 (en) Network management method and related device
CN110377431B (en) Service calling method and device under multi-registry scene
CN109586969A (en) Content distributing network disaster recovery method, device, computer equipment and storage medium
CN112152828A (en) Game acceleration method and device, VPN terminal and storage medium
CN111064821A (en) Method and device for determining IP address of edge node
CN113179295B (en) Message processing method and device
CN113992295B (en) Multi-NTP server timing realization method and system, computer equipment and storage medium
CN112583946A (en) Domain name management method, domain name resolution method and device
CN114745413B (en) Access control method and device for server, computer equipment and storage medium
CN115023929A (en) Data synchronization method, device, system, electronic equipment and storage medium
CN108900422B (en) Multicast forwarding method and device and electronic equipment
CN110851166A (en) User-unaware application program updating method and device and computer equipment
CN114124901B (en) Pod structure modification method, device, computer equipment and storage medium
CN112866750B (en) Video data processing method, video playing method and related equipment
CN110474807B (en) Log processing method and device
CN112532436A (en) Block chain link point state conversion method and block chain system
CN112295216A (en) Player delay disconnection analysis method, system, electronic device and storage medium
CN114143127B (en) Data broadcasting method and device and electronic equipment
CN111400095A (en) Cluster and method, system and medium for restarting cluster in abnormal outage
CN114531322B (en) Method, system, device and medium for synchronizing multi-gateway data of Internet of things
CN112134955B (en) Data processing system, data processing method, data processing device, and storage medium
CN107547447B (en) Network communication method and device of distributed file system and network communication system
CN116743398A (en) Cluster access method and device, storage medium and electronic equipment
US20240106793A1 (en) Traffic scheduling method, apparatus and system, terminal device and readable storage medium
CN113810775B (en) Voice and video connection system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant