CN110868268A - Local time timing method, device, timing equipment and storage medium - Google Patents

Local time timing method, device, timing equipment and storage medium Download PDF

Info

Publication number
CN110868268A
CN110868268A CN201911057740.8A CN201911057740A CN110868268A CN 110868268 A CN110868268 A CN 110868268A CN 201911057740 A CN201911057740 A CN 201911057740A CN 110868268 A CN110868268 A CN 110868268A
Authority
CN
China
Prior art keywords
time
setting
source
local
comparison result
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.)
Pending
Application number
CN201911057740.8A
Other languages
Chinese (zh)
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.)
Southern Power Grid Digital Grid Research Institute Co Ltd
Original Assignee
Southern Power Grid Digital Grid Research Institute 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 Southern Power Grid Digital Grid Research Institute Co Ltd filed Critical Southern Power Grid Digital Grid Research Institute Co Ltd
Priority to CN201911057740.8A priority Critical patent/CN110868268A/en
Publication of CN110868268A publication Critical patent/CN110868268A/en
Pending legal-status Critical Current

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/0682Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Electric Clocks (AREA)

Abstract

The invention relates to a method and a device for timing local time, timing equipment and a storage medium. The method comprises the following steps: acquiring at least two time source times; comparing the time of the at least two time sources pairwise to obtain a comparison result; when the comparison result meets a preset condition, determining time setting according to the at least two time source times; and time setting is carried out on the local time according to the time setting time. By adopting the method, the reliability of time synchronization of the local time can be improved.

Description

Local time timing method, device, timing equipment and storage medium
Technical Field
The present invention relates to the technical field of time synchronization, and in particular, to a method, an apparatus, a timing device, and a storage medium for time synchronization of local time.
Background
With the development of the internet of things technology, the timing devices are deployed in various places, and the time accuracy requirement of the timing devices in some fields is very high, so that it is very necessary to accurately time the timing devices. In the conventional technology, a method for time synchronization of a timing device generally performs remote time synchronization on a field time synchronization device through a remote time synchronization server, and the time precision obtained by the time synchronization method sometimes cannot meet the requirement, so that the time data of the timing device is unreliable.
Disclosure of Invention
In view of the above, it is necessary to provide a local time synchronization method, device, time keeping apparatus and storage medium capable of improving reliability of local time synchronization.
In one embodiment, a method for time synchronization of local time is provided, including:
acquiring at least two time source times;
comparing the time of the at least two time sources pairwise to obtain a comparison result;
when the comparison result meets a preset condition, determining time setting according to the at least two time source times;
and time setting is carried out on the local time according to the time setting time.
In one embodiment, a local time synchronization apparatus is provided, including:
the time acquisition module is used for acquiring at least two time source times;
the result acquisition module is used for comparing the time of the at least two time sources pairwise to obtain a comparison result;
the time determining module is used for determining time setting time according to the at least two time source times when the comparison result meets a preset condition;
and the time synchronization module is used for synchronizing the time of the local time according to the time synchronization time.
In one embodiment, there is provided a timekeeping device comprising a memory and a processor, the memory storing a computer program which when executed by the processor performs the steps of:
acquiring at least two time source times;
comparing the time of the at least two time sources pairwise to obtain a comparison result;
when the comparison result meets a preset condition, determining time setting according to the at least two time source times;
and time setting is carried out on the local time according to the time setting time.
In one embodiment, a computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, performs the steps of:
acquiring at least two time source times;
comparing the time of the at least two time sources pairwise to obtain a comparison result;
when the comparison result meets a preset condition, determining time setting according to the at least two time source times;
and time setting is carried out on the local time according to the time setting time.
According to the local time synchronization method, the local time synchronization device, the timing equipment and the storage medium, the two times of the at least two time source times are compared, and the time synchronization time is determined after the comparison result meets the preset condition, so that the condition that the local time is inaccurate after time synchronization due to inaccurate time source time can be avoided, and the reliability of time synchronization of the local time is improved.
Drawings
FIG. 1 is a diagram of an embodiment of an application environment for a time synchronization method for local time;
FIG. 2 is a flow chart illustrating a method for synchronizing local time in one embodiment;
FIG. 3 is a flow chart illustrating a method for synchronizing local time in another embodiment;
FIG. 4 is a block diagram of a device for time synchronization of local time in one embodiment;
fig. 5 is an internal structural view of the timer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The time synchronization method of the local time provided by the invention can be applied to the application environment shown in fig. 1. Wherein the timing device 102 and the server 104 communicate by way of a network. The server 104 sends at least two time source times to the timing device 102, the timing device 102 compares the time source times with each other after receiving the time source times to obtain a comparison result, when the timing device 102 determines that the comparison result meets a preset condition, the time setting time is determined according to the time source times, and further the local time is set according to the time setting time. The timing device 102 may be independently disposed, or may be disposed on other devices, and the other devices may be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices; the server 104 may send a plurality of time source times to the timing device, where the time source times may be derived from, but are not limited to: the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers, such as a satellite navigation system (e.g., a beidou system, a galileo system, a glonass system, a GPS system), a national time service center, an international time service center, a local time service device, or a remote time service device.
In one embodiment, as shown in fig. 2, a method for time synchronization of local time is provided, which is described by taking the method as an example for being applied to the timing device 102 in fig. 1, and includes the following steps:
step S202, at least two time source times are obtained.
The time source time may be understood as the time of other terminals relative to the local terminal, and the time of the other terminals is used for time synchronization of the local terminal. Specifically, the timing device 102 obtains at least two time source times, for example, the time source times may be from a beidou system, a galileo system, a GPS system, a national time service center, and a remote time service device, and it is understood that the number of the time source times may be two, three, or more, and the sources of the time source times may be, but are not limited to, various combinations of the above.
And step S204, comparing the time of at least two time sources pairwise to obtain a comparison result.
After the timing device 102 obtains the at least two time source times, two-by-two comparison is performed on the at least two time source times, and a comparison result is obtained. For example, the timing device 102 acquires two time source times, i.e., a time source time and a time source time, and at this time, the timing device 102 compares the time source times a and B; for another example, the timing device 102 obtains A, B and C time source times, at this time, the timing device 102 compares a and B to obtain a first comparison result, then compares B and C to obtain a second comparison result, and compares a and C to obtain a third comparison result. It will be appreciated that the order in which the timing device 102 compares the plurality of time source times should not be construed as limiting the time synchronization method of the local time of the present invention. Further, the comparison method may be that the difference between two time source times is compared, and at this time, the difference or the absolute value of the difference may be used as the comparison result; it is also possible to compare the ratio of the two time source times, in which case the ratio (which can be understood as a score) can be used as the comparison result.
And step S206, when the comparison result meets the preset condition, determining time setting according to at least two time source times.
The time setting time can be understood as a time source time selected from at least two time source times and used for setting time with the local terminal.
After the timing device 102 finishes the pairwise comparison of the time source times, it is determined whether the obtained comparison result meets a preset condition, and when the comparison result meets the preset condition, one time source time is selected from the time source times to serve as the time setting time. For example, when the timing device 102 acquires the time source times of a and B, the difference between a and B is compared, and if the obtained difference is less than or equal to a preset value, it is determined that the comparison result meets the preset condition, and for example, when the timing device 102 acquires the time source times of A, B and C, two differences between A, B and C are compared, so as to obtain three differences, and if one or two of the three differences are less than or equal to the preset value, it is determined that the comparison result meets the preset condition, or if all of the three differences are less than or equal to the preset value, it is determined that the comparison result meets the preset condition. It will be understood by those skilled in the art that when the comparison result is a ratio, the ratio can be compared with a preset value to determine whether a preset condition is satisfied.
And step S208, time setting is carried out on the local time according to the time setting time.
Specifically, when the time keeping device 102 determines the time keeping time, the local time is kept time according to the time keeping time. For example, the timing device 102 may compare the difference between the time setting time and the local time, and then, when the difference obtained after the comparison is within the set range, take the time setting time as the local time; for another example, the timing device 102 may directly take the time of the pair as the local time.
In the local time synchronization method, the two times of the at least two time source times are compared, and the time synchronization time is determined after the comparison result meets the preset condition, so that the condition that the local time is inaccurate after time synchronization due to inaccurate time source time can be avoided, and the reliability of time synchronization of the local time is improved.
In an embodiment, the timing device 102 may be remotely or locally triggered to time the local time, for example, a relevant person may remotely trigger the timing device 102 to time the local time through a device such as a mobile phone or a computer, or may directly press a button on the timing device 102 to locally trigger the timing device 102 to time the local time. The triggering mode can be made more flexible by triggering the timing device 102 remotely or locally for local time synchronization.
In an embodiment, the timing device 102 may further set an active time tick mode and a passive time tick mode, where when the timing device 102 is in the active time tick mode, local time tick may be performed according to preset information, for example, a user may first set a source of time source time, such as time source time from a Beidou system and a GPS system, and when the timing device 102 is in the active mode, the time source time from the Beidou system and the GPS system may be obtained to perform local time tick; when the timing device 102 is in the passive time synchronization mode, the timing device 102 performs local time synchronization according to information actually input by the user, for example, when the timing device 102 is in the passive time synchronization mode, the user may input time synchronization information at a device such as a mobile phone, and after the timing device 102 receives the time synchronization information, the user may also directly set time synchronization information on the timing device 102 when performing local time synchronization according to the time synchronization information. By means of the active time setting mode and the passive time setting mode, the timing device 102 can perform local time setting according to the corresponding mode, so that the local time setting is more convenient.
In one embodiment, the step of comparing two times of at least two time sources to obtain a comparison result comprises: acquiring first compensation time; according to the first compensation time, compensating the transmission delay of at least two time source times; the transmission delay is the delay of transmitting the time source time to the local terminal; and comparing the compensated at least two time source times pairwise to obtain a comparison result.
Specifically, since there is a transmission delay from the time source time to the timing device 102, after the timing device 102 obtains at least two time source times, the time source time may be compensated according to the first compensation time, and then the compensated time source times are compared with each other to obtain a comparison result. For example, after receiving the a and B time source times, the timing device 102 may compensate a according to a first compensation time (for example, a may be added to the first compensation time), then obtain a compensated a, and compare the compensated a with B, where the comparison may be a difference comparison, and then use the difference or an absolute value of the difference as a comparison result; for another example, the timing device 102 may add the first compensation time to both a and B, compare the compensated a and the compensated B, and for example, compare the difference between the compensated a and the compensated B, and use the difference or the absolute value of the difference as the comparison result. It can be understood that the specific value or the positive and negative values of the first compensation time can be set according to the actual time delay of transmission and other conditions; it is understood that the first compensation time may include at least one first sub-compensation time, for example, if a is transmitted to the timing device 102 for a longer time than B is transmitted to the timing device 102, in which case the first compensation time may include two first sub-compensation times a and B (a is greater than B), adding a to the first sub-compensation time a and adding B to the first sub-compensation time B to obtain a compensated a and a compensated B.
In this embodiment, the time source time is compensated by the first compensation time, so that the problem of transmission delay caused by transmission of the time source time to the timing device 102 can be solved, and a more accurate time source time is obtained, so that a more accurate time setting time is obtained, and the reliability of local time setting is further improved.
In another embodiment, if the first backoff time is not set, the timing device 102 may compensate the time source according to a default setting, such as the default setting: when the first compensation time is not set, the time source time is compensated with 0 as the first compensation time. When the first compensation time is not set, the time source time is compensated in a default setting mode, the situation that the timing equipment cannot time the local time under the condition that the first compensation time is forgotten to be set can be avoided, and the stability of time synchronization of the local time is improved.
In one embodiment, the time-setting the local time according to the time-setting time includes: acquiring second compensation time; compensating the processing delay of the contrast time according to the second compensation time; the processing delay is the delay caused by the instruction processing in the computer program of the local terminal; a computer program for implementing the method in the above embodiments; and time synchronization is carried out on the local time according to the compensated time synchronization time.
Specifically, in order to process the time source time, the timing device needs to execute a corresponding processing computer program, that is, to process an instruction in the computer program, because of the problem of processing performance, the timing device 102 may have a processing delay when processing the instruction, and therefore, after obtaining the second compensation time, the timing device 102 may compensate the processing delay of the timing time according to the second compensation time, and use the compensated timing time for timing with the local time. It is understood that, because different timing devices 102 have different processing performances, the second compensation time may be set according to actual situations, for example, a timing device with lower processing performance may be set with a larger value of the second compensation time, a timing device with higher processing performance may be set with a smaller value of the second compensation time, and further, when the relevant person considers that the processing performance height of the timing device has satisfied the actual requirement, the second compensation time may be set to 0.
In this embodiment, the time setting is compensated by the second compensation time, so that the problem of processing delay caused by processing the time source time can be solved, more accurate time setting can be obtained, and the reliability of time setting of the local time can be further improved.
In one embodiment, the step of determining a time of day from at least two time source times comprises: judging whether time source time matched with preset reference time source time exists in the at least two time source times; and if the time source time matched with the preset reference time source time exists, taking the reference time source time as the time setting time. In another embodiment, if there is no time source time matching the preset reference time source time, the time setting is determined according to the preset priority rule.
Specifically, the timing device 102 compares the time source times two by two to obtain a comparison result, and when the comparison result meets a preset condition, the timing device 102 determines whether a time source time matched with a preset reference time source time exists in at least two time sources, if so, the timing device 102 takes the reference time source time as the time setting time, and if not, the timing device 102 obtains a preset priority rule and determines the time setting time according to the priority rule. For example, when the preset reference time source time is C, the time keeping device 102 acquires A, B and C, and after two comparisons are made and the comparison result meets the preset condition, the time keeping device 102 determines that there is a time source time C matching the reference time source time C from A, B and C, and at this time, the time keeping device 102 takes C as the time keeping time; for another example, when the timekeeping device 102 only acquires two time source times, i.e., a time source time and a time source time, B, and the timekeeping device 102 determines that there is no time source time matching the reference time source C according to a and B, at this time, the timekeeping device acquires a preset priority rule and determines the time setting according to the priority rule.
Further, when there is no time source time that matches the reference time source time among the time source times and there is no preset priority rule, the time counting device 102 may randomly select one time source time from the acquired time source times as the time setting time.
In one embodiment, the step of determining the time to the time according to the preset priority rule comprises: determining time source time with the highest priority level from the time source time according to a preset priority rule; and taking the time source time with the highest priority as the time setting time.
Specifically, when the timing device 102 determines that there is no time source time matching the reference time source time in the time source times, the timing device 102 determines a time source time with the highest priority level from the time source times according to a preset priority rule, and takes the time source time with the highest priority level as a time setting time; for example, when the reference time source is D and the preset priority rule (priority level is ranked from high to low) is B-a-C-D, the time source times acquired by the timing device 102 are A, B and C, and after determining that there is no time source time matching D in the acquired time source times according to the reference time source D, the timing device 102 takes the time source time B with the highest priority level as the time-setting time according to the priority rule; for another example, when the time keeping device 102 acquires that the time source times are a and C, the time source time a with the highest priority level is taken as the time keeping time according to the priority rule. It is to be understood that, when there is a time source time matching the reference time source in the time sources acquired by the timing device 102, the timing device 102 preferentially uses the time source time matching the reference time source as the time setting time, for example, the timing device 102 also acquires D and determines that D matches the reference time source time, and then the timing device 102 may directly set D as the time setting time without using the priority rule. It is to be understood that, when the time source time acquired by the timing device 102 does not have a time source time matching the reference time source time, and the priority level of the acquired time source time is not set in the priority level rule, the timing device 102 may randomly select one time source time as the time setting time, for example, the time source times acquired by the timing device 102 are E, F and G, at this time, there is no time source time corresponding to the reference time source D in the three time source times, and the corresponding priority level is not set in the priority level rule, at this time, the timing device 102 may randomly select one time source time as the time setting time, for example, F is used as the time setting time.
In the above embodiment, it is determined whether a time source time matched with the reference time source time exists in the time source time, and when the time source time matched with the reference time source time exists, the timing device 102 can time the local time by using the time source time matched with the reference time source time as the time setting time, so that a relevant person can set the reference time source time to time the local time; moreover, when there is no time source time matching the reference time source time, the timing device 102 may determine the time setting time according to a preset priority rule, so as to avoid a situation that the local time setting cannot be normally performed due to the fact that the reference time source time is not set, and improve flexibility of the local time setting; if the priority rule is not preset, the timing device 102 may randomly select a time source time from the acquired time source times, and use the selected time source time as the time setting time, thereby further improving the flexibility of time setting.
In one embodiment, before the step of time-setting the local time according to the time-setting time, the method further includes: comparing the time setting time with the local time to obtain a time setting comparison value; and when the comparison value is greater than or equal to the comparison set value, sending alarm information. In another embodiment, the time-tick step of the local time according to the time-tick includes: and when the time setting comparison value is smaller than the time setting comparison set value, taking the time setting time as the local time.
Specifically, the timing device 102 compares the time setting time with the local time after determining the time setting time to obtain a time setting comparison value, and sends an alarm message when the time setting comparison value is greater than or equal to a comparison set value; and when the time setting comparison value is smaller than the time setting comparison set value, taking the time setting time as the local time. For example, the timing device 102 determines that the time setting time is a, may compare the difference between the local time and a to obtain a difference, and use an absolute value of the difference as a time setting comparison value, when the time setting comparison value is greater than or equal to the comparison setting value, the timing device 102 may stop time setting, record the alarm information, and send the alarm information, for example, may send the alarm information to the remote device; when the comparison value of the pair of times is smaller than the comparison set value, the timing device sets A as the local time.
In this embodiment, after the time synchronization time is determined, the time synchronization time is further compared with the local time to obtain a time synchronization comparison value, and whether the time synchronization time is to be used as the local time is determined according to the comparison setting value, so that the local time is prevented from being synchronized when the time synchronization time is abnormal and the difference between the time synchronization time and the local time is large, and the reliability of the local time is further improved.
In the traditional technology, the method for timing the timing device mainly comprises the steps of comparing time source time with local time after the time source time is obtained, and if a comparison result meets a condition, comparing the priority level between the time source time and the local time, and taking the time with higher priority level as the local time; however, the inventor finds that if the timing device acquires the inaccurate time source time, the local time is timed according to the inaccurate time source time, so that the local time timing result is unreliable. Based on the above, the inventor proposes a method for acquiring at least two time source times, comparing the acquired time source times pairwise, when a pairwise comparison result between the time source times meets a preset condition, indicating that the time source times are accurate and reliable, then determining a time setting time from the time source times, and setting the time of the local time according to the determined time setting time.
In order to better understand the above method, an application example of the time synchronization method of the local time of the present invention is described in detail below.
In one embodiment, a user may perform time tick configuration on the timing device, and perform local time tick according to the time tick configuration after the timing device is triggered to tick; specifically, the time tick configuration may include, but is not limited to, the following configuration contents:
a. two or more than two time source times can be selected and configured as required, the sources of the time source times can be selected as required, for example, a Beidou system and a GPS system can be selected, the Beidou system, a national time service center and the GPS system can also be selected, and an international time service center, local time service equipment, remote time service equipment, the Beidou system, a Galileo system and the like can also be selected.
b. In the selected time source time, configuring reference time source time, and preferentially using the reference time source time as time setting, namely taking the reference time source time as time setting time; if no reference time source time exists, the time setting time can be determined according to a set priority rule; when there is no reference time source time and priority rule, a time source time may be randomly selected from the time source times, and the selected time source time is taken as the time setting time.
c. The first compensation time Ty (for transmission delay compensation, which may be understood as transmission delay of time source time transmitted to the timing device) configured to compensate the transmission delay may be a positive number or a negative number, so as to compensate different time source times and obtain more accurate time source time; if the first compensation time Ty is not configured, the first compensation time Ty may be defaulted to 0.
d. A preset value F can be configured, and time synchronization is stopped if the absolute value of the difference between the time of each time source is larger than F.
e. The second compensation time Tx for compensating the time setting may be configured (considering that some time is consumed when performing the time setting procedure due to the weak computing power of some time setting devices, the time setting procedure needs to be compensated after determining the time setting procedure), in practical cases, the second compensation time Tx with a larger value may be set for the time setting device with the lower processing performance, and the second compensation time Tx may be set to 0 for the time setting device with the higher processing performance, so as to obtain a more accurate time setting procedure.
After the timing device starts timing, if an abnormal condition occurs, the timing is stopped, and the alarm information is recorded and can be sent to a remote system; and if no abnormal condition exists, using the time setting time to time the local time. Further, the processing method in the abnormal situation and the normal situation is illustrated as follows:
a. two time source times a and B: when the first compensation time comprises two first sub-compensation times Ty1 and Ty2, compensating the transmission delay of A and B, then comparing difference values, if the absolute value of the difference value is greater than or equal to a preset value F, namely | (A + Ty1) - (B + Ty2) | > F, at the moment, determining that the situation is abnormal, stopping time comparison, and recording alarm information; if the absolute value of the difference is smaller than a preset value F, i.e., | (a + Ty1) - (B + Ty2) | < F, and a is the reference time source time, then taking a + Tx as the time tick time, the local time tick is performed (Tx is the second compensation time).
b. Three time source times a, B and C: when the first compensation time comprises three first sub-compensation times Ty1, Ty2 and Ty3, performing compensation on transmission delay of a, B and C, comparing difference values between every two, and if the absolute value of the difference value is greater than or equal to a preset value F, determining that the absolute value is an abnormal condition, and recording alarm information when the absolute value is determined to be abnormal, wherein the absolute value is | (a + Ty1) - (B + Ty2) | > | F or | (a + Ty1) - (C + Ty3) | > | F or | (B + Ty2) - (C + Ty3) > | F; if the absolute values | (a + Ty1) - (B + Ty2) | < F, | (a + Ty1) - (C + Ty3) | < F and | (B + Ty2) - (C + Ty3) | < F, and B are the reference time source times, then the local time-pair is performed with B + Tx being the time-pair time (Tx being the second compensation time).
c.N time source times, and so on.
d. When the comparison value of the time setting between the time setting time and the local time is a difference absolute value, if the difference absolute value is more than or equal to a time setting comparison set value Fb, stopping the time setting, simultaneously recording alarm information, and also sending the alarm information to a remote system; and if the time setting time is less than the time setting comparison set value Fb, setting the time setting time as the local time.
In another embodiment, referring to fig. 3, the method for setting time of local time may include the following steps:
step S302, when the timing device is triggered to time remotely or locally, step S304, the timing device obtains two or more than two time source times, step S306, after the time source times are compared, when the comparison result meets the preset condition, the time setting time is determined, and the local time is set according to the determined time setting time.
In this embodiment, the timing device obtains at least two time source times, determines the time synchronization time after comparing the time source times, and then performs time synchronization on the local time, so that the reliability of the time synchronization of the local time can be effectively improved, and the first compensation time and the second compensation time can be flexibly set, so that the time synchronization of the local time is more accurate, and the reliability is improved.
It should be noted that, for the sake of simplicity, the foregoing method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present invention is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present invention.
Based on the same idea as the local time synchronization method in the above embodiment, the present invention further provides a local time synchronization device, which can be used to execute the local time synchronization method. For convenience of explanation, the schematic structural diagram of the embodiment of the time synchronization device at the local time only shows a part related to the embodiment of the present invention, and those skilled in the art will understand that the illustrated structure does not constitute a limitation to the device, and may include more or less components than those illustrated, or combine some components, or arrange different components.
In one embodiment, as shown in fig. 4, there is provided a local time synchronization apparatus 400, including: a time acquisition module 402, a result acquisition module 404, a time determination module 406, and a time tick module 408, wherein:
a time obtaining module 402, configured to obtain at least two time source times;
a result obtaining module 404, configured to compare two times of at least two time sources to obtain a comparison result;
the time determining module 406 is configured to determine a time setting time according to the at least two time source times when the comparison result meets a preset condition;
the time synchronization module 408 is configured to perform time synchronization on the local time according to the time synchronization time.
In one embodiment, the result obtaining module 404 is further configured to obtain a first compensation time; according to the first compensation time, compensating the transmission delay of at least two time source times; the transmission delay is the delay of transmitting the time source time to the local terminal; and comparing the compensated at least two time source times pairwise to obtain a comparison result.
In one embodiment, the time synchronization module 408 is further configured to obtain a second compensation time; compensating the processing delay of the contrast time according to the second compensation time; the processing delay is the delay caused by the instruction processing in the computer program of the local terminal; a computer program for implementing the method in the above embodiments; and time synchronization is carried out on the local time according to the compensated time synchronization time.
In one embodiment, the time determination module 406 further comprises: the reference time source judging unit is used for judging whether time source time matched with preset reference time source time exists in the at least two time source times; the time determination first unit is used for taking the reference time source time as the time setting time if the time source time matched with the preset reference time source time exists; and the time determining second unit is used for determining the time setting time according to a preset priority rule if no time source time matched with the preset reference time source time exists.
In one embodiment, the time determining second unit is further configured to determine, according to a preset priority rule, a time source time with a highest priority level from among the time source times; and taking the time source time with the highest priority as the time setting time.
In an embodiment, the time tick module 408 is further configured to compare the tick time with the local time to obtain a tick comparison value; and when the comparison value is greater than or equal to the comparison set value, sending alarm information.
In one embodiment, the time tick module 408 is further configured to take the tick time as the local time when the tick comparison value is less than the tick comparison setting value.
It should be noted that, the local time synchronization device of the present invention corresponds to the local time synchronization method of the present invention one to one, and the technical features and the beneficial effects described in the above embodiment of the local time synchronization method are all applicable to the embodiment of the local time synchronization device, and specific contents may refer to the description in the embodiment of the local time synchronization method, and are not described herein again, and thus the present invention is stated herein.
In addition, in the above exemplary embodiment of the local time synchronization apparatus, the logical division of each program module is only an example, and in practical applications, the above function distribution may be performed by different program modules according to needs, for example, due to the configuration requirement of corresponding hardware or the convenience of implementation of software, that is, the internal structure of the local time synchronization apparatus is divided into different program modules to perform all or part of the above described functions.
In one embodiment, a timing device is provided, which may be a terminal device, and its internal structure diagram may be as shown in fig. 5. The timing device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the timing device is configured to provide computing and control capabilities. The memory of the timing device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the timing device is used for storing the time setting data of the local time. The network interface of the timing device is used for communicating with an external terminal through network connection. The computer program is executed by a processor to implement a method of time synchronization of local time.
It will be appreciated by those skilled in the art that the configuration shown in figure 5 is a block diagram of only a portion of the configuration associated with the inventive arrangements and does not constitute a limitation on the timing device to which the inventive arrangements are applied, and that a particular timing device may include more or less components than those shown, or combine certain components, or have a different arrangement of components.
In one embodiment, a timing device is provided, comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the above described method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the respective method embodiment as described above.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware related to instructions of a computer program, and the program may be stored in a computer readable storage medium and sold or used as a stand-alone product. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection component (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
The terms "comprises" and "comprising," and any variations thereof, of embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or (module) elements is not limited to only those steps or elements but may alternatively include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present invention, but are 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 patent shall be subject to the appended claims.

Claims (10)

1. A method for synchronizing local time, comprising:
acquiring at least two time source times;
comparing the time of the at least two time sources pairwise to obtain a comparison result;
when the comparison result meets a preset condition, determining time setting according to the at least two time source times;
and time setting is carried out on the local time according to the time setting time.
2. The method of claim 1, wherein the step of comparing the at least two time source times two by two to obtain a comparison result comprises:
acquiring first compensation time;
according to the first compensation time, compensating the transmission delay of the at least two time source times; the transmission delay is the delay of transmitting the time source time to the local terminal;
and comparing the compensated time of the at least two time sources pairwise to obtain the comparison result.
3. The method of claim 1, wherein the step of time-setting the local time according to the time-setting time comprises:
acquiring second compensation time;
according to the second compensation time, compensating the processing delay of the time setting time; the processing delay is the delay caused by the instruction processing in the computer program of the local terminal; the computer program for implementing the method of claim 1;
and time setting is carried out on the local time according to the compensated time setting time.
4. The method of claim 1, wherein the step of determining a time from the at least two time source times comprises:
judging whether time source time matched with preset reference time source time exists in the at least two time source times;
if yes, taking the reference time source time as the time setting time;
if not, the time setting time is determined according to a preset priority rule.
5. The method of claim 4, wherein the step of determining the time of the day according to a predetermined priority rule comprises:
determining time source time with the highest priority level from the time source time according to a preset priority rule;
and taking the time source time with the highest priority as the time setting time.
6. The method according to any one of claims 1 to 5, wherein the step of time-setting the local time according to the time-setting time further comprises:
comparing the time setting time with local time to obtain a time setting comparison value;
and when the time comparison value is greater than or equal to the time comparison set value, sending alarm information.
7. The method of claim 6, wherein the step of time-setting the local time according to the time-setting time comprises:
and when the time setting comparison value is smaller than the time setting comparison set value, taking the time setting time as the local time.
8. A device for synchronizing local time, comprising:
the time acquisition module is used for acquiring at least two time source times;
the result acquisition module is used for comparing the time of the at least two time sources pairwise to obtain a comparison result;
the time determining module is used for determining time setting time according to the at least two time source times when the comparison result meets a preset condition;
and the time synchronization module is used for synchronizing the time of the local time according to the time synchronization time.
9. A timekeeping apparatus comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps of the method of any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN201911057740.8A 2019-11-01 2019-11-01 Local time timing method, device, timing equipment and storage medium Pending CN110868268A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911057740.8A CN110868268A (en) 2019-11-01 2019-11-01 Local time timing method, device, timing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911057740.8A CN110868268A (en) 2019-11-01 2019-11-01 Local time timing method, device, timing equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110868268A true CN110868268A (en) 2020-03-06

Family

ID=69653767

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911057740.8A Pending CN110868268A (en) 2019-11-01 2019-11-01 Local time timing method, device, timing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110868268A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111404632A (en) * 2020-03-24 2020-07-10 上海银欣高新技术发展股份有限公司 Offline timing method, medium, offline server and offline timing system
CN113378398A (en) * 2021-06-22 2021-09-10 南方电网数字电网研究院有限公司 Health degree analysis method and system based on electric energy meter and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1642068A (en) * 2004-01-02 2005-07-20 上海欣泰通信技术有限公司 Time supply and synchronizing system for telecommunication network
WO2010029822A1 (en) * 2008-09-09 2010-03-18 セイコーインスツル株式会社 Communication system, synchronization method, and base station device
CN105119677A (en) * 2015-09-09 2015-12-02 山东中瑞电气有限公司 Time source selecting and switching method capable of improving time service output reliability
CN106685566A (en) * 2016-12-31 2017-05-17 上海远景数字信息技术有限公司 Clock source selection method and clock server
CN107425882A (en) * 2017-04-20 2017-12-01 北京智芯微电子科技有限公司 A kind of calibration method and device of broadband power line communication network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1642068A (en) * 2004-01-02 2005-07-20 上海欣泰通信技术有限公司 Time supply and synchronizing system for telecommunication network
WO2010029822A1 (en) * 2008-09-09 2010-03-18 セイコーインスツル株式会社 Communication system, synchronization method, and base station device
CN105119677A (en) * 2015-09-09 2015-12-02 山东中瑞电气有限公司 Time source selecting and switching method capable of improving time service output reliability
CN106685566A (en) * 2016-12-31 2017-05-17 上海远景数字信息技术有限公司 Clock source selection method and clock server
CN107425882A (en) * 2017-04-20 2017-12-01 北京智芯微电子科技有限公司 A kind of calibration method and device of broadband power line communication network

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111404632A (en) * 2020-03-24 2020-07-10 上海银欣高新技术发展股份有限公司 Offline timing method, medium, offline server and offline timing system
CN111404632B (en) * 2020-03-24 2022-08-23 上海银欣高新技术发展股份有限公司 Offline timing method, medium, offline server and offline timing system
CN113378398A (en) * 2021-06-22 2021-09-10 南方电网数字电网研究院有限公司 Health degree analysis method and system based on electric energy meter and storage medium

Similar Documents

Publication Publication Date Title
US9859661B2 (en) Connector of an electronic device
CN108242837B (en) Electronic device and method of controlling charging of electronic device
US20150065035A1 (en) Method and apparatus for providing user with information received by electronic device
US11984988B2 (en) System and method for providing dynamic hybrid automatic repeat request (HARQ) codebook with multiple valid unicast downlink control information (DCI) per monitoring occasion index per serving cell
CN110868268A (en) Local time timing method, device, timing equipment and storage medium
CN107623899B (en) Information processing method, information processing apparatus, storage medium, and electronic device
CN109672608B (en) Method for transmitting messages according to time
US20210112572A1 (en) System and method for physical downlink control channel monitoring
CN110737719A (en) Data synchronization method, device, equipment and computer readable storage medium
US20210258118A1 (en) System and method for providing channel state information reference signal power determination in unlicensed spectrum
CN112422369B (en) Method and device for determining offline time, storage medium and electronic device
KR20200107089A (en) Method and electronic device for scanning channel to perform location based service
CN111050217B (en) Video playing method and device
CN113518431B (en) Communication processing method, terminal, device and storage medium
CN110334149B (en) Block chain-based data recording method and device and electronic equipment
US8412663B2 (en) System and method for temporal correlation of observables based on timing ranges associated with observations
CN110944320B (en) Smart card identification method, smart card identification system and computer-readable storage medium
CN111800781A (en) Data processing method and terminal
KR20200144241A (en) Structure of electronic device for optimizing performance of antenna and method thereof
US9537845B1 (en) Determining authenticity based on indicators derived from information relating to historical events
CN113225332B (en) User login management method, device, terminal equipment and storage medium
US20190149181A1 (en) Frequency band selection
WO2022151218A1 (en) Propagation delay compensation method, apparatus, and device, base station, system, and medium
CN109544368B (en) Bone marrow proliferation disease qualification authentication method, device, server and readable medium
CN116799918A (en) Configuration method and device of charging parameters, computer readable storage medium and terminal

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200306

RJ01 Rejection of invention patent application after publication