CN105915308A - Time synchronization method, device and system - Google Patents

Time synchronization method, device and system Download PDF

Info

Publication number
CN105915308A
CN105915308A CN201610539966.1A CN201610539966A CN105915308A CN 105915308 A CN105915308 A CN 105915308A CN 201610539966 A CN201610539966 A CN 201610539966A CN 105915308 A CN105915308 A CN 105915308A
Authority
CN
China
Prior art keywords
time
transmission
transmission time
data bag
reply data
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
CN201610539966.1A
Other languages
Chinese (zh)
Other versions
CN105915308B (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610539966.1A priority Critical patent/CN105915308B/en
Publication of CN105915308A publication Critical patent/CN105915308A/en
Application granted granted Critical
Publication of CN105915308B publication Critical patent/CN105915308B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • 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/0685Clock or time synchronisation in a node; Intranode synchronisation

Landscapes

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

Abstract

The application discloses a time synchronization method, a time synchronization device and a time synchronization system. The method comprises the following steps: sending a time synchronization request to target equipment, receiving a response data package returned by the target equipment and containing a transmitting timestamp, determining transmission time spent from sending the time synchronization request to receiving the data package, determining a transmission time threshold value according to a preset time error scope and expected probability falling into the time error scope, and judging whether the transmission time is shorter than the transmission time threshold value, and if the transmission time is shorter than the transmission time threshold value, correcting the time of the synchronization equipment according to the transmission time and the sending timestamp of the response data package. The application records the influence of transmission time, so that the finally corrected time of the synchronization equipment is more accurate.

Description

A kind of method for synchronizing time, Apparatus and system
Technical field
The application relates to Time synchronization technique field, more particularly, it relates to a kind of method for synchronizing time, Apparatus and system.
Background technology
Time synchronized can also be referred to as " to clock ", will in system the clock of each equipment with in system The standard time clock alignment set.
Being of wide application of time synchronized, relatively common needs and application server such as applications client Between carry out time synchronized.Prior art is when carrying out time synchronized, by applications client to application service Time synchronized request initiated by device, using application server current time as anti-when application server receives request Feedforward information is back to applications client, applications client using the current time in feedback information as standard time Between carry out " to clock ".
Owing to feedback information cannot be measured to the time that applications client is spent from application server transmission, And network delay is generally within thousand milliseconds of ranks, therefore prior art have ignored what network delay was brought Error.This solution can be applicable to major part requires it is not the highest application service to time synchronized. But, along with time precision is required more and more higher by application, prior art cannot be applicable to high accuracy The requirement of time synchronized.
Summary of the invention
In view of this, this application provides a kind of method for synchronizing time, Apparatus and system, for offer one Plant precise synchronization scheme.
To achieve these goals, it is proposed that scheme as follows:
A kind of method for synchronizing time, including:
Time synchronized request is sent to target device;
Receive the reply data bag comprising transmission timestamp that described target device returns;
Determine and ask to receive the transmission that described reply data bag is spent from sending out described time synchronized Time;
According to default time error scope and the expected probability falling into this time error scope, determine transmission Time threshold;
Judge that whether the described transmission time is less than described transmission time threshold;
If so, according to described transmission time and the transmission timestamp of described reply data bag, correct described same The time of step equipment.
A kind of time synchronism apparatus, including:
Synchronization request transmitting element, for sending time synchronized request to target device;
Time bag receives unit, for receiving the response comprising transmission timestamp that described target device returns Packet;
The transmission time determines unit, is used for determining and asks to receive described from sending out described time synchronized The transmission time that reply data bag is spent;
Transmission time threshold determines unit, is used for according to the time error scope preset and falls into this time by mistake The expected probability of difference scope, determines transmission time threshold;
Threshold decision unit, is used for judging that whether the described transmission time is less than described transmission time threshold;
Correction time determines unit, is used for when the judged result of described threshold decision unit is for being, according to Described transmission time and the transmission timestamp of described reply data bag, correct the time of described synchronizer.
A kind of clock synchronization system, including at least one synchronizer and at least one target device, described The clock of target device is standard time clock;
Described synchronizer is used for, and sends time synchronized request to described target device;Receive described target What equipment returned comprises the reply data bag sending timestamp;Determine from sending out the request of described time synchronized To receiving the transmission time that described packet is spent;According to default time error scope and fall into this The expected probability of time error scope, determines transmission time threshold;Judge whether the described transmission time is less than Described transmission time threshold;If so, according to described transmission time and the transmission time of described reply data bag Stamp, corrects the time of described synchronizer;
Described target device is used for, when receiving the time synchronized request that described synchronizer sends, according to Self current time determines transmission timestamp, returns to described synchronizer and comprises described transmission timestamp Reply data bag.
The method for synchronizing time that the embodiment of the present application provides includes: synchronizer sends the time to target device Synchronization request, receive described target device return comprises send timestamp reply data bag, determine from Send out described time synchronized to ask to receive the transmission time that described reply data bag is spent, according to The time error scope preset and the expected probability falling into this time error scope, determine transmission time threshold, Judge that whether the described transmission time is less than described transmission time threshold;If so, according to the described transmission time and The transmission timestamp of described reply data bag, corrects the time of described synchronizer.As can be seen here, this Shen Please correct synchronizer time time, it is contemplated that send time synchronized request to receive reply data bag this The transmission time of individual process, and the transmission timestamp of the reply data bag of target device return.The application Note and the impact of transmission time so that the time of the synchronizer finally determined is more accurate.
Further, the application is general according to default time error scope and the expectation falling into this time error scope Rate, determines transmission time threshold, and utilizes this transmission time threshold to choose the transmission time meeting condition. It is easy to user flexibility and controls the precision of time synchronized and the time-consuming of time synchronization process.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present application or technical scheme of the prior art, below will be to reality Execute the required accompanying drawing used in example or description of the prior art to be briefly described, it should be apparent that below, Accompanying drawing in description is only embodiments herein, for those of ordinary skill in the art, not On the premise of paying creative work, it is also possible to obtain other accompanying drawing according to the accompanying drawing provided.
Fig. 1 is the schematic diagram that a kind of synchronizer and the target device of the application example carries out time synchronized;
Fig. 2 is a kind of method for synchronizing time flow chart disclosed in the embodiment of the present application;
Fig. 3 be the application example different RTT under the probability density curve schematic diagram of t1-t2;
Fig. 4 is a kind of method flow diagram determining transmission time threshold disclosed in the embodiment of the present application;
Fig. 5 is a kind of time synchronism apparatus structural representation disclosed in the embodiment of the present application;
Fig. 6 is the hardware architecture diagram of a kind of synchronizer disclosed in the embodiment of the present application.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is carried out Clearly and completely describe, it is clear that described embodiment is only some embodiments of the present application, and It is not all, of embodiment.Based on the embodiment in the application, those of ordinary skill in the art are not doing Go out the every other embodiment obtained under creative work premise, broadly fall into the scope of the application protection.
Inventor finds by existing Time Synchronizing carries out research, existing time synchronized side Case have ignored data and propagate time consuming impact in a network, thus cause time synchronized accuracy The highest.And along with terminal and the development of application, the requirement to timing tracking accuracy is more and more higher, existing Time Synchronizing cannot be adapted to the requirement of current precise synchronization.Illustrate such as, many In people's interactive movie project, movie player and multiple terminals need to show interactive interface simultaneously, synchronize Timing, disappears simultaneously, requires high to the timing tracking accuracy of each terminal, existing Time Synchronizing This scene cannot be applicable to.
To this end, this application provides a kind of high-precision method for synchronizing time.
The method for synchronizing time of the application is applied to clock synchronization system, and system comprises at least one synchronization and sets Standby and at least one target device.Wherein, synchronizer is the equipment of pending time synchronized, and target sets Standby is the equipment as time source, and its clock is standard time clock.In actual application, synchronizer can be Mobile phone, IPAD, notebook etc. possess the electronic equipment of network access facility.General, time synchronized Request can be that certain application installed in synchronizer is initiated.It is of course also possible to be synchronizer Operating system initiate.
Target device can be server, such as target device be in synchronizer initiate time synchronized request The application server corresponding to intended application, or for intended application provide service transfer server Deng.Certainly, target device can also be the electronic equipment such as mobile phone, notebook.
Synchronizer and target device can set according to specific needs.
In the Time Synchronizing of the application, target device is used for, and is receiving the time that synchronizer sends During synchronization request, return to described synchronizer and comprise the reply data bag sending timestamp;
Wherein, described reply data bag send timestamp be target device determine for the time of carrying out with The timestamp that sends of the time response packet of step can be that target device receives the request of described time synchronized Time, it is also possible to be, after target device receives the request of described time synchronized, to return the time of reply data bag.
Certainly, time-consuming compared to Internet communication, target device is from receiving time synchronized request to sending response The process time of packet is extremely short, can ignore this fractional error.
Synchronizer is used for, and sends time synchronized request to described target device;Receive described target device Return comprises the reply data bag sending timestamp, determines and asks to connect from sending out described time synchronized Receive the transmission time that described reply data bag is spent;According to default time error scope and fall into this The expected probability of time error scope, determines transmission time threshold;Judge whether the described transmission time is less than Described transmission time threshold;If so, according to described transmission time and the transmission time of described reply data bag Stamp, corrects the time of described synchronizer, to be allowed to keep consistent with the time of described target device.
See a kind of synchronizer that Fig. 1, Fig. 1 are the application example and carry out time synchronized with target device Schematic diagram.
In Fig. 1, with synchronizer as web front end, target device as server as a example by illustrate.
As shown in Figure 1:
Web front end initiates time synchronized request, query time in the To moment to server.Owing to network passes Broadcasting time-consuming existence, the time of server time of receipt (T of R) synchronization request is the Ts moment, deposits between To and Ts Time at t1.Owing to server operation required time is within 1ms, relative to the net of 100ms magnitude The network time is negligible, and therefore the application sets the reply data bag that server feeds back to web front end Transmission timestamp be Ts.Due to the existence of network time, web front end receives the time of reply data bag For the Ts' moment, between Ts and Ts', there is the time of t2.
Wherein, cannot directly determine for t1 and t2, and overall transmission time RTT (i.e. t1+t2) May determine that.
It will be further understood that RTT is the least means that time synchronization error is the least, time synchronized mistake The total time that journey is consumed will be the biggest.
The application can be preset time error scope by user and fall into the phase of this time error scope Hope probability, and then determine therefrom that transmission time threshold.Synchronizer is when judging certain transmission once determined Between less than described transmission time threshold time, according to this time transmission the time and target device return answer number According to bag transmission timestamp, correct the time of described synchronizer, be allowed to described target device time Between keep consistent.
Owing to synchronizer is when correction time, it is contemplated that send time synchronized and ask to receiving reply data Wrap the transmission time of this process, and the transmission timestamp of the reply data bag of target device return, also I.e. synchronizer note and the time-consuming impact of Internet communication so that the time of correction of a final proof is more accurate.
Further, the application is general according to default time error scope and the expectation falling into this time error scope Rate, determines transmission time threshold, and utilizes this transmission time threshold to choose the transmission time meeting condition. It is easy to user flexibility and controls the precision of time synchronized and the time-consuming of time synchronization process.
It follows that scheme is introduced by the application with the angle of synchronizer.
Seeing Fig. 2, Fig. 2 is a kind of method for synchronizing time flow chart disclosed in the embodiment of the present application.
As in figure 2 it is shown, the method includes:
Step S200, to target device send time synchronized request;
Specifically, synchronizer determine need to carry out time synchronized time, to target device send the time with Step request.Time synchronized request can be to be the form transmission with message or packet.Time synchronized request can To be a segment identification, code or other form.
It is understood that time-consuming in order to reduce Internet communication, can reduce shared by time synchronized request Data volume.
Step S210, receive described target device return comprise send timestamp reply data bag;
Wherein, described reply data bag send timestamp be described target device determine for carrying out time Between synchronize time.Sending timestamp can be the time that target device receives the request of described time synchronized, It can also be the time obtained after target device time of receipt (T of R) synchronization request union.
It is understood that time-consuming in order to reduce Internet communication, the size of reply data bag can be reduced. Such as, transmission timestamp is placed on the header part of reply data bag, by the main part of reply data bag Leave a blank, to reduce the transmission time of time bag.
Step S220, determine and ask to receive described reply data bag institute from sending out described time synchronized The transmission time spent;
Specifically, the time receiving described reply data bag and the time sending the request of described time synchronized Difference is transmission time RTT.
Step S230, according to the time error scope preset with fall into the expected probability of this time error scope, Determine transmission time threshold;
Specifically, user can set oneself patient time error scope, and by time error Control the expected probability in the range of described time error.It is understood that time error scope is the least, Expected probability is the highest, then corresponding transmission time RTT is the least.Synchronizer is sent to target device The number of times of time synchronized request is the most, and the total time that time synchronization process consumes is the longest.
In the present embodiment, can be according to default time error scope and the phase falling into this time error scope Hope that probability determines transmission time threshold.
Step S240, judge that the described transmission time is whether less than described transmission time threshold;If so, perform Step S250, performs step S200 if it is not, return;
Step S250, according to described transmission time and the transmission timestamp of described reply data bag, correct institute State the time of synchronizer.
Specifically, according to described transmission time and the transmission timestamp of reply data bag in this step, right Synchronizer current time is corrected, to be allowed to keep consistent with the time of described target device.
In the embodiment of the present application, synchronizer sends time synchronized request to target device, receives described mesh Marking device return comprise send timestamp reply data bag, determine from send out described time synchronized please Ask and receive the transmission time that described reply data bag is spent, according to default time error scope and Fall into the expected probability of this time error scope, determine transmission time threshold, it is judged that the described transmission time is No less than described transmission time threshold;If so, according to described transmission time and the described very first time, correction The time of described synchronizer, to be allowed to keep consistent with the time of described target device.As can be seen here, The application is when correcting the time of synchronizer, it is contemplated that sends time synchronized and asks to receiving reply data Wrap the transmission time of this process, and the transmission timestamp of the reply data bag of target device return.This Application note and the impact of transmission time so that the time of the synchronizer finally determined is more accurate.
Further, the application is general according to default time error scope and the expectation falling into this time error scope Rate, determines transmission time threshold, and utilizes this transmission time threshold to choose the transmission time meeting condition. It is easy to user flexibility and controls the precision of time synchronized and the time-consuming of time synchronization process.
Optionally, synchronizer determines that the process of transmission time can have multiple way of realization, such as:
The transmission timestamp of time synchronized request described in synchronizer record, and, record described answer number Reception timestamp according to bag.
Wherein, the transmission timestamp of described time synchronized request is, and synchronizer sends time synchronized please The time asked.The reception timestamp of reply data bag is, and synchronizer receives the time of reply data bag.
Based on this, synchronizer according to record described time synchronized request transmission timestamp and described should Answer the difference receiving timestamp of packet, determine the transmission time.
The timestamp that receives of reply data bag deducts the transmission timestamp of time synchronized request, when being transmission Between.
For another example,
Synchronizer, while sending time synchronized request to target device, starts timer, initially opens Time dynamic, timer reading is zero.
Synchronizer, while receiving the reply data bag that described target device returns, terminates described timing Device.
Based on this, synchronizer can determine transmission according to the timing result of the described timer after terminating Time.That is, the reading of timer after synchronizer will terminate is defined as the transmission time.
Present inventor is by the research to transmission time RTT, when finding the size pair of transmission time RTT Between synchronization accuracy produce certain impact.Now the research process of inventor is introduced.
In this application, it is assumed that:
:
RTT → 0 (i.e. RTT level off to 0),
Time:
(t1-t2)≈0
It is to say, when RTT level off to 0 time, can be considered t1=t2.
This inference can simply be interpreted as: when RTT (t1 and t2 sum) is the least when, it is meant that t1 The least with t2 itself (absolute figure), then the gap (absolute figure) between them is the least.
Simple proof is as follows:
Assuming under real network environment, t1 Yu t2 obeys Stochastic Poisson distribution, then RTT (i.e. t1+t2) Also obeying Poisson distribution, the probability distribution of t1-t2 is as shown in Figure 3.
Can be found out intuitively by Fig. 3, when RTT (i.e. t1+t2) is the least, the probability density curve of (t1-t2) is more " high thin ", i.e. (t1-t2) fall the highest at the probability that (-50ms, 50ms) is interval, i.e. the difference of t1 Yu t2 is more Little.When (t1-t2) falls when (-50ms, 50ms) is interval, it is meant that if by supposing t1=t2=1/2 0.5*RTT calculates, and its error is less than 25ms (10ms rank).
In figure 3 it can be seen that as RTT=500ms, there are about the probability (t1-t2) of 70% fall (-50ms, 50ms) in interval, at RTT=1000ms, this probability is only less than 50%.
Understand based on above-mentioned introduction, when transmission time RTT more hour, the probability of t1=t2 is the highest, therefore this When application synchronizer corrects synchronizer according to the transmission timestamp of transmission time RTT with reply data bag Between process may is that
Synchronizer is by described transmission time RTT and the product setting coefficient a, with described reply data bag Transmission timestamp is added, and addition result is defined as the time of synchronizer.
Wherein, setting coefficient a can be preferably 0.5, and it can also is that other numerical value certainly, the value of a Scope can be (0,1].
Owing to the transmission time is the least, the time that correction of a final proof obtains is the most accurate, may determine that for this application Transmission time threshold, determining the transmission time less than time when setting transmission time threshold just based on described transmission Between and the transmission timestamp of described reply data bag, the time of correction synchronizer.
The above embodiments of the present application are it is stated that can be according to default time error scope with when falling into this Between the expected probability of range of error determine transmission time threshold.It follows that to determining transmission time threshold Process is introduced.
For the ease of statement, the application define the transmission time include described time synchronized ask from described synchronization Equipment sends the first transmission sub-time spent to described target device, and described reply data bag is from described Target device sends the second transmission sub-time spent to described synchronizer.First transmission sub-time is permissible Regarding above-mentioned t1 as, the second transmission sub-time was considered as above-mentioned t2.
Then determine that the process of transmission time threshold may refer to Fig. 4.
As shown in Figure 4, this process includes:
Step S400, the function distribution obeyed according to the transmission time, determine under the different transmission time first Transmit the probability density function of sub-time and the second difference transmitting the sub-time;
Specifically, transmission time, the first transmission sub-time, the second transmission sub-time all obey identical letter Number distribution, such as Poisson distribution.The application may determine that under a series of different transmission time, the first transmission The sub-time and second transmits the probability density function of the difference of sub-time.Probability density function illustrates difference And the corresponding relation between probit.
Step S410, substitute into each probability density function with described default time error scope, calculate the time The probit that range of error is corresponding;
Specifically, in the present embodiment with time error scope for (x, y) as a example by, then with time error x and Y transmits sub-time and the second difference transmitting the sub-time respectively as first, by each probability density letter Number may determine that the probit that time error scope is corresponding.
Wherein, the probit calculated by different probability density functions is different.
Step S420, determine that calculated probit exceedes the probability density function of default expected probability The corresponding transmission time, and therefrom choose the transmission time of maximum as transmission time threshold.
Specifically, the application user can preset the expected probability of the time error scope falling into setting, And then based on multiple probits that previous step draws, choose the probability density function institute exceeding expected probability The corresponding transmission time.And therefrom choose the transmission time of maximum as transmission time threshold.
It is understood that if the transmission time is less than transmission time threshold, then time error falls into setting The expected probability of time error scope is greater than setting expected probability.
Poisson distribution, the transmission timestamp of correction time=reply data bag is obeyed with transmission time RTT Illustrate as a example by+0.5RTT.
The application may determine that under a series of different transmission time RTT, first transmits sub-time t1 and second Transmit the probability density function of the difference of sub-time t2.
See Fig. 3, when present application illustrates RTT=500ms, 1000ms, 2000ms, the probability of t1-t2 The curve that density function is corresponding.
Assuming that the time error scope of user preset is (-50ms, 50ms), and error falls into this time by mistake The expected probability of difference scope is 70%.
Then by time error scope (-50ms, 50ms) is substituted into three probability density letters shown in Fig. 3 In number, can be calculated:
During RTT=500ms, the probit that (-50ms, 50ms) is corresponding is 71%;
During RTT=1000ms, the probit that (-50ms, 50ms) is corresponding is 50%;
During RTT=2000ms, the probit that (-50ms, 50ms) is corresponding is 35%.
It follows that when RTT=500ms, the probit that (-50ms, 50ms) is corresponding exceedes the setting phase Hope probit, and relatively expected probit, when therefore, it can choose RTT=500ms as transmission Between threshold value.Determine the transmission time less than 500ms time, according to target device feedback reply data bag send out Send timestamp, and transmission time RTT, calculate correction time: the transmission timestamp of reply data bag adds 0.5RTT。
It follows that time error scope and error that the application sets based on user fall into this time error The expected probability of scope determines transmission time threshold, and then utilizes this transmission time threshold to time synchronized mistake The transmission time that journey determines screens.The application scheme is easy to user flexibility and is controlled the precision of time synchronized Time-consuming with time synchronization process.
In order to verify the degree of accuracy of the application time synchronized, now illustrate with the scene of multi-person interactive film.
The server providing interactive movie content enters with server as standard time source, multiple synchronizers Row time synchronized.The present embodiment includes desktop computer, notebook, Android mobile phone and Fructus Mali pumilae with synchronizer Illustrate as a example by mobile phone.Wherein, aforementioned four synchronizer under different network environments (cable network, Wireless network, mobile network), carry out time synchronized, a certain moment, service according to the scheme of the application 41 points 15 seconds 8,41 points 15 seconds when the time after each synchronizer time synchronized is also 16 when the device time is 16 8.Time between each synchronizer can be maintained at the synchronization accuracy within 0.1 second, in other words, error Rank is ten milliseconds of ranks, and compared to the other error of hundreds of Millisecond of prior art, its precision obtains It is greatly promoted.
The time synchronism apparatus provided the embodiment of the present application below is described, and the time described below is same Step device can be mutually to should refer to above-described method for synchronizing time.
Seeing Fig. 5, Fig. 5 is a kind of time synchronism apparatus structural representation disclosed in the embodiment of the present application.
As it is shown in figure 5, this device includes:
Synchronization request transmitting element 51, for sending time synchronized request to target device;
Reply data bag receive unit 52, for receive described target device return comprise transmission timestamp Reply data bag;
Described transmission timestamp is the time for carrying out time synchronized that described target device determines.
Optionally, sending timestamp can be the time that target device receives the request of described time synchronized, also It can be the time obtained after target device time of receipt (T of R) synchronization request union.
It is understood that in order to reduce network time, the size of reply data bag can be reduced.Such as, Transmission timestamp is placed on the header part of reply data bag, the main part of reply data bag is left a blank, To reduce the transmission time of reply data bag.
The transmission time determines unit 53, is used for determining and asks to receive institute from sending out described time synchronized State the transmission time that packet is spent;
Specifically, the time receiving described reply data bag and the time sending the request of described time synchronized Difference is transmission time RTT.
Transmission time threshold determines unit 54, is used for according to the time error scope preset and falls into this time The expected probability of range of error, determines transmission time threshold;
Threshold decision unit 55, is used for judging that whether the described transmission time is less than described transmission time threshold;
Determine unit 56 correction time, be used for when the judged result of described threshold decision unit 54 is for being, According to described transmission time and the transmission timestamp of described reply data bag, correct described synchronizer time Between, to be allowed to keep consistent with the time of described target device.
It is understood that the described transmission time includes that the request of described time synchronized is sent out from described synchronizer Deliver to the first transmission sub-time that described target device spends, and described reply data bag sets from described target Preparation delivers to the second transmission sub-time that described synchronizer spends.
It is understood that when the judged result of described threshold decision unit 55 is no, can trigger and hold The described synchronization request transmitting element 51 of row.
Optionally, described transmission time threshold determines that unit may include that
Probability density function determines unit, for the function distribution obeyed according to the transmission time, determines not With the under the transmission time first probability density function transmitting sub-time and the second difference transmitting the sub-time;
Probit computing unit, for substituting into each probability density function with described default time error scope, Calculate the probit that time error scope is corresponding;
The transmission time chooses unit, for determining that calculated probit exceedes default expected probability The transmission time corresponding to probability density function, and therefrom choose the transmission time of maximum as transmission Time threshold.
Optionally, the time synchronism apparatus of the application can also include:
Time record unit, for recording the transmission timestamp of described time synchronized request;And, record The reception timestamp of described packet;
Based on this, the described transmission time determines that unit may include that
First transmission time determined subelement, when the transmission of the described time synchronized request according to record Between stamp and described reply data bag receive timestamp difference, determine the transmission time.
Optionally, the time synchronism apparatus of the application can also include:
Chronograph control unit, for, while sending time synchronized request to target device, starting meter Time device, during initial start, timer reading is zero;Receiving the reply data bag that described target device returns While, terminate described timer;
Based on this, the described transmission time determines that unit may include that
Second transmission time determined subelement, for the timing result according to the described timer after terminating, Determine the transmission time.
Optionally, determine that unit may include that above-mentioned correction time
First correction time determined subelement, for by the described transmission time with set coefficient product, with The transmission timestamp of described reply data bag is added, and addition result is defined as the time of described synchronizer.
Wherein, setting coefficient can be 0.5.
For the hardware configuration of above-mentioned synchronizer, see Fig. 6, Fig. 6 for the embodiment of the present application provide same The hardware architecture diagram of step equipment.As shown in Figure 6, this synchronizer may include that
Processor 1, communication interface 2, memorizer 3, communication bus 4, and display screen 5;
Wherein processor 1, communication interface 2, memorizer 3 and display screen 5 complete phase by communication bus 4 Communication between Hu;
Optionally, communication interface 2 can be the interface of communication module, such as the interface of gsm module;
Processor 1, is used for performing program;
Memorizer 3, is used for depositing program;
Program can include that program code, described program code include the operational order of processor.
Processor 1 is probably a central processor CPU, or specific integrated circuit ASIC (Application Specific Integrated Circuit), or be configured to implement the embodiment of the present application One or more integrated circuits.
Memorizer 3 may comprise high-speed RAM memorizer, it is also possible to also includes nonvolatile memory (non-volatile memory), for example, at least one disk memory.
Wherein, program can be specifically for:
Time synchronized request is sent to target device;
Receive the reply data bag comprising transmission timestamp that described target device returns;
Determine and ask to receive the transmission that described reply data bag is spent from sending out described time synchronized Time;
According to default time error scope and the expected probability falling into this time error scope, determine transmission Time threshold;
Judge that whether the described transmission time is less than described transmission time threshold;
If so, according to described transmission time and the transmission timestamp of described reply data bag, correct described same The time of step equipment.
Finally, in addition it is also necessary to explanation, in this article, the relational terms of such as first and second or the like It is used merely to separate an entity or operation with another entity or operating space, and not necessarily requires Or imply relation or the order that there is any this reality between these entities or operation.And, art Language " includes ", " comprising " or its any other variant are intended to comprising of nonexcludability, thus Make to include that the process of a series of key element, method, article or equipment not only include those key elements, and Also include other key elements being not expressly set out, or also include for this process, method, article or The key element that person's equipment is intrinsic.In the case of there is no more restriction, by statement " including ... " The key element limited, it is not excluded that also deposit in including the process of described key element, method, article or equipment In other identical element.
In this specification, each embodiment uses the mode gone forward one by one to describe, and each embodiment stresses Being the difference with other embodiments, between each embodiment, identical similar portion sees mutually.
Described above to the disclosed embodiments, makes professional and technical personnel in the field be capable of or uses The application.Multiple amendment to these embodiments will be aobvious and easy for those skilled in the art See, generic principles defined herein can in the case of without departing from spirit herein or scope, Realize in other embodiments.Therefore, the application is not intended to be limited to the embodiments shown herein, And it is to fit to the widest scope consistent with principles disclosed herein and features of novelty.

Claims (14)

1. a method for synchronizing time, it is characterised in that be applied to synchronizer, the method includes:
Time synchronized request is sent to target device;
Receive the reply data bag comprising transmission timestamp that described target device returns;
Determine and ask to receive the transmission that described reply data bag is spent from sending out described time synchronized Time;
According to default time error scope and the expected probability falling into this time error scope, determine transmission Time threshold;
Judge that whether the described transmission time is less than described transmission time threshold;
If so, according to described transmission time and the transmission timestamp of described reply data bag, correct described same The time of step equipment.
Method the most according to claim 1, it is characterised in that when the described transmission time includes described Between synchronization request from described synchronizer send to described target device spend first transmission the sub-time, and Described reply data bag sends the second transmission period of the day from 11 p.m. to 1 a.m spent to described synchronizer from described target device Between;
The time error scope that described basis is preset and the expected probability falling into this time error scope, determine The step of transmission time threshold, including:
The function distribution obeyed according to the transmission time, determines the first transmission sub-time under the different transmission time Probability density function with the second difference transmitting the sub-time;
Substitute into each probability density function with described default time error scope, calculate time error scope pair The probit answered;
Determine that calculated probit exceedes the biography corresponding to the probability density function of default expected probability The defeated time, and therefrom choose the transmission time of maximum as transmission time threshold.
Method the most according to claim 1, it is characterised in that also include:
Record the transmission timestamp of described time synchronized request;And,
Record the reception timestamp of described reply data bag;
Described determine ask to receive what described reply data bag was spent from sending out described time synchronized The transmission time, including:
During the reception sending timestamp and described reply data bag that the described time synchronized according to record is asked Between stamp difference, determine the transmission time.
Method the most according to claim 1, it is characterised in that also include:
While sending time synchronized request to target device, start timer, timing during initial start Device reading is zero;
While receiving the reply data bag that described target device returns, terminate described timer;
Described determine ask to receive what described reply data bag was spent from sending out described time synchronized The transmission time, including:
According to the timing result of the described timer after terminating, determine the transmission time.
Method the most according to claim 1, it is characterised in that also include:
When judging that the described transmission time is not less than described transmission time threshold, trigger described to target device Send the operation of time synchronized request.
6. according to the method described in any one of claim 1-5, it is characterised in that described according to described biography Defeated time and the transmission timestamp of described reply data bag, correct the time of described synchronizer, including:
By described transmission time and the product setting coefficient, with the transmission timestamp phase of described reply data bag Adding, addition result is defined as the time of described synchronizer.
Method the most according to claim 6, it is characterised in that the described coefficient that sets is as 0.5.
8. a time synchronism apparatus, it is characterised in that be applied to synchronizer, this device includes:
Synchronization request transmitting element, for sending time synchronized request to target device;
Reply data bag receives unit, sends timestamp for receiving comprising of described target device return Reply data bag;
The transmission time determines unit, is used for determining and asks to receive described from sending out described time synchronized The transmission time that reply data bag is spent;
Transmission time threshold determines unit, is used for according to the time error scope preset and falls into this time by mistake The expected probability of difference scope, determines transmission time threshold;
Threshold decision unit, is used for judging that whether the described transmission time is less than described transmission time threshold;
Correction time determines unit, is used for when the judged result of described threshold decision unit is for being, according to Described transmission time and the transmission timestamp of described reply data bag, correct the time of described synchronizer.
Device the most according to claim 8, it is characterised in that when the described transmission time includes described Between synchronization request from described synchronizer send to described target device spend first transmission the sub-time, and Described reply data bag sends the second transmission period of the day from 11 p.m. to 1 a.m spent to described synchronizer from described target device Between;
Described transmission time threshold determines that unit includes:
Probability density function determines unit, for the function distribution obeyed according to the transmission time, determines not With the under the transmission time first probability density function transmitting sub-time and the second difference transmitting the sub-time;
Probit computing unit, for substituting into each probability density function with described default time error scope, Calculate the probit that time error scope is corresponding;
The transmission time chooses unit, for determining that calculated probit exceedes default expected probability The transmission time corresponding to probability density function, and therefrom choose the transmission time of maximum as transmission Time threshold.
Device the most according to claim 8, it is characterised in that also include:
Time record unit, for recording the transmission timestamp of described time synchronized request;And, record The reception timestamp of described reply data bag;
The described transmission time determines that unit includes:
First transmission time determined subelement, when the transmission of the described time synchronized request according to record Between stamp and described reply data bag receive timestamp difference, determine the transmission time.
11. devices according to claim 8, it is characterised in that also include:
Chronograph control unit, for, while sending time synchronized request to target device, starting meter Time device, during initial start, timer reading is zero;Receiving the reply data bag that described target device returns While, terminate described timer;
The described transmission time determines that unit includes:
Second transmission time determined subelement, for the timing result according to the described timer after terminating, Determine the transmission time.
12. devices according to claim 8, it is characterised in that at described threshold decision unit When judged result is no, triggers and perform described synchronization request transmitting element.
13. devices described in-12 any one according to Claim 8, it is characterised in that described correction time Determine unit, including:
First correction time determined subelement, for by the described transmission time with set coefficient product, with The transmission timestamp of described reply data bag is added, and addition result is defined as the time of described synchronizer, Wherein, the described coefficient that sets is as 0.5.
14. 1 kinds of clock synchronization systems, it is characterised in that include at least one synchronizer and at least one Individual target device, the clock of described target device is standard time clock;
Described synchronizer is used for, and sends time synchronized request to described target device;Receive described target What equipment returned comprises the reply data bag sending timestamp;Determine from sending out the request of described time synchronized To receiving the transmission time that described packet is spent;According to default time error scope and fall into this The expected probability of time error scope, determines transmission time threshold;Judge whether the described transmission time is less than Described transmission time threshold;If so, according to described transmission time and the transmission time of described reply data bag Stamp, corrects the time of described synchronizer;
Described target device is used for, when receiving the time synchronized request that described synchronizer sends, according to Self current time determines transmission timestamp, returns to described synchronizer and comprises described transmission timestamp Reply data bag.
CN201610539966.1A 2016-07-08 2016-07-08 A kind of method for synchronizing time, apparatus and system Active CN105915308B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610539966.1A CN105915308B (en) 2016-07-08 2016-07-08 A kind of method for synchronizing time, apparatus and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610539966.1A CN105915308B (en) 2016-07-08 2016-07-08 A kind of method for synchronizing time, apparatus and system

Publications (2)

Publication Number Publication Date
CN105915308A true CN105915308A (en) 2016-08-31
CN105915308B CN105915308B (en) 2018-04-27

Family

ID=56754570

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610539966.1A Active CN105915308B (en) 2016-07-08 2016-07-08 A kind of method for synchronizing time, apparatus and system

Country Status (1)

Country Link
CN (1) CN105915308B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106788957A (en) * 2016-12-30 2017-05-31 广州华多网络科技有限公司 A kind of method and device of check timer time error
CN107171763A (en) * 2017-07-05 2017-09-15 北京蓝海讯通科技股份有限公司 A kind of time processing method based on time migration, device and mobile terminal
CN109565772A (en) * 2018-10-31 2019-04-02 深圳市汇顶科技股份有限公司 Method for synchronizing time, equipment and storage medium
CN109765578A (en) * 2019-02-19 2019-05-17 武汉元光科技有限公司 Bus GPS equipment clock calibration method and device
CN110071778A (en) * 2019-04-24 2019-07-30 江苏紫米软件技术有限公司 A kind of time synchronization method, device, equipment and medium
WO2019228221A1 (en) * 2018-05-31 2019-12-05 华为技术有限公司 Clock synchronization method and apparatus, terminal device, chip, and readable storage medium
CN111083309A (en) * 2018-10-18 2020-04-28 北京初速度科技有限公司 Time alignment method of multi-sensor data and data acquisition equipment
CN112154614A (en) * 2019-08-29 2020-12-29 上海飞来信息科技有限公司 Sensing system, sensing apparatus, control method thereof, movable platform, and storage medium
CN112532334A (en) * 2021-02-18 2021-03-19 北京拓课网络科技有限公司 Time synchronization method and device and electronic equipment
CN113507338A (en) * 2021-07-22 2021-10-15 深圳市灰度科技有限公司 Time synchronization method and device, computer equipment and storage medium
WO2023130217A1 (en) * 2022-01-04 2023-07-13 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for radio over ethernet

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010212945A (en) * 2009-03-10 2010-09-24 Nec Corp Receiving-side node for clock synchronization, method thereof and program thereof
CN101960755A (en) * 2008-01-25 2011-01-26 皮尔茨公司 Method and device for transmitting data in a network
CN102739626A (en) * 2011-04-12 2012-10-17 索尼公司 Method and device for time synchronization, time stamping device and trusted time server
CN103220120A (en) * 2012-01-20 2013-07-24 腾讯科技(深圳)有限公司 Time synchronizing method of mobile terminal, mobile terminal and time synchronizing system
CN105577348A (en) * 2014-10-08 2016-05-11 中兴通讯股份有限公司 Frequency offset monitoring method and frequency offset monitoring device based on time synchronization network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101960755A (en) * 2008-01-25 2011-01-26 皮尔茨公司 Method and device for transmitting data in a network
JP2010212945A (en) * 2009-03-10 2010-09-24 Nec Corp Receiving-side node for clock synchronization, method thereof and program thereof
CN102739626A (en) * 2011-04-12 2012-10-17 索尼公司 Method and device for time synchronization, time stamping device and trusted time server
CN103220120A (en) * 2012-01-20 2013-07-24 腾讯科技(深圳)有限公司 Time synchronizing method of mobile terminal, mobile terminal and time synchronizing system
CN105577348A (en) * 2014-10-08 2016-05-11 中兴通讯股份有限公司 Frequency offset monitoring method and frequency offset monitoring device based on time synchronization network

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106788957B (en) * 2016-12-30 2022-02-11 广州华多网络科技有限公司 Method and device for correcting time error of timer
CN106788957A (en) * 2016-12-30 2017-05-31 广州华多网络科技有限公司 A kind of method and device of check timer time error
CN107171763A (en) * 2017-07-05 2017-09-15 北京蓝海讯通科技股份有限公司 A kind of time processing method based on time migration, device and mobile terminal
WO2019228221A1 (en) * 2018-05-31 2019-12-05 华为技术有限公司 Clock synchronization method and apparatus, terminal device, chip, and readable storage medium
CN111083309A (en) * 2018-10-18 2020-04-28 北京初速度科技有限公司 Time alignment method of multi-sensor data and data acquisition equipment
CN111083309B (en) * 2018-10-18 2022-04-01 北京魔门塔科技有限公司 Time alignment method of multi-sensor data and data acquisition equipment
CN109565772A (en) * 2018-10-31 2019-04-02 深圳市汇顶科技股份有限公司 Method for synchronizing time, equipment and storage medium
WO2020087370A1 (en) * 2018-10-31 2020-05-07 深圳市汇顶科技股份有限公司 Method and device for time synchronization, and storage medium
CN109765578A (en) * 2019-02-19 2019-05-17 武汉元光科技有限公司 Bus GPS equipment clock calibration method and device
CN109765578B (en) * 2019-02-19 2020-11-03 武汉元光科技有限公司 Bus GPS equipment clock calibration method and device
CN110071778A (en) * 2019-04-24 2019-07-30 江苏紫米软件技术有限公司 A kind of time synchronization method, device, equipment and medium
CN110071778B (en) * 2019-04-24 2021-03-23 江苏紫米软件技术有限公司 Time synchronization method, device, equipment and medium
CN112154614A (en) * 2019-08-29 2020-12-29 上海飞来信息科技有限公司 Sensing system, sensing apparatus, control method thereof, movable platform, and storage medium
CN112154614B (en) * 2019-08-29 2023-02-21 上海飞来信息科技有限公司 Sensing system, sensing apparatus, control method thereof, movable platform, and storage medium
CN112532334B (en) * 2021-02-18 2021-05-04 北京拓课网络科技有限公司 Time synchronization method and device and electronic equipment
CN112532334A (en) * 2021-02-18 2021-03-19 北京拓课网络科技有限公司 Time synchronization method and device and electronic equipment
CN113507338A (en) * 2021-07-22 2021-10-15 深圳市灰度科技有限公司 Time synchronization method and device, computer equipment and storage medium
WO2023130217A1 (en) * 2022-01-04 2023-07-13 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for radio over ethernet

Also Published As

Publication number Publication date
CN105915308B (en) 2018-04-27

Similar Documents

Publication Publication Date Title
CN105915308A (en) Time synchronization method, device and system
US20050033947A1 (en) Multiprocessor system with interactive synchronization of local clocks
US20120319997A1 (en) Scalable distributed/cooperative/collaborative paradigm for multi-user interaction with projection-based display walls
KR920701895A (en) Time synchronizer of data in computer system
CN109327899A (en) A kind of method, apparatus and system synchronization time of mobile unit synchronization time
CN111596721B (en) Data time tag synchronization method and device
US4646291A (en) Synchronization apparatus in transmitting information on a simplex bus
CN112154669A (en) Correlation of video stream frame timestamps based on system clock
CN104641589A (en) Correction parameter calculation device and system, correction parameter calculation method, and computer program
CN112463326A (en) Simulation propulsion method, device, equipment and medium for continuous discrete hybrid system
US7330488B2 (en) System, method, and article of manufacture for synchronizing time of day clocks on first and second computers
CN112448874B (en) Vehicle-mounted communication device and time synchronization method thereof
CN107613012A (en) A kind of multiple terminals synchronizing web pages clocking method and system
CN110636603A (en) Aircraft time synchronization system and method
US20200382233A1 (en) Information processing apparatus and time synchronization method
EP3082282A1 (en) Method for time synchronization
JP6066881B2 (en) Information processing system, information processing apparatus, information processing method, and program
US8509751B2 (en) System and method of object simulation in an intermittently connected mobile application
CN110809041B (en) Data synchronization method and device, electronic equipment and storage medium
CN106533598B (en) Circuit and method for estimating occurrence time difference between events, and computer-readable storage medium
CN110672069A (en) Satellite imaging method and system
CN105933877B (en) The time adjusting method and device of terminal
JP2001338400A (en) Flight track distribution system
CN113259039A (en) Time synchronization method and device, computer equipment and storage medium
CN113672682B (en) Synchronous frame based quantity synchronization method and synchronization device

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