CN106341218A - Clock synchronization method and device based on windows operating system - Google Patents

Clock synchronization method and device based on windows operating system Download PDF

Info

Publication number
CN106341218A
CN106341218A CN201510391243.7A CN201510391243A CN106341218A CN 106341218 A CN106341218 A CN 106341218A CN 201510391243 A CN201510391243 A CN 201510391243A CN 106341218 A CN106341218 A CN 106341218A
Authority
CN
China
Prior art keywords
message
clock
packet capturing
clock equipment
timestamp
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
CN201510391243.7A
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.)
Beijing Dongtu Jinyue Technology Co Ltd
Original Assignee
Beijing Dongtu Jinyue Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dongtu Jinyue Technology Co Ltd filed Critical Beijing Dongtu Jinyue Technology Co Ltd
Priority to CN201510391243.7A priority Critical patent/CN106341218A/en
Publication of CN106341218A publication Critical patent/CN106341218A/en
Pending legal-status Critical Current

Links

Abstract

The invention provides a clock synchronization method and device based on a windows operating system. The clock synchronization method comprises the steps of capturing a synchronization packet sent by master clock equipment by using pre-installed packet capturing software, and recording a capturing timestamp T2; parsing a transmission timestamp T1 carried in the synchronization packet for transmitting the synchronization packet of the master clock equipment; packaging a time delay request packet by using the packet capturing software, transmitting the packaged time delay request packet to the master clock equipment, and recording a packaging timestamp T3; capturing a time delay response packet by using the packet capturing software, and parsing a transmitting timestamp T4 carried in the time delay response packet for transmitting the time delay response packet of the master clock equipment; and calculating clock skew of slave clock equipment and the master clock equipment according to the timestamps T1, T2, T3 and T4, and time calibration is carried out on the slave clock equipment according to the clock skew. According to the invention, timestamp parameters required by time synchronization are acquired through the packet capturing software, and extra hardware is not required to be added to the slave clock equipment, so that hardware resources are saved, and the cost is reduced.

Description

A kind of clock synchronizing method based on windows operating system and device
Technical field
The present invention relates to networking technology area, more particularly, to a kind of clock based on windows operating system is together One step process and device.
Background technology
Ieee1588 agreement is a kind of accurate clock synchronization protocol set up on the basis of message, based on ptp Agreement (precision timing protocol, precision time protocol) is disappeared in master clock between clock Breath transmission, can realize exact time synchronization and Frequency Synchronization in the network of packet transmission.Its medium frequency is same Step refers to the particular kind of relationship that frequency or phase place are occurred with same Mean Speed in corresponding significant instant, thus tieing up All of equipment in communication network of holding is run with identical speed.Clock synchronously refers to the frequency phase between signal With, and be consistent in phase place.
Ieee1588 agreement is mainly used in EPA, by the switch in EPA or industry Equipment as clock equipment, the equipment of windows operating system as from clockwork, from clockwork Set time based on ieee1588 agreement and clock equipment, thus reach setting with master clock from clockwork The synchronous purpose of standby clock.
The equipment of existing windows operating system is this not to be possessed for receiving main equipment from clockwork The sync message sending stamps reception timestamp, the latency request message being sent to clock equipment is stamped and sends out Send the function of timestamp, at present, realize the side of when clockwork is with clock equipment pair (clock is synchronous) Case is:
Hardware from clockwork (equipment of windows operating system) is improved, such as adds Fpga module or phy chip, thus stamped for above-mentioned message using fpga module or phy chip Timestamp, so that calculate master-salve clock from clockwork according to each timestamp ieee1588 set Time deviation between standby, so make from clockwork according to this time deviation and clock equipment carry out right When.
But, this scheme realized when clockwork is with clock equipment pair, need to increase from clock Hardware in equipment, the hardware that these increase may not reuse, thus leading to hardware resource waste, And when from clockwork quantity more when, when each from clockwork be required for increase hardware when, relatively costly.
Content of the invention
The present invention provides a kind of clock synchronizing method based on windows operating system and device, for solving The hardware resource waste brought based on the clock synchronizing method of windows operating system of the prior art, is become This higher problem.
A kind of clock synchronizing method based on windows operating system, comprising:
Utilize the sync message of preassembled packet capturing software grabs clock equipment transmission from clockwork, and Record captures the crawl timestamp t2 of described sync message, described from the operating system of clockwork is Windows operating system;
When parsing the transmission that the described clock equipment carrying in described sync message sends described sync message Between stab t1;
It is sent to master using described packet capturing software by after the latency request message encapsulation for described sync message Clockwork, and record the packaging time stamp t3 encapsulating described latency request message;
It is directed to prolonging of described latency request message return using clock equipment described in described packet capturing software grabs When response message, and parse the described clock equipment carrying in described time delay response message and send described time delay The transmission timestamp t4 of response message;
According to described t1, t2, t3 and t4, calculate the clock jitter from clockwork and clock equipment, And set time to from clockwork according to this clock jitter.
In methods described, using the sync message of preassembled packet capturing software grabs clock equipment transmission, And record the crawl timestamp t2 capturing described sync message, specifically include:
Capture the first message that clock equipment sends using preassembled packet capturing software cycle, described the One message carries the crawl timestamp capturing described first message;
When determining described first message for sync message, record captures the crawl timestamp of described sync message t2;
It is directed to prolonging of described latency request message return using clock equipment described in described packet capturing software grabs When response message, and parse the described clock equipment carrying in described time delay response message and send described time delay The transmission timestamp t4 of response message, specifically includes:
Capture the first message that clock equipment sends using described packet capturing software cycle, the first message carries Capture the crawl timestamp of described first message;
When determining described first message for described time delay response message, parse in described time delay response message and carry Described clock equipment send the transmission timestamp t4 of described time delay response message.
The embodiment of the present invention utilizes the first message of packet capturing software grabs, can obtain from clockwork and master clock Timestamp parameter necessary to equipment room clock synchronization.
Methods described, after being encapsulated the latency request message for described sync message using described packet capturing software It is sent to clock equipment, and record the packaging time stamp t3 encapsulating described latency request message, concrete bag Include:
It is sent to clock equipment after described latency request message being encapsulated using preassembled packet capturing software, The packaging time stamp t3 encapsulating described latency request message is carried in latency request message after described encapsulation;
The packaging time stamp t3 carrying in latency request message after the described encapsulation of parsing, and record described envelope ETL estimated time of loading stabs t3.
The embodiment of the present invention utilizes the first message of packet capturing software grabs, can obtain from clockwork and master clock Timestamp parameter necessary to equipment room clock synchronization.
In methods described, according to this clock jitter to after clockwork sets time, also include:
Periodically restart described packet capturing software;Or
The clock jitter between clockwork and described packet capturing software after during determination pair is more than given threshold When, restart described packet capturing software.
After this preferred embodiment is when from clockwork pair, by restarting packet capturing software, make packet capturing software with from Clockwork clock is synchronous, can avoid to a certain extent due between clockwork and described packet capturing software The asynchronous problem that precision reduces when clockwork is with clock equipment pair brought of clock.
In methods described, described first message is ieee1588 message, then utilize preassembled packet capturing soft Part periodically captures the first message that clock equipment sends, and specifically includes:
Periodically capture clock equipment using the Hook Function in described preassembled packet capturing software to send Message;
Filter out ieee1588 message from the message that described clock equipment sends.
The embodiment of the present invention, periodically captures clock equipment by the Hook Function in packet capturing software and sends Message, and for crawl clock equipment send message screened, thus filtering out ieee1588 Message, i.e. the first message.
The present invention also provides a kind of clock synchronization apparatus based on windows operating system, comprising:
Handling module, for the synchronization report being sent using preassembled packet capturing software grabs clock equipment Literary composition, and record the crawl timestamp t2 capturing described sync message, the described operating system from clockwork For windows operating system;
Parsing module, sends described synchronization for parsing the described clock equipment carrying in described sync message The transmission timestamp t1 of message;
Transmitting element, for being sealed the latency request message for described sync message using described packet capturing software It is sent to clock equipment after dress, and record the packaging time stamp t3 encapsulating described latency request message;
Described handling module is additionally operable to, and is directed to described prolonging using clock equipment described in described packet capturing software grabs When request message return time delay response message, and parse carry in described time delay response message described main when Clock equipment sends the transmission timestamp t4 of described time delay response message;
Pair when module, according to described t1, t2, t3 and t4, calculate from clockwork and clock equipment Clock jitter, and set time to from clockwork according to this clock jitter.
In described device, described handling module specifically for:
Capture the first message that clock equipment sends using preassembled packet capturing software cycle, described the One message carries the crawl timestamp capturing described first message;
When determining described first message for sync message, record captures the crawl timestamp of described sync message t2;
Described handling module is additionally operable to:
Capture the first message that clock equipment sends using described packet capturing software cycle, the first message carries Capture the crawl timestamp of described first message;
When determining described first message for described time delay response message, parse in described time delay response message and carry Described clock equipment send the transmission timestamp t4 of described time delay response message.
In described device, described transmitting element specifically for:
It is sent to clock equipment after described latency request message being encapsulated using preassembled packet capturing software, The packaging time stamp t3 encapsulating described latency request message is carried in latency request message after described encapsulation;
The packaging time stamp t3 carrying in latency request message after the described encapsulation of parsing, and record described envelope ETL estimated time of loading stabs t3.
In described device, when described pair, module is additionally operable to:
Periodically restart described packet capturing software;Or
The clock jitter between clockwork and described packet capturing software after during determination pair is more than given threshold When, restart described packet capturing software.
Described device, when described first message is ieee 1588 message, then described handling module is utilizing When preassembled packet capturing software cycle captures the first message that clock equipment sends, specifically for:
Periodically capture clock equipment using the Hook Function in described preassembled packet capturing software to send Message;
Filter out ieee 1588 message from the message that described clock equipment sends.
Using the clock synchronizing method based on windows operating system provided in an embodiment of the present invention and device, Have the advantages that do not need extra hard in installing from clockwork of windows operating system Part, can get the timestamp parameter required for clock synchronization by preassembled packet capturing software, thus root Realize the clock synchronization between clockwork and clock equipment according to timestamp parameter, and then save hardware money Source, and a packet capturing software can be installed and used from clockwork in multiple stage, thus reducing to a certain extent Cost.
Brief description
Fig. 1 is the clock synchronizing method flow process based on windows operating system provided in an embodiment of the present invention Figure;
Fig. 2 is crawl sync message provided in an embodiment of the present invention the method flow recording crawl timestamp Figure;
Fig. 3 is encapsulation latency request message provided in an embodiment of the present invention the method stream recording packaging time stamp Cheng Tu;
Fig. 4 is crawl time delay response message provided in an embodiment of the present invention the transmission timestamp obtaining this message Method flow diagram;
Fig. 5 captures this ie1588 report for provided in an embodiment of the present invention when the first message is ieee1588 The method flow diagram of literary composition;
Fig. 6 is that the clock synchronization apparatus based on windows operating system provided in an embodiment of the present invention are illustrated Figure.
Specific embodiment
Clock synchronizing method based on windows operating system provided in an embodiment of the present invention and device are bases In clock synchronizing method and the device of ieee1588 agreement, with reference to the accompanying drawings and examples the present invention is carried For the clock synchronizing method based on windows operating system and device be described in detail.
The embodiment of the present invention provides a kind of clock synchronizing method based on windows operating system, as Fig. 1 institute Show, comprising:
Step 101, utilizes the same of preassembled packet capturing software grabs clock equipment transmission from clockwork Step message, and record the crawl timestamp t2 capturing described sync message, the described operation from clockwork System is windows operating system.
Specifically, it is windows operating system from the operating system of clockwork, from clockwork can be Operating system is that the computer of windows operating system can also possess setting of windows operating system for other Standby, do not limit here.Clock equipment is switch or other industry in EPA Equipment, does not limit here.
Preassembled packet capturing software in the embodiment of the present invention can capture the message of clock equipment transmission, Will stamp for this message after the message that this packet capturing software grabs clock equipment sends and grasp at grabbing of this message Take timestamp, specifically, in the message of this packet capturing software grabs, comprise the synchronization of clock equipment transmission (sync) message, the crawl timestamp t2 carrying in the sync message of packet capturing software grabs is as from clock Equipment receives the time of sync message.
Step 102, parses the described clock equipment carrying in described sync message and sends described sync message Transmission timestamp t1.
Specifically, carry clock equipment in the sync message that clock equipment sends and send this sync message Transmission timestamp t1, need to parse this transmission timestamp t1 from clockwork, from can be according to this transmission It is synchronous that timestamp t1 and clock equipment enter row clock.
Step 103, using preassembled packet capturing software by the latency request message for described sync message It is sent to clock equipment after encapsulation, and record the packaging time stamp t3 encapsulating described latency request message.
In prior art, after clockwork receives the sync message of clock equipment transmission, can be same for this Step message sends a latency request message (delay_req).The embodiment of the present invention from clockwork to Before clock equipment forward delay interval request message, in order to obtain sending this latency request message from clockwork Timestamp, using preassembled packet capturing software, this latency request message is packaged, and records encapsulation Latency request message packaging time stamp t3, using this timestamp t3 as from clockwork send this time delay please Seek the timestamp of message.Specifically, this packaging time stamp t3 can be carried in the latency request message after encapsulation.
Step 104, being directed to described time delay using clock equipment described in preassembled packet capturing software grabs please Seek the time delay response message that message returns, and parse the described master clock carrying in described time delay response message and set Preparation send the transmission timestamp t4 of described time delay response message.
Specifically, clock equipment is receiving after the latency request message that clockwork sends, and can be directed to This latency request message returns time delay response message (delay_resp), utilizes preassembled from clockwork This time delay response message of packet capturing software grabs, thus obtain clock equipment by parsing this time delay response message Send the transmission timestamp t4 of this time delay response message.
Step 105, according to described t1, t2, t3 and t4, calculates from clockwork and clock equipment Clock jitter, and set time to from clockwork according to this clock jitter.
Specifically, from clockwork according to timestamp t1, t2, t3 and t4, calculate from clockwork with The clock jitter of clock equipment time, specifically can be counted according to the existing method calculating clock jitter Calculate, repeat no more here.It is right to be carried out according to calculated clock jitter and clock equipment from clockwork When, thus the clock realized between clockwork and clock equipment is synchronous.
The embodiment of the present invention, has obtained reception from clockwork by using packet capturing software grabs sync message same Step message reception timestamp t2, by encapsulate latency request message obtain forward delay interval request message when Between stab t3, by capture time delay response message obtain clock equipment forward delay interval response message transmission when Between stab t4, thus provide from clockwork and clock equipment enter row clock synchronous when requisite when Between stab parameter.
The embodiment of the present invention is it is not necessary to extra hard in installing from clockwork of windows operating system Part, can get the timestamp parameter required for clock synchronization by preassembled packet capturing software, thus root Realize the clock synchronization between clockwork and clock equipment according to timestamp parameter, and then save hardware money Source, and a packet capturing software can be installed and used from clockwork in multiple stage, thus reducing to a certain extent Cost.
Preferably, in step 101, same using the transmission of preassembled packet capturing software grabs clock equipment Step message, and record the crawl timestamp t2 capturing described sync message, as shown in Fig. 2 specifically including:
Step 201, captures, using preassembled packet capturing software cycle, the first report that clock equipment sends Literary composition, described first message carries the timestamp capturing described first message.
Specifically, due to packet capturing software possess crawl packet and for packet stamp capture timestamp work( Can, the embodiment of the present invention is installing packet capturing software from clockwork in advance, using this packet capturing software cycle The first message that crawl clock equipment sends, and stamp the crawl timestamp capturing this first message, wherein, This first message may be for sync message it is also possible to be other messages.
Step 202, when determining described first message for sync message, record captures grabbing of described sync message Take timestamp t2.
Specifically, parsing the first message of packet capturing software grabs from clockwork, and analyze this first message is No for sync message, when being defined as sync message, extract the crawl timestamp t2 capturing this sync message.
The embodiment of the present invention, can beat the work(of timestamp using existing packet capturing software for the packet of crawl Can, obtain capturing the crawl timestamp t2 of sync message, t2 has been received synchronization as from clockwork The reception timestamp of message, thus be before clock between clockwork and clock equipment has simultaneously provided Carry.
Preferably, in step 103, using preassembled packet capturing software by prolonging for described sync message When request message encapsulation after be sent to clock equipment, and when recording the encapsulation encapsulating described latency request message Between stab t3, as shown in figure 3, specifically including:
Step 301, is sent to master after encapsulating described latency request message using preassembled packet capturing software Clockwork, carries when encapsulating the encapsulation of described latency request message in the latency request message after described encapsulation Between stab t3.
Step 302, the packaging time stamp t3 carrying in the latency request message after the described encapsulation of parsing, and remember Record described packaging time stamp t3.
Specifically, packet capturing software is packaged to latency request message, and this prolongs to stamp encapsulation in encapsulation process When ask packaging time stamp t3, this packaging time stamp can be used as from clockwork forward delay interval request message Timestamp, from clockwork by parse this encapsulation after latency request message, obtain packaging time stamp T3, this packaging time stamp can be as the transmission timestamp from clockwork forward delay interval request message, thus being Clock between clockwork and clock equipment simultaneously provides premise.
Preferably, in step 104, it is directed to using clock equipment described in preassembled packet capturing software grabs The time delay response message that described latency request message returns, and parse the institute carrying in described time delay response message State the transmission timestamp t4 that clock equipment sends described time delay response message, as shown in figure 4, concrete wrap Include:
Step 401, captures, using preassembled packet capturing software cycle, the first report that clock equipment sends Literary composition, the first message carries the crawl timestamp capturing described first message.
Step 402, when determining described first message for described time delay response message, parsing described time delay response The described clock equipment carrying in message sends the transmission timestamp t4 of described time delay response message.
Parse the first message of packet capturing software grabs from clockwork, and analyze this first message be whether for The time delay response message that described latency request message returns, when determining this time delay response message, is grabbed by parsing The time delay response message of bag software grabs, when can obtain the transmission that clock equipment sends this time delay response message Between stab t4, thus being that clock between clockwork and clock equipment simultaneously provides premise.
Preferably, in step 105, according to this clock jitter to after clockwork sets time, also include:
Periodically restart described packet capturing software;Or
The clock jitter between clockwork and described packet capturing software after during determination pair is more than given threshold When, restart described packet capturing software.
Specifically, rear due to setting time from clockwork, from clockwork, preassembled packet capturing is soft The clock of part will be asynchronous with the clock from clockwork, therefore, periodically restart packet capturing software or, When the clock jitter between clockwork and described packet capturing software after during determination pair is more than given threshold, weight Open described packet capturing software, so that packet capturing software is synchronous with the clock from clockwork
If during the clock jitter between clockwork and described packet capturing software excessive (clock is asynchronous), Using the clock synchronizing method based on windows operating system provided in an embodiment of the present invention, can lead to from when The problem that when clock equipment and clock equipment pair, precision reduces.This preferred embodiment is when from clockwork pair Afterwards, by restarting packet capturing software, make packet capturing software synchronous with from clockwork clock, can be to a certain extent Avoid due between clockwork and described packet capturing software clock asynchronous bring from clockwork and master The problem that during clockwork pair, precision reduces.
Preferably, described first message is ieee1588 message, then utilize preassembled packet capturing software week Phase property captures the first message that clock equipment sends, as shown in figure 5, specifically including:
Step 501, periodically captures master clock using the Hook Function in described preassembled packet capturing software The message that equipment sends.
Step 502, filters out ieee 1588 message from the message that described clock equipment sends.
Specifically, the message that clock equipment sends is multiple format, and the Hook Function in packet capturing software is only born Duty periodically captures the message that clock equipment sends.The clock equipment being directed to crawl from clockwork is sent out The message sending is screened, thus filtering out ieee 1588 message, that is, filters out the first message.Wherein, Ieee 1588 message comprises the message of udp form and the message of ieee 802.3 form.That is, above-mentioned synchronization Message is ieee 1588 message.
Preferably, preassembled packet capturing software is wincap packet capturing software.
Specifically, call the pcap_findalldevs function in the wincap tool storage room of wincap packet capturing software Select the network interface card from clockwork;Call the pcap_open_live function in wincap tool storage room open from The network interface card of clockwork is simultaneously suspended to the network interface card from clockwork by catching the Hook Function in function pcap_loop On, the message that clock equipment sends is captured by Hook Function and stamps crawl timestamp for these messages; Latency request message after encapsulating is sent to master by pcap_sendpacket interface by wincap packet capturing software Clockwork.The timestamp precision that wincap packet capturing software is stamped is delicate level, but due to windows The time precision of operating system is Millisecond, therefore using clock synchronizing method provided in an embodiment of the present invention The precision constantly, needing the timestamp stamping packet capturing software is converted to Millisecond, wherein wincap grabs The argument structure of the Hook Function in bag software is struct pcap_pkthdr*header.More specific utilization The method of wincap packet capturing software packet capturing can be found in prior art, is not set forth in detail here.
Based on same with the clock synchronizing method based on windows operating system provided in an embodiment of the present invention Inventive concept, the embodiment of the present invention also provides a kind of clock based on windows operating system synchronously to fill Put, as shown in Figure 6, comprising:
Handling module 601, for the synchronization being sent using preassembled packet capturing software grabs clock equipment Message, and record the crawl timestamp t2 capturing described sync message, the described operation system from clockwork Unite as windows operating system;
Parsing module 602, described for parsing the described clock equipment transmission carrying in described sync message The transmission timestamp t1 of sync message;
Transmitting element 603, for using described packet capturing software by the latency request report for described sync message It is sent to clock equipment after literary composition encapsulation, and record the packaging time stamp t3 encapsulating described latency request message;
Described handling module 601 is additionally operable to, and is directed to institute using clock equipment described in described packet capturing software grabs State the time delay response message of latency request message return, and parse carry in described time delay response message described Clock equipment sends the transmission timestamp t4 of described time delay response message;
Pair when module 604, according to described t1, t2, t3 and t4, calculate from clockwork and master clock The clock jitter of equipment, and set time to from clockwork according to this clock jitter.
Preferably, in described device, described handling module specifically for:
Capture the first message that clock equipment sends using preassembled packet capturing software cycle, described the One message carries the crawl timestamp capturing described first message;
When determining described first message for sync message, record captures the crawl timestamp of described sync message t2;
Preferably, described handling module is additionally operable to:
Capture the first message that clock equipment sends using described packet capturing software cycle, the first message carries Capture the crawl timestamp of described first message;
When determining described first message for described time delay response message, parse in described time delay response message and carry Described clock equipment send the transmission timestamp t4 of described time delay response message.
Preferably, in described device, described transmitting element specifically for:
It is sent to clock equipment after described latency request message being encapsulated using preassembled packet capturing software, The packaging time stamp t3 encapsulating described latency request message is carried in latency request message after described encapsulation;
The packaging time stamp t3 carrying in latency request message after the described encapsulation of parsing, and record described envelope ETL estimated time of loading stabs t3.
Preferably, in described device, when described pair, module is additionally operable to:
Periodically restart described packet capturing software;Or
The clock jitter between clockwork and described packet capturing software after during determination pair is more than given threshold When, restart described packet capturing software.
Preferably, described device, when described first message is ieee 1588 message, then described crawl mould Block using preassembled packet capturing software cycle capture clock equipment send the first message when, specifically For:
Periodically capture clock equipment using the Hook Function in described preassembled packet capturing software to send Message;
Filter out ieee 1588 message from the message that described clock equipment sends.
Using the clock synchronizing method based on windows operating system provided in an embodiment of the present invention and device, Have the advantages that do not need extra hard in installing from clockwork of windows operating system Part, can get the timestamp parameter required for clock synchronization by preassembled packet capturing software, thus root Realize the clock synchronization between clockwork and clock equipment according to timestamp parameter, and then save hardware money Source, and a packet capturing software can be installed and used from clockwork in multiple stage, thus reducing to a certain extent Cost.
The present invention is to produce with reference to method according to embodiments of the present invention, equipment (system) and computer program The flow chart of product and/or block diagram are describing.It should be understood that can by computer program instructions flowchart and / or block diagram in each flow process and/or the flow process in square frame and flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions can be provided to general purpose computer, special-purpose computer, embed The processor of formula datatron or other programmable data processing device is to produce a machine so that passing through to calculate The instruction of the computing device of machine or other programmable data processing device produces for realizing in flow chart one The device of the function of specifying in individual flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions may be alternatively stored in and computer or other programmable datas can be guided to process and set So that being stored in this computer-readable memory in the standby computer-readable memory working in a specific way Instruction produce and include the manufacture of command device, the realization of this command device is in one flow process or multiple of flow chart The function of specifying in flow process and/or one square frame of block diagram or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, makes Obtain and series of operation steps is executed on computer or other programmable devices to produce computer implemented place Reason, thus the instruction of execution is provided for realizing in flow chart one on computer or other programmable devices The step of the function of specifying in flow process or multiple flow process and/or one square frame of block diagram or multiple square frame.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know base This creative concept, then can make other change and modification to these embodiments.So, appended right will Ask and be intended to be construed to including preferred embodiment and fall into being had altered and changing of the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification without deviating from this to the present invention Bright spirit and scope.So, if the present invention these modification and modification belong to the claims in the present invention and Within the scope of its equivalent technologies, then the present invention is also intended to comprise these changes and modification.

Claims (10)

1. a kind of clock synchronizing method based on windows operating system is it is characterised in that include:
Utilize the sync message of preassembled packet capturing software grabs clock equipment transmission from clockwork, and Record captures the crawl timestamp t2 of described sync message, described from the operating system of clockwork is Windows operating system;
When parsing the transmission that the described clock equipment carrying in described sync message sends described sync message Between stab t1;
It is sent to master using described packet capturing software by after the latency request message encapsulation for described sync message Clockwork, and record the packaging time stamp t3 encapsulating described latency request message;
It is directed to prolonging of described latency request message return using clock equipment described in described packet capturing software grabs When response message, and parse the described clock equipment carrying in described time delay response message and send described time delay The transmission timestamp t4 of response message;
According to described t1, t2, t3 and t4, calculate the clock jitter from clockwork and clock equipment, And set time to from clockwork according to this clock jitter.
2. the method for claim 1 is it is characterised in that grabbed using preassembled packet capturing software Take the sync message that clock equipment sends, and record the crawl timestamp t2 capturing described sync message, Specifically include:
Capture the first message that clock equipment sends using preassembled packet capturing software cycle, described the One message carries the crawl timestamp capturing described first message;
When determining described first message for sync message, record captures the crawl timestamp of described sync message t2;
It is directed to prolonging of described latency request message return using clock equipment described in described packet capturing software grabs When response message, and parse the described clock equipment carrying in described time delay response message and send described time delay The transmission timestamp t4 of response message, specifically includes:
Capture the first message that clock equipment sends using described packet capturing software cycle, the first message carries Capture the crawl timestamp of described first message;
When determining described first message for described time delay response message, parse in described time delay response message and carry Described clock equipment send the transmission timestamp t4 of described time delay response message.
3. the method for claim 1 is it is characterised in that will be for institute using described packet capturing software It is sent to clock equipment after the latency request message encapsulation stating sync message, and records the described time delay of encapsulation and ask The packaging time seeking message stabs t3, specifically includes:
It is sent to clock equipment after described latency request message being encapsulated using preassembled packet capturing software, The packaging time stamp t3 encapsulating described latency request message is carried in latency request message after described encapsulation;
The packaging time stamp t3 carrying in latency request message after the described encapsulation of parsing, and record described envelope ETL estimated time of loading stabs t3.
4. method as claimed in claim 2 it is characterised in that: set to from clock according to this clock jitter For after setting time, also include:
Periodically restart described packet capturing software;Or
The clock jitter between clockwork and described packet capturing software after during determination pair is more than given threshold When, restart described packet capturing software.
5. method as claimed in claim 2 is it is characterised in that described first message is reported for ieee1588 Literary composition, then utilize preassembled packet capturing software cycle to capture the first message that clock equipment sends, specifically Including:
Periodically capture clock equipment using the Hook Function in described preassembled packet capturing software to send Message;
Filter out ieee1588 message from the message that described clock equipment sends.
6. a kind of clock synchronization apparatus based on windows operating system are it is characterised in that include:
Handling module, for the synchronization report being sent using preassembled packet capturing software grabs clock equipment Literary composition, and record the crawl timestamp t2 capturing described sync message, the described operating system from clockwork For windows operating system;
Parsing module, sends described synchronization for parsing the described clock equipment carrying in described sync message The transmission timestamp t1 of message;
Transmitting element, for being sealed the latency request message for described sync message using described packet capturing software It is sent to clock equipment after dress, and record the packaging time stamp t3 encapsulating described latency request message;
Described handling module is additionally operable to, and is directed to described prolonging using clock equipment described in described packet capturing software grabs When request message return time delay response message, and parse carry in described time delay response message described main when Clock equipment sends the transmission timestamp t4 of described time delay response message;
Pair when module, according to described t1, t2, t3 and t4, calculate from clockwork and clock equipment Clock jitter, and set time to from clockwork according to this clock jitter.
7. device as claimed in claim 6 it is characterised in that described handling module specifically for:
Capture the first message that clock equipment sends using preassembled packet capturing software cycle, described the One message carries the crawl timestamp capturing described first message;
When determining described first message for sync message, record captures the crawl timestamp of described sync message t2;
Described handling module is additionally operable to:
Capture the first message that clock equipment sends using described packet capturing software cycle, the first message carries Capture the crawl timestamp of described first message;
When determining described first message for described time delay response message, parse in described time delay response message and carry Described clock equipment send the transmission timestamp t4 of described time delay response message.
8. device as claimed in claim 6 it is characterised in that described transmitting element specifically for:
It is sent to clock equipment after described latency request message being encapsulated using preassembled packet capturing software, The packaging time stamp t3 encapsulating described latency request message is carried in latency request message after described encapsulation;
The packaging time stamp t3 carrying in latency request message after the described encapsulation of parsing, and record described envelope ETL estimated time of loading stabs t3.
9. device as claimed in claim 7 it is characterised in that when described pair module be additionally operable to:
Periodically restart described packet capturing software;Or
The clock jitter between clockwork and described packet capturing software after during determination pair is more than given threshold When, restart described packet capturing software.
10. device as claimed in claim 7 is it is characterised in that described first message is ieee1588 Message, then described handling module is using the crawl clock equipment transmission of preassembled packet capturing software cycle The first message when, specifically for:
Periodically capture clock equipment using the Hook Function in described preassembled packet capturing software to send Message;
Filter out ieee1588 message from the message that described clock equipment sends.
CN201510391243.7A 2015-07-06 2015-07-06 Clock synchronization method and device based on windows operating system Pending CN106341218A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510391243.7A CN106341218A (en) 2015-07-06 2015-07-06 Clock synchronization method and device based on windows operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510391243.7A CN106341218A (en) 2015-07-06 2015-07-06 Clock synchronization method and device based on windows operating system

Publications (1)

Publication Number Publication Date
CN106341218A true CN106341218A (en) 2017-01-18

Family

ID=57825984

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510391243.7A Pending CN106341218A (en) 2015-07-06 2015-07-06 Clock synchronization method and device based on windows operating system

Country Status (1)

Country Link
CN (1) CN106341218A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145235A (en) * 2017-05-11 2017-09-08 杭州幻行科技有限公司 A kind of virtual reality system
CN109981206A (en) * 2019-02-26 2019-07-05 深圳猛犸电动科技有限公司 Time synchronization method, device, system and terminal device, storage medium
CN111385048A (en) * 2018-12-29 2020-07-07 中兴通讯股份有限公司 Time synchronization method and system
CN111385051A (en) * 2018-12-29 2020-07-07 华为技术有限公司 Clock synchronization method, device and storage medium
CN112600639A (en) * 2020-12-17 2021-04-02 珠海市一微半导体有限公司 Timestamp correction method and system
CN116614199A (en) * 2023-07-14 2023-08-18 腾讯科技(深圳)有限公司 Clock synchronization method, device, slave clock equipment, clock synchronization system and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101895384A (en) * 2010-07-07 2010-11-24 中兴通讯股份有限公司 Method and device for implementing boundary clock
CN104008077A (en) * 2014-05-07 2014-08-27 武汉精测电子技术股份有限公司 Device and method for achieving serial port package capturing based on single chip microcomputer

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101895384A (en) * 2010-07-07 2010-11-24 中兴通讯股份有限公司 Method and device for implementing boundary clock
CN104008077A (en) * 2014-05-07 2014-08-27 武汉精测电子技术股份有限公司 Device and method for achieving serial port package capturing based on single chip microcomputer

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张爱菊: "《电子商务安全技术》", 28 February 2013 *
林天峰: "《服务器架设指南》", 31 January 2010 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145235A (en) * 2017-05-11 2017-09-08 杭州幻行科技有限公司 A kind of virtual reality system
CN111385048A (en) * 2018-12-29 2020-07-07 中兴通讯股份有限公司 Time synchronization method and system
CN111385051A (en) * 2018-12-29 2020-07-07 华为技术有限公司 Clock synchronization method, device and storage medium
CN111385051B (en) * 2018-12-29 2022-11-08 华为技术有限公司 Clock synchronization method, device and storage medium
CN111385048B (en) * 2018-12-29 2023-06-30 中兴通讯股份有限公司 Time synchronization method and system
CN109981206A (en) * 2019-02-26 2019-07-05 深圳猛犸电动科技有限公司 Time synchronization method, device, system and terminal device, storage medium
CN112600639A (en) * 2020-12-17 2021-04-02 珠海市一微半导体有限公司 Timestamp correction method and system
CN116614199A (en) * 2023-07-14 2023-08-18 腾讯科技(深圳)有限公司 Clock synchronization method, device, slave clock equipment, clock synchronization system and medium
CN116614199B (en) * 2023-07-14 2023-10-17 腾讯科技(深圳)有限公司 Clock synchronization method, device, slave clock equipment, clock synchronization system and medium

Similar Documents

Publication Publication Date Title
CN106341218A (en) Clock synchronization method and device based on windows operating system
CN106488550B (en) Determine the method and apparatus of terminal Yu base station clock time deviation
CN103929293B (en) Asymmetrically-delayed time synchronization method and system
CN105577349A (en) Airborne network IEEE1588 protocol master-slave clock port synchronization method
CN109787703B (en) Timestamp correction method, clock synchronization method and system
CN107579793A (en) The optimization method of time synchronized, device and equipment between a kind of communication network device
RU2008128814A (en) USE OF TRAVEL TIME AS MEANS FOR INCREASING THE ACCURACY OF THE SIMPLE NETWORK PROTOCOL OF THE TIME SERVICE
CN112838903B (en) Clock synchronization method, equipment and storage medium
CN102932905A (en) Method and system for realizing self-compensation 1588 link asynchronous time delay
WO2017179608A1 (en) Timing synchronization method, sensor embedding terminal, and sensor network system
CN105553595B (en) Equipment and its synchronous method in a kind of distributed system
CN105577348B (en) Frequency deviation monitoring method and device based on time synchronization network
CN106506107B (en) A kind of ntp server time service implementation method based on hardware timestamping
CN103888748A (en) Video frame synchronization method for numerous-viewpoint three-dimensional display system
CN108429596B (en) A kind of ethernet mac module realization device and implementation method for IEEE 1588v2 agreement
WO2016058347A1 (en) Method and apparatus for implementing time and clock synchronization
CN105281860B (en) A kind of synchronous data sampling method based on ethernet passive optical network
CN104396165A (en) Communication apparatus, communication system, communication controlling method, and program
CN105634716A (en) Airborne network IEEE1588 protocol slave clock port synchronization method
CN103441833B (en) A kind of master-slave equipment frequency synchronization method and system
WO2010102565A1 (en) Method, apparatus and system for time synchronization
WO2022222616A1 (en) Clock synchronisation method, optical head end, and optical terminal
CN114422589A (en) Data transmission method, device, equipment and storage medium
WO2023213080A1 (en) Method for realizing network node time synchronization based on fpga
CN102347792B (en) Method for adapting radio remote unit (RRU) and base band unit (BBU) and equipment thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170118

RJ01 Rejection of invention patent application after publication