CN104993920A - SNTP-based synchronization time method and SNTP client - Google Patents

SNTP-based synchronization time method and SNTP client Download PDF

Info

Publication number
CN104993920A
CN104993920A CN201510388851.2A CN201510388851A CN104993920A CN 104993920 A CN104993920 A CN 104993920A CN 201510388851 A CN201510388851 A CN 201510388851A CN 104993920 A CN104993920 A CN 104993920A
Authority
CN
China
Prior art keywords
sntp
time
lock
timer
electronic equipment
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
CN201510388851.2A
Other languages
Chinese (zh)
Other versions
CN104993920B (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.)
Huzhou YingLie Intellectual Property Operation Co.,Ltd.
Original Assignee
Shanghai Feixun Data Communication Technology 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 Shanghai Feixun Data Communication Technology Co Ltd filed Critical Shanghai Feixun Data Communication Technology Co Ltd
Priority to CN201510388851.2A priority Critical patent/CN104993920B/en
Publication of CN104993920A publication Critical patent/CN104993920A/en
Application granted granted Critical
Publication of CN104993920B publication Critical patent/CN104993920B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides an SNTP-based synchronization time method and an SNTP client. The method comprises the steps as follows: recording current time of electronic equipment and marking the current time as first time; adding a starting SNTP timer in the SNTP client; starting an SNTP synchronizing process and adding a detection SNTP timer with the SNTP client while the starting SNTP timer reaches to timing time; starting to detecting SNTP synchronization time while the detection SNTP timer reaches to the timing time and recording the current time of the electronic equipment and marking the current time as second time while obtaining the SNTP synchronization time; synchronizing the obtained SNTP synchronization time to the electronic equipment, and simultaneously setting the timing time of the starting SNTP timer as difference value of the second time and the first time. By using the timer to regularly update the time, the SNTP-based synchronization time method and the SNTP client are excellent in synchronization time effect, and differentiate to treat clock difference of the equipment to effectively reduce consumption of system resources.

Description

A kind of method and SNTP client lock in time based on SNTP
Technical field
The present invention relates to technical field lock in time, be specially a kind of method and SNTP client lock in time based on SNTP.
Background technology
In some specific scenes, the computer in whole network is often needed to keep lock in time.Such as, the time of the computer in air control system or rail traffic control system needs to keep precise synchronization.In large computer system, often jointly perform certain by a lot of platform computer and calculate, also need each computer to keep lock in time.So, do we carry out the time of these computers synchronous by what method?
Scientist has invented a kind of NTP (Network Time Protocol) being called NTP.NTP (Network Time Protocol) be a kind of time of synchronous computer on a network computer agreement, it have height accuracy (can a few tens of milliseconds be accurate to), but algorithm is very complicated.In fact, in a lot of application scenarios, do not need so high accuracy, as long as the accuracy usually reaching level second is just enough.So scientist is proposed SNTP (SNTP, Simple Network TimeProtocol) on the basis of NTP.SNTP enormously simplify Network Time Protocol, also can ensure the accuracy that the time reaches certain simultaneously.In actual applications, SNTP agreement is mainly used to the time of computer on synchronous internet.
SNTP agreement adopts the working method of client/server, can adopt clean culture (point-to-point) or the operation of broadcast (point to multi--point) pattern.SNTP server is by receiving gps signal or the atomic clock that the carries time reference as system.Under unicast mode, SNTP client can obtain correct time information by regular visit SNTP server, for adjusting the time of client self place system, reaches the object of lock in time.Under broadcast mode, SNTP server periodically sends message to the IP broadcast address of specifying or ip multicast address.SNTP client obtains temporal information by monitoring these addresses.
Generally there is a lot of platform SNTP server in network, a few station server that client can be best by certain algorithms selection uses.If a SNTP server loses external time source in the course of the work, now SNTP server can tell SNTP client " I loses external time ".When SNTP client receives this information, the temporal information that the SNTP server broken down issues it will be abandoned, then reselect other SNTP server.
Now each electronic equipment all can design a RTC module, be used for the holding time.As time goes on can there is deviation with the standard time in every platform, just need this time to send data to SNTP server.Be synchronized to the standard time, to reduce error.SNTP client is when lock in time, and use start to upgrade, start shooting for a long time, the time can not be effectively synchronous.Use timing to upgrade, definition time is too short, loss system resource, and definition time is oversize can not effective update time.SLEEP is used to wait for, holding time sheet, loss system resource.
Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of method and SNTP client lock in time based on SNTP, and for solving, the synchronous effect existed when lock in time in prior art is poor, the problem of consume system resource.
For achieving the above object and other relevant objects, the invention provides a kind of method lock in time based on SNTP, be applied to electronic equipment by the SNTP client installed in electronic equipment in the process of SNTP server sync time providing fiducial time, described method lock in time based on SNTP comprises: S1, records the current time of described electronic equipment and is labeled as the very first time; S2, adds the startup SNTP timer for starting SNTP service in described SNTP client; S3, when described startup SNTP timer arrives timing, described SNTP client terminal start-up SNTP synchronizing process is also added for starting the detection SNTP timer detecting SNTP lock in time; S4, when described detection SNTP timer arrives timing, starts to detect SNTP lock in time and when getting SNTP lock in time, recording the current time of described electronic equipment and being labeled as the second time; S5, is synchronized in described electronic equipment by the SNTP of acquisition lock in time, the timing of described startup SNTP timer is set to the difference of described second time and the very first time simultaneously, and the value of the described very first time is updated to described SNTP lock in time.
Preferably, in step sl, start at described electronic equipment or when being configured with amendment, recording the current time of described electronic equipment and be labeled as the very first time.
Preferably, in step s 4 which, when described detection SNTP timer arrives timing, after starting to detect SNTP lock in time, also comprise and judge whether to get SNTP lock in time, if when not getting SNTP lock in time, be back to step S2.
Preferably, in step s 4 which, when described detection SNTP timer arrives timing, start to detect SNTP lock in time and also comprise when getting SNTP lock in time: judging whether the time difference absolute value between described SNTP lock in time and described second time is greater than Preset Time difference, if, then then perform step S5, if not, be then back to step S2.
Preferably, the span of described Preset Time difference is 0.1s ~ 10s.
For achieving the above object, the present invention also provides a kind of SNTP client, be installed in described electronic equipment, be applied to electronic equipment in the process of SNTP server sync time providing fiducial time, described SNTP client comprises: time synchronized module, be connected, to the described SNTP server sync time with providing fiducial time SNTP server; Time logging modle, is connected with described time synchronized module, is configured in described SNTP client, records the current time of described electronic equipment and be labeled as the very first time; Timer adds module, comprise: start SNTP timer adding device, be connected with described time logging modle with described time synchronized module, starting SNTP timer for adding, making when described startup SNTP timer arrives timing described time synchronized module start SNTP synchronizing process; Detect SNTP timer adding device, be connected with described time synchronized module, SNTP timer is detected for adding when described time synchronized module starts SNTP synchronizing process, when described detection SNTP timer arrives timing, described time synchronized module is made to start to detect SNTP lock in time; When described time synchronized module gets SNTP lock in time, the current time of electronic equipment described in described logging modle record was also labeled as the second time; The SNTP of acquisition is synchronized in described electronic equipment lock in time by described time synchronized module, simultaneously in described startup SNTP timer adding device, add described startup SNTP timer and the timing of described startup SNTP timer is set to the difference when described second time and the very first time, and the value of the described very first time being updated to described SNTP lock in time.
Preferably, to start or when being configured with amendment at described electronic equipment, the current time of electronic equipment described in described logging modle record is also labeled as the very first time.
Preferably, described SNTP client also comprises: judge module, is configured in described SNTP client, and described judge module is for judging whether described time synchronized module gets SNTP lock in time; When described time synchronized module does not get SNTP lock in time, in described startup SNTP timer adding device, again add described startup SNTP timer.
Preferably, when described time synchronized module gets SNTP lock in time, described judge module is also for judging whether the time difference absolute value between described SNTP lock in time and described second time is greater than Preset Time difference, if, then the SNTP of acquisition is synchronized in described electronic equipment lock in time by described SNTP client, then in described startup SNTP timer adding device, again adds described startup SNTP timer if not.
Preferably, the span of described Preset Time difference is 0.1s ~ 10s.
As mentioned above, a kind of method and SNTP client lock in time based on SNTP of the present invention, has following beneficial effect:
The present invention use timer timing update time, lock in time is effective, and the sync interval of each electronic equipment is set, distinguish the timing differential treating every platform equipment, the synchronous stand-by period can according to the time difference of the walking about automatic update time of every platform electronic equipment, effective minimizing consume system resource, and can ensure that error is less than preset value, make lock in time more flexible, reliable and stable.
Accompanying drawing explanation
Fig. 1 be shown as of the present invention based on SNTP lock in time method schematic flow sheet.
Fig. 2 be shown as of the present invention based on SNTP lock in time method a kind of preferred flow schematic diagram.
Fig. 3 be shown as of the present invention based on SNTP lock in time method implementing procedure schematic diagram.
Fig. 4 is shown as the structural representation of SNTP client of the present invention.
Element numbers explanation
1 SNTP client
11 time synchronized modules
12 time logging modles
13 timers add module
131 start SNTP timer adding device
132 detect SNTP timer adding device
14 judge modules
S1 ~ S5 step
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this specification can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this specification also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.
The object of the present embodiment is to provide a kind of method and SNTP client lock in time based on SNTP, for solving the following problem existed when lock in time in prior art: 1) only when starting shooting synchronous once; 2) a part of system resource of the many consumption of Timing Synchronization and Internet resources; 3) sleep pause method holding time sheet; 4) error time of every platform equipment is different.The present embodiment provide based on SNTP lock in time method and SNTP client can be used for perfect solving lock in time, device synchronization interval, distinguish the difference treating every platform equipment.
A kind of method and the principle of SNTP client and execution mode lock in time based on SNTP will elaborating the present embodiment below, makes those skilled in the art not need creative work can understand a kind of method and SNTP client lock in time based on SNTP in the present embodiment.
The present embodiment provides a kind of method lock in time based on SNTP, be applied to electronic equipment by the SNTP client installed in electronic equipment in the process of SNTP server sync time providing fiducial time, wherein, described electronic equipment be a kind of can according in advance setting or the instruction stored, automatically numerical computations and information processing is carried out, and there is the electronic equipment of multimedia video function, include but not limited to switch, computer, smart mobile phone etc.Described SNTP server comprises primary time server and multiple standby time server, SNTP client can a time server acquisition time wherein, wherein, the time server in any one SNTP server all presets time zone, or local time zone or specify ground time zone.
Particularly, in the present embodiment, as shown in Figure 1, described method lock in time based on SNTP comprises the following steps.
Step S1, records the current time of described electronic equipment and is labeled as the very first time, in the present embodiment, records the current time of described electronic equipment, is labeled as very first time CT1; Particularly, in step sl, start at described electronic equipment or when being configured with amendment, recording the current time of described electronic equipment, be labeled as very first time CT1.
Step S2, adds the startup SNTP timer for starting SNTP service in described SNTP client.Use timer timing update time, lock in time is effective.Wherein, in the present embodiment, should be taken into account the configuration of SNTP server, that is need to determine whether to add according to the configuration of SNTP server to start SNTP timer.Described SNTP client is owing to can be connected with multiple SNTP server, fiducial time is obtained from SNTP server, if but some in particular cases, the SNTP server of current described SNTP client's side link has no time server configuration, then now without the need to adding the startup SNTP timer for starting SNTP service, if add, the startup SNTP timer for starting SNTP service should be deleted.If the free server configuration of the SNTP server of current described SNTP client's side link, then adding the startup SNTP timer for starting SNTP service, after having added the startup SNTP timer for starting SNTP service, then performing step S3.
In step s3, when described startup SNTP timer arrives timing, described SNTP client terminal start-up SNTP synchronizing process is also added for starting the detection SNTP timer detecting SNTP lock in time.Wherein, the timing of described startup SNTP timer can self-definedly be arranged, and the selection range of the timing of described startup SNTP timer was such as, but be not limited to 0.5 hour ~ 6 hours.Although when described startup SNTP timer arrives timing, described SNTP client terminal start-up SNTP synchronizing process, namely described SNTP client obtains fiducial time to described SNTP server transmitting time synchronization request, but may exist described SNTP client terminal start-up SNTP synchronizing process not do not feed back immediately or feedback time long, so need to arrange one to detect SNTP timer, the selection range of the timing of described detection SNTP timer was such as, but be not limited to 1 minute ~ 30 minutes.Go to detect whether get required lock in time from described SNTP server again through timing after a while.After the good described detection SNTP timer of interpolation, then perform step S4.
In step s 4 which, when described detection SNTP timer arrives timing, start to detect SNTP lock in time and when getting SNTP lock in time, recording the current time of described electronic equipment and being labeled as the second time, being labeled as the second time CT2 in the present embodiment.
Particularly, as shown in Figure 2, in the specific implementation in step s 4 which, following particular content is also comprised.
In step s 4 which, when described detection SNTP timer arrives timing, after starting to detect SNTP lock in time, also comprise and judge whether to get SNTP lock in time, if when not getting SNTP lock in time, be back to step S2.
In step s 4 which, when described detection SNTP timer arrives timing, start to detect SNTP lock in time and also comprise when getting SNTP lock in time: judging whether the time difference absolute value between described SNTP lock in time and described second time (CT2) is greater than Preset Time difference, if, then then perform step S5, if not, then step S2 is back to.
Wherein, in the present embodiment, described Preset Time difference is the deviation for weighing between Perfect Time that electronic equipment current time and SNTP server provide, if deviation is very little, then think that electronic equipment current time is relatively more accurate, without the need to update time, if deviation is large, then think that electronic equipment current time differs too much with Perfect Time, need synchronized update.Wherein, the span of described Preset Time difference is 0.1s ~ 10s, and such as described Preset Time difference is taken as 1s.Time difference absolute value between described SNTP lock in time and described current time (the second time CT2) is greater than 1s, then think that electronic equipment current time is inaccurate, need synchronized update, time difference between described SNTP lock in time and described current time (the second time CT2) is absolutely not greater than 1s, then think that electronic equipment current time is accurate, without the need to synchronized update.
In step s 5, the SNTP of acquisition is synchronized in described electronic equipment lock in time, the timing of described startup SNTP timer is set to the difference of the second time and the very first time, i.e. CT1-CT2 simultaneously, and the value of the described very first time is updated to the value of described SNTP lock in time.
By the timing of described startup SNTP timer being set to the difference of the second time and the very first time, the sync interval of each electronic equipment is set, distinguish the timing differential treating every platform equipment, the synchronous stand-by period according to the time difference of the walking about automatic update time of every platform electronic equipment, can effectively reduce consume system resource.
For making those skilled in the art understand method lock in time based on SNTP in the present embodiment further, please refer to Fig. 3, the present embodiment by further illustrate based on SNTP lock in time method implementation process.
First in described electronic equipment startup or when being configured with amendment, described SNTP client terminal start-up, the current time of recorded electronic equipment is also labeled as very first time CT1, then the configuration of SNTP server is checked, SNTP server have no time server configuration, then now without the need to adding the startup SNTP timer for starting SNTP service, if add, the startup SNTP timer for starting SNTP service should be deleted.If the free server configuration of the SNTP server of current described SNTP client's side link, then add the startup SNTP timer for starting SNTP service, when described startup SNTP timer arrives timing, then described SNTP client terminal start-up SNTP synchronizing process adds the detection SNTP timer for starting to detect SNTP lock in time.When described detection SNTP timer arrives timing, start to detect SNTP lock in time, if when not getting SNTP lock in time, return and again add one and start SNTP timer.If when getting SNTP lock in time, the current time of recorded electronic equipment is also labeled as the second time CT2, then continue to judge whether the time difference absolute value between described SNTP lock in time and described second time is greater than Preset Time difference (T in Fig. 3), if, the SNTP of acquisition is synchronized in described electronic equipment lock in time, the timing of described startup SNTP timer is set to the difference of the second time and the very first time simultaneously, and the value of the described very first time is updated to described SNTP lock in time, if not, then return and again add a startup SNTP timer.
For achieving the above object, the present embodiment also provides a kind of SNTP client, be installed in described electronic equipment, be applied to electronic equipment in the process of SNTP server sync time providing fiducial time, wherein, described electronic equipment is a kind ofly according in advance setting or the instruction stored, automatically can carry out numerical computations and information processing, and there is the electronic equipment of multimedia video function, include but not limited to switch, computer, smart mobile phone etc.Described SNTP server comprises primary time server and multiple standby time server, SNTP client can a time server acquisition time wherein, wherein, the time server in any one SNTP server all presets time zone, or local time zone or specify ground time zone.
Particularly, in the present embodiment, as shown in Figure 4, SNTP client 1 comprises: time synchronized module 11, time logging modle 12, timer add module 13 and judge module 14.
Time synchronized module 11 is connected, to the described SNTP server sync time with providing fiducial time SNTP server.
Time logging modle 12 is connected with described time synchronized module 11, is configured in described SNTP client 1, records the current time of described electronic equipment and be labeled as the very first time.Particularly, in the present embodiment, to start or when being configured with amendment at described electronic equipment, the current time of electronic equipment described in described logging modle record is also labeled as very first time CT1.
Timer adds module 13 and comprises: start SNTP timer adding device 131 and detect SNTP timer adding device 132.
Start SNTP timer adding device 131 to be connected with described time logging modle 12 with described time synchronized module 11, starting SNTP timer for adding, making described time synchronized module 11 start SNTP synchronizing process when described startup SNTP timer arrives timing.
Use in the SNTP client 1 of the present embodiment timer timing update time, lock in time is effective.Wherein, in the present embodiment, should be taken into account the configuration of SNTP server, that is need to determine whether to add according to the configuration of SNTP server to start SNTP timer.Described SNTP client 1 is owing to can be connected with multiple SNTP server, fiducial time is obtained from SNTP server, if but some in particular cases, the SNTP server that current described SNTP client 1 connects has no time server configuration, then now starting without the need to adding the startup SNTP timer for starting SNTP service in SNTP timer adding device 131, if add in startup SNTP timer adding device 131, the startup SNTP timer for starting SNTP service should being deleted.If the free server configuration of the SNTP server that current described SNTP client 1 connects, then starting in SNTP timer adding device 131 the startup SNTP timer added for starting SNTP service.
When described startup SNTP timer arrives timing, described SNTP client 1 starts SNTP synchronizing process and adds the detection SNTP timer for starting to detect SNTP lock in time.Wherein, the timing of described startup SNTP timer can self-definedly be arranged, and the selection range of the timing of described startup SNTP timer was such as, but be not limited to 0.5 hour ~ 6 hours.
Detect SNTP timer adding device 132 to be connected with described time synchronized module 11, SNTP timer is detected for adding when described time synchronized module 11 starts SNTP synchronizing process, when described detection SNTP timer arrives timing, described time synchronized module 11 is made to start to detect SNTP lock in time.Although when described startup SNTP timer arrives timing, described SNTP client 1 starts SNTP synchronizing process, namely described SNTP client 1 obtains fiducial time to described SNTP server transmitting time synchronization request, but may exist described SNTP client 1 start SNTP synchronizing process not do not feed back immediately or feedback time long, so need interpolation one to detect SNTP timer, the selection range of the timing of described detection SNTP timer was such as, but be not limited to 1 minute ~ 30 minutes.
Judge module 14 is configured in described SNTP client 1, first for judging whether described time synchronized module 11 gets SNTP lock in time, if when described time synchronized module 11 does not get SNTP lock in time, again add described startup SNTP timer in described startup SNTP timer adding device 131.
When described time synchronized module 11 gets SNTP lock in time, the current time of electronic equipment described in described logging modle record is also labeled as the second time (CT2).If described time synchronized module 11 gets SNTP lock in time, then for continuing, described judge module 14 also judges whether the time difference absolute value between described SNTP lock in time and described second time is greater than Preset Time difference, if, then the SNTP of acquisition is synchronized in described electronic equipment lock in time by described SNTP client 1, then in described startup SNTP timer adding device 131, again adds described startup SNTP timer if not.
Be synchronized to after in described electronic equipment lock in time at the SNTP of described time synchronized module 11 by acquisition, in described startup SNTP timer adding device 131, add described startup SNTP timer and the timing of described startup SNTP timer is set to the difference of the second time and the very first time, and the value of the described very first time being updated to described SNTP lock in time.
Wherein, in the present embodiment, described Preset Time difference is the deviation for weighing between Perfect Time that electronic equipment current time and SNTP server provide, if deviation is very little, then think that electronic equipment current time is relatively more accurate, without the need to update time, if deviation is large, then think that electronic equipment current time differs too much with Perfect Time, need synchronized update.Wherein, the span of described Preset Time difference is 0.1s ~ 10s, and such as described Preset Time difference is taken as 1s.Time difference absolute value between described SNTP lock in time and described second time is greater than 1s, then think that electronic equipment current time is inaccurate, need synchronized update, time difference between described SNTP lock in time and described second time is absolutely not greater than 1s, then think that electronic equipment current time is accurate, without the need to synchronized update.
For making those skilled in the art understand SNTP client 1 in the present embodiment further, the present embodiment will further illustrate the course of work of SNTP client 1.
First in described electronic equipment startup or when being configured with amendment, described SNTP client 1 starts, recorded electronic equipment current time, be labeled as very first time CT1, then the configuration of SNTP server is checked, SNTP server has no time server configuration, then now timer adds without the need to adding the startup SNTP timer for starting SNTP service in module 13, if add, should delete the startup SNTP timer for starting SNTP service.If the free server configuration of the SNTP server that current described SNTP client 1 connects, then add module 13 at timer and add the startup SNTP timer of serving for starting SNTP, when described startup SNTP timer arrives timing, described time synchronized module 11 starts SNTP synchronizing process, and then timer interpolation module 13 adds the detection SNTP timer for starting to detect SNTP lock in time.When described detection SNTP timer arrives timing, start to detect SNTP lock in time, judge whether to get SNTP lock in time by judge module 14, if when not getting SNTP lock in time, return and again add one and start SNTP timer.If when getting SNTP lock in time, obtain the current time of electronic equipment and be labeled as the second time CT2, and continue to judge whether the time difference absolute value between described SNTP lock in time and described second time is greater than Preset Time difference by judge module 14, if, the SNTP of acquisition is synchronized in described electronic equipment lock in time, the timing of described startup SNTP timer is set to the difference of the second time and the very first time simultaneously, and the value of the described very first time is updated to the value of described SNTP lock in time.If not, then return and again add a startup SNTP timer.
In sum, the present invention use timer timing update time, lock in time is effective, and the sync interval of each electronic equipment is set, distinguish the timing differential treating every platform equipment, the synchronous stand-by period according to the time difference of the walking about automatic update time of every platform electronic equipment, can effectively reduce consume system resource, and can ensure that error is less than preset value, make lock in time more flexible, reliable and stable.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.

Claims (10)

1. method lock in time based on SNTP, be applied to electronic equipment by the SNTP client installed in electronic equipment in the process of SNTP server sync time providing fiducial time, it is characterized in that: described method lock in time based on SNTP comprises:
S1, records the current time of described electronic equipment and is labeled as the very first time;
S2, adds the startup SNTP timer for starting SNTP service in described SNTP client;
S3, when described startup SNTP timer arrives timing, described SNTP client terminal start-up SNTP synchronizing process is also added for starting the detection SNTP timer detecting SNTP lock in time;
S4, when described detection SNTP timer arrives timing, starts to detect SNTP lock in time and when getting SNTP lock in time, recording the current time of described electronic equipment and being labeled as the second time;
S5, is synchronized in described electronic equipment by the SNTP of acquisition lock in time, the timing of described startup SNTP timer is set to the difference of described second time and the very first time simultaneously, and the value of the described very first time is updated to described SNTP lock in time.
2. method lock in time based on SNTP according to claim 1, is characterized in that: in step sl, starts or when being configured with amendment, recording the current time of described electronic equipment and be labeled as the very first time at described electronic equipment.
3. method lock in time based on SNTP according to claim 1, it is characterized in that: in step s 4 which, when described detection SNTP timer arrives timing, after starting to detect SNTP lock in time, also comprise and judge whether to get SNTP lock in time, if when not getting SNTP lock in time, be back to step S2.
4. method lock in time based on SNTP according to claim 3, it is characterized in that: in step s 4 which, when described detection SNTP timer arrives timing, start to detect SNTP lock in time and also comprise when getting SNTP lock in time: judging whether the time difference absolute value between described SNTP lock in time and described second time is greater than Preset Time difference, if, then then perform step S5, if not, be then back to step S2.
5. method lock in time based on SNTP according to claim 4, is characterized in that: the span of described Preset Time difference is 0.1s ~ 10s.
6. a SNTP client, is installed in described electronic equipment, is applied to electronic equipment in the process of SNTP server sync time providing fiducial time, it is characterized in that: described SNTP client comprises:
Time synchronized module, is connected, to the described SNTP server sync time with providing fiducial time SNTP server;
Time logging modle, is connected with described time synchronized module, is configured in described SNTP client, records the current time of described electronic equipment and be labeled as the very first time;
Timer adds module, comprising:
Starting SNTP timer adding device, be connected with described time logging modle with described time synchronized module, starting SNTP timer for adding, make when described startup SNTP timer arrives timing described time synchronized module start SNTP synchronizing process;
Detect SNTP timer adding device, be connected with described time synchronized module, SNTP timer is detected for adding when described time synchronized module starts SNTP synchronizing process, when described detection SNTP timer arrives timing, described time synchronized module is made to start to detect SNTP lock in time;
When described time synchronized module gets SNTP lock in time, the current time of electronic equipment described in described logging modle record was also labeled as the second time; The SNTP of acquisition is synchronized in described electronic equipment lock in time by described time synchronized module, simultaneously in described startup SNTP timer adding device, add described startup SNTP timer and the timing of described startup SNTP timer is set to the difference when described second time and the very first time, and the value of the described very first time being updated to described SNTP lock in time.
7. system lock in time based on SNTP according to claim 6, is characterized in that: to start or when being configured with amendment at described electronic equipment, and the current time of electronic equipment described in described logging modle record is also labeled as the very first time.
8. system lock in time based on SNTP according to claim 6, is characterized in that: described SNTP client also comprises:
Judge module, is configured in described SNTP client, and described judge module is for judging whether described time synchronized module gets SNTP lock in time; When described time synchronized module does not get SNTP lock in time, in described startup SNTP timer adding device, again add described startup SNTP timer.
9. system lock in time based on SNTP according to claim 8, it is characterized in that: when described time synchronized module gets SNTP lock in time, described judge module is also for judging whether the time difference absolute value between described SNTP lock in time and described second time is greater than Preset Time difference, if, then the SNTP of acquisition is synchronized in described electronic equipment lock in time by described SNTP client, then in described startup SNTP timer adding device, again adds described startup SNTP timer if not.
10. system lock in time based on SNTP according to claim 9, is characterized in that: the span of described Preset Time difference is 0.1s ~ 10s.
CN201510388851.2A 2015-07-03 2015-07-03 A kind of lock in time method and SNTP clients based on SNTP Active CN104993920B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510388851.2A CN104993920B (en) 2015-07-03 2015-07-03 A kind of lock in time method and SNTP clients based on SNTP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510388851.2A CN104993920B (en) 2015-07-03 2015-07-03 A kind of lock in time method and SNTP clients based on SNTP

Publications (2)

Publication Number Publication Date
CN104993920A true CN104993920A (en) 2015-10-21
CN104993920B CN104993920B (en) 2017-10-31

Family

ID=54305677

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510388851.2A Active CN104993920B (en) 2015-07-03 2015-07-03 A kind of lock in time method and SNTP clients based on SNTP

Country Status (1)

Country Link
CN (1) CN104993920B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241157A (en) * 2017-06-05 2017-10-10 上海航天测控通信研究所 A kind of spacecraft time calibrating method based on observing and controlling communication system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459502A (en) * 2007-12-13 2009-06-17 华为技术有限公司 Method and apparatus for network clock synchronization
JP2012134895A (en) * 2010-12-24 2012-07-12 Hitachi Ltd Distribution automation system and distribution automation system control method
CN102916799A (en) * 2012-11-09 2013-02-06 四川长虹电子系统有限公司 Method for time synchronization of network time protocol (NTP) server
KR20140134117A (en) * 2013-05-13 2014-11-21 엘에스산전 주식회사 Digital protection relay and remote time syncronization method thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101459502A (en) * 2007-12-13 2009-06-17 华为技术有限公司 Method and apparatus for network clock synchronization
JP2012134895A (en) * 2010-12-24 2012-07-12 Hitachi Ltd Distribution automation system and distribution automation system control method
CN102916799A (en) * 2012-11-09 2013-02-06 四川长虹电子系统有限公司 Method for time synchronization of network time protocol (NTP) server
KR20140134117A (en) * 2013-05-13 2014-11-21 엘에스산전 주식회사 Digital protection relay and remote time syncronization method thereof

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107241157A (en) * 2017-06-05 2017-10-10 上海航天测控通信研究所 A kind of spacecraft time calibrating method based on observing and controlling communication system
CN107241157B (en) * 2017-06-05 2019-02-19 上海航天测控通信研究所 A kind of spacecraft time calibrating method based on observing and controlling communication system

Also Published As

Publication number Publication date
CN104993920B (en) 2017-10-31

Similar Documents

Publication Publication Date Title
US8730868B2 (en) Network node, time synchronization method and network system
CN109558065B (en) Data deleting method and distributed storage system
US9608753B2 (en) Time synchronization system, management node, and time synchronization method
CN109391799B (en) Monitoring video synchronization method and device and video acquisition equipment
CN101145896B (en) Control system and method for clock synchronization between control stations
EP2976926A2 (en) Dynamic intervals for synchronizing data
CN103999387A (en) Sync interval determination
CN101009546A (en) Time synchronization method for network segment utilizing different time synchronization protocol
CN103428086A (en) PTP protocol-based transparent clock passive port voting method and apparatus
CN107888434B (en) Network equipment configuration synchronization method and device
CN103905441A (en) Data acquisition method and device
CN110213359B (en) Internet of vehicles networking data pushing system and method based on D2D
CN110336636B (en) Time synchronization method and device and substrate management controller
CN106487611B (en) Method and device for detecting SDN cluster split
CN113711511A (en) Industrial equipment supporting multi-time synchronization protocol
CN108243396A (en) A kind of time synchronizing method and device
CN104993920A (en) SNTP-based synchronization time method and SNTP client
CN110071778B (en) Time synchronization method, device, equipment and medium
US11263112B2 (en) Method and apparatus for evaluating quality of software running environment of device
CN109714403B (en) Method and device for determining online time of user
CN109729159B (en) Method and device for reminding loss of network equipment
KR102475744B1 (en) Control apparatis and control system
KR20160000843A (en) Time synchronization method, time synchronization system, time master device, and time slave device
CN114884975A (en) Service message processing method and device, storage medium and electronic device
KR101435181B1 (en) Time synchronization and transmission delay time correction method between the master and the slave of intelligent power distribution system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20201130

Address after: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee after: Hangzhou Jiji Intellectual Property Operation Co., Ltd

Address before: 201616 Shanghai city Songjiang District Sixian Road No. 3666

Patentee before: Phicomm (Shanghai) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201222

Address after: 233000 3rd floor, Dong'an Market, Fengyang West Road, Longzihu District, Bengbu City, Anhui Province

Patentee after: Bengbu 309 Technology Consulting Co.,Ltd.

Address before: Room 10242, No. 260, Jiangshu Road, Xixing street, Binjiang District, Hangzhou City, Zhejiang Province

Patentee before: Hangzhou Jiji Intellectual Property Operation Co., Ltd

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210208

Address after: 313001 room 1019, Xintiandi office building, Yishan street, Wuxing District, Huzhou, Zhejiang, China

Patentee after: Huzhou YingLie Intellectual Property Operation Co.,Ltd.

Address before: 233000 3rd floor, Dong'an Market, Fengyang West Road, Longzihu District, Bengbu City, Anhui Province

Patentee before: Bengbu 309 Technology Consulting Co.,Ltd.

TR01 Transfer of patent right