Clock synchronization method and system
By measuring the communication time and preset time between wearable devices, calculating time deviations and performing clock synchronization, the problem of clock synchronization lag between different devices is solved, and more accurate physiological data analysis and system performance improvement is achieved.
Patent Information
- Application Number
- CN202410090349.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-22
- Publication Date
- 2025-07-22
AI Technical Summary
The clock synchronization between different wearable devices has problems such as lag and unsatisfactory synchronization, resulting in inaction in real synchronization of physiological data read at the same time.
By measuring the communication time and preset time between devices, the time deviation is calculated, and clock synchronization is performed based on this, the clock of the device is adjusted to achieve synchronization.
It improves the accuracy and synchronization effect of clock synchronization between wearable devices, ensures that the physiological data obtained at the same time is more accurate, and enhances the accuracy of physiological state analysis and system performance.
Smart Images

Figure CN120357986A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of the new generation of information technology industry, and particularly relates to a clock synchronization method and system. Background Art
[0002] Thanks to the development of communication technology nowadays, various devices can communicate and interconnect with each other to achieve data sharing, which is conducive to information integration and further information analysis. Taking wearable devices as an example, wearable devices are a type of device that can be worn or affixed to the human body among these devices. For example, a smart bracelet that can be worn on the wrist to measure heart rate or blood pressure, or a continuous glucose monitor that can be affixed to the body surface to measure blood glucose. Generally, the physiological data measured by wearable devices is associated with their own time. In order to more comprehensively analyze the physiological state level of the human body, it is often necessary to integrate the physiological data measured by multiple wearable devices at the same moment. However, although the physiological data measured can be read separately at the same moment displayed on each wearable device, due to the possible time deviation between different wearable devices (that is, the time passing speed of the built-in clock circuits of different wearable devices may be different), the multiple physiological data read separately at the same moment displayed on different wearable devices may not actually be at the same moment.
[0003] In the prior art, each wearable device can be connected to a third party. At this time, the clocks of multiple wearable devices can be synchronized uniformly with the clock of the third party as a reference. Specifically, the wearable device can establish communication with the third party to continuously obtain the time of the third party so as to synchronize its own clock with the third party.
[0004] However, the above prior art has at least the following deficiencies: Since the communication distances between each device and the third party may be different, there may be a certain lag in the clock synchronization between each device, and the clock synchronization effect is not ideal. Therefore, there is still room for improvement in the time synchronization between devices. Summary of the Invention
[0005] The present disclosure is proposed in view of the above situation, and its purpose is to provide a clock synchronization method and system that can facilitate the clock synchronization between devices.
[0006] To this end, a first aspect of the present disclosure provides a clock synchronization method, including: determining a first communication duration between the first device and the second device based on a first communication request sent by the first device and a first response of the second device to the first communication request, where the first communication duration is the duration required for the first device and the second device to perform a round-trip communication once without considering the waiting duration for the second device to send the first response; determining a second communication duration between the first device and the second device based on a second communication request sent by the first device and a second response of the second device to the second communication request, where the second communication duration is the duration required for the first device and the second device to perform a round-trip communication once when the second device sends the second response after waiting for a preset duration, where the first communication duration and the second communication duration are based on the clock of the first device, and the preset duration is based on the clock of the second device; determining a time deviation between the first device and the second device, where the time deviation is the difference between the sum of the first communication duration and the preset duration and the second communication duration; and synchronizing the clocks of the first device and the second device based on the time deviation.
[0007] In the first aspect of the present disclosure, the preset duration, the first communication duration, and the second communication duration are based on the clocks of different devices. The difference between the second communication duration and the first communication duration is equivalent to the waiting time based on the clock of the first device, and the preset duration is equivalent to the waiting time based on the clock of the second device. If the time elapse speeds of the first device and the second device are the same, then the difference between the second communication duration and the first communication duration should be equal to the preset duration, that is, the time deviation between the first device and the second device is 0; if the time elapse speeds of the first device and the second device are different, then the difference between the second communication duration and the first communication duration should not be equal to the preset duration, that is, the time deviation between the first device and the second device is not 0, and the clocks of the first device and the second device can be synchronized based on the time deviation determined by the preset duration, the first communication duration, and the second communication duration, thereby facilitating the clock synchronization between devices.
[0008] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, the method for determining the first communication duration includes: the first device sending the first communication request to the second device at a first moment; if the second device receives the first communication request, then sending the first response to the first device; and taking the difference between the second moment and the first moment as the first communication duration, where the second moment is the moment when the first device receives the first response. Thus, the first communication duration can be determined based on the clock of the first device.
[0009] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, the method for determining the second communication duration includes: the first device sends the second communication request to the second device at a third moment; if the second device receives the second communication request, it returns the second response to the first device after the preset duration; and the difference between a fourth moment, which is the moment when the first device receives the second response, and the third moment is used as the second communication duration. Thus, the second communication duration can be determined based on the clock of the first device.
[0010] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, the first device and the second device are wearable devices for obtaining different or the same physiological data. In this case, after the first device and the second device perform clock synchronization, it can make the moments of different physiological data obtained by the first device and the second device at the same moment displayed respectively closer to the same moment. Thus, the relationship between various physiological data can be analyzed more accurately, and the accuracy of analyzing the physiological state by integrating the physiological data read by the first device and the second device can be improved; or, it can make the moments of the same physiological data obtained by the first device and the second device at the same moment displayed respectively closer to the same moment. Thus, the overall performance of the system composed of wearable devices obtaining the same physiological data can be improved.
[0011] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, the preset duration is greater than the response time of the second device. In this case, since whether the device receives a communication request that expects an immediate response or a request that expects to wait for a preset duration before returning a response, the device needs to go through a response time to make a reaction. If the preset duration is less than the response time of the device, after the response time of the device ends, the preset duration that it waits has ended, and at this time the actual waiting time is greater than the preset duration; while making the preset duration greater than the response time of the device can improve the consistency between the actual waiting time and the preset duration.
[0012] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, a correction factor is determined based on the time deviation and the preset duration, and during the clock synchronization, the current clock of the first device or the second device is corrected based on the correction factor. In this case, the correction factor can represent the corresponding relationship between the time deviation and the preset duration (i.e., the length of time elapsed), and introducing a time deviation that changes with time can improve the adaptability when the first device and the second device perform clock synchronization.
[0013] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, a straight line representing the corresponding relationship between the time deviation and the preset duration is fitted based on a plurality of points determined by different preset durations and the corresponding plurality of time deviations, the correction factor is determined based on the slope of the straight line, and the clocks of the first device and the second device are synchronized based on the correction factor. In this case, the errors introduced when determining the corresponding plurality of time deviations by different preset durations can be fully considered. These errors may be positive errors and negative errors. At this time, the influence of each error on the clock synchronization between the first device and the second device can be weakened by fitting a straight line to a plurality of points, thereby improving the accuracy of clock synchronization.
[0014] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, a plurality of correction factors are determined based on the different preset durations and the corresponding time deviations respectively, and the clocks of the first device and the second device are synchronized based on the statistical value of the plurality of correction factors. The statistical value includes at least one of mode, mean, and median. In this case, the correction factors that are not equal to the statistical value among the plurality of correction factors are considered to have defects or be accidental and are not taken into account, thereby reducing the influence of the correction factors with defects or accidents on the clock synchronization between the first device and the second device, and thus improving the accuracy of clock synchronization.
[0015] In addition, in the clock synchronization method according to the first aspect of the present disclosure, optionally, the frequency division coefficient or the frequency multiplication coefficient of the clock circuit of the first device or the second device is adjusted based on the correction factor. In this case, the time elapse speed of the first device or the second device can be adjusted from the bottom layer of the clock circuit, thereby improving the stability of the synchronization effect after synchronizing the clocks of the first device and the second device.
[0016] The second aspect of the present disclosure provides a clock synchronization system, and the clock synchronization system executes the clock synchronization method as described in the first aspect of the present disclosure. Thus, it is convenient to synchronize the clocks between the devices in the clock synchronization system.
[0017] According to the present disclosure, a clock synchronization method and system that facilitate clock synchronization between devices can be provided. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The present disclosure will now be further explained in detail only by way of examples with reference to the accompanying drawings.
[0019] Figure 1A is a schematic diagram showing the first device and the second device involved in the example of the present disclosure communicating with each other; Figure 1B is an application scenario diagram showing the first device and the second device involved in the example of the present disclosure;Figure 1C It shows a possible module block diagram of the first device involved in the examples of the present disclosure.
[0020] Figure 2A It is the first schematic diagram showing clock synchronization among four devices involved in the examples of the present disclosure; Figure 2B It is the second schematic diagram showing clock synchronization among four devices involved in the examples of the present disclosure.
[0021] Figure 3 It shows a flowchart of the clock synchronization method involved in the examples of the present disclosure.
[0022] Figure 4A It shows a flowchart of determining the first communication duration involved in the examples of the present disclosure; Figure 4B It shows a schematic diagram of determining the first communication duration involved in the examples of the present disclosure.
[0023] Figure 5A It shows a flowchart of determining the second communication duration involved in the examples of the present disclosure; Figure 5B It shows a schematic diagram of determining the second communication duration involved in the examples of the present disclosure.
[0024] Figure 6 It shows a relationship diagram between multiple preset durations and corresponding multiple time deviations involved in the examples of the present disclosure.
[0025] Figure 7 It shows a block diagram of the clock synchronization system involved in the examples of the present disclosure. Detailed implementation manners
[0026] Hereinafter, with reference to the drawings, the preferred implementation manners of the present disclosure will be described in detail. In the following description, the same reference numerals are given to the same components, and repeated descriptions are omitted. In addition, the drawings are only schematic diagrams, and the dimensional ratios between components or the shapes of components, etc. may be different from the actual ones.
[0027] It should be noted that the terms "include" and "have" in the present disclosure and any of their deformations, for example, the processes, methods, systems, products or devices including or having a series of steps or units do not necessarily have to be limited to those steps or units clearly listed, but may include or have other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0028] The present disclosure provides a clock synchronization method for synchronizing the clocks between devices. In some examples, the clock synchronization method involved in the present disclosure may also be referred to as a clock calibration method or a clock correction method for multiple devices. Through the clock synchronization method provided by the present disclosure, it is possible to facilitate the clock synchronization between devices.
[0029] The devices involved in the present disclosure may be devices with built-in clocks. In some examples, with the aid of the clock, the device can perform functions associated with time or output data associated with time.
[0030] The clock involved in the present disclosure may refer to a timer, a timing program, a clock circuit, etc.
[0031] In some examples, the devices involved in the present disclosure may be wearable devices. In other examples, the devices involved in the present disclosure may also be non-wearable devices.
[0032] In some examples, a wearable device may refer to a device worn on the body surface, such as a smart bracelet, a smart watch, a continuous glucose monitor, a dynamic blood pressure monitor, or an electrocardiogram electrode, etc.
[0033] In some examples, a wearable device can be used to monitor the physiological state of the host, and the wearable device can characterize the physiological state of the host with the monitored physiological data.
[0034] In some examples, a wearable device may also refer to a device placed in the body. For example, a capsule endoscope or an intravascular ultrasound acquisition device.
[0035] Hereinafter, taking the first device and the second device as wearable devices as an example, the clock synchronization method involved in the present disclosure will be described in detail. In the present disclosure, the first device and the second device are not particularly distinguished.
[0036] Figure 1A is a schematic diagram showing the first device 100 and the second device 200 involved in the examples of the present disclosure communicating with each other; Figure 1B is an application scenario diagram showing the first device 100 and the second device 200 involved in the examples of the present disclosure; Figure 1C is a possible block diagram showing the first device 100 involved in the examples of the present disclosure. It should be noted that Figure 1C the block diagram of the first device 100 in can also be applicable to the second device 200.
[0037] In the present disclosure, the first device 100 can communicate with the second device 200.
[0038] In some examples, the first device 100 and the second device 200 can communicate with each other via radio frequency. In this case, the anti-interference performance during the communication between the first device 100 and the second device 200 can be improved.
[0039] In some examples, the first device 100 and the second device 200 can communicate with each other through the body surface. In this case, the convenience of communication between the first device 100 and the second device 200 can be improved.
[0040] In some examples, the first device 100 and the second device 200 can communicate with each other through broadcasting. In this case, it is beneficial for more devices to communicate with each other.
[0041] See Figure 1C , in some examples, the first device 100 may include a transceiver module 101, and the transceiver module 101 can be used to send or receive signals.
[0042] In some examples, the broadcast may include data information, and the data information may be physiological data monitored by the device, captured images, collected sounds, or worn positions, etc. Thus, data sharing between devices can be enabled through broadcasting.
[0043] In some examples, the physiological data monitored by the device may be a heart rate value, blood pressure value, blood glucose value, etc.
[0044] In some examples, the images captured by the device may be blood vessel images or abdominal cavity images, etc.
[0045] In some examples, the sounds collected by the device may be heart sounds or lung sounds, etc.
[0046] In some examples, the worn position of the device may be the chest, back, or limbs, etc.
[0047] See Figure 1C , in some examples, the first device 100 may include a measurement module 102, and the measurement module 102 can be used to obtain data information.
[0048] In some examples, the broadcast may further include time information, and the time information may be the time of the device itself.
[0049] In some examples, the broadcast may include both data information and time information at the same time, and the time information may correspond to the data information. Specifically, the time information may be the moment when the device obtains the data information.
[0050] See Figure 1C , in some examples, the first device 100 may include a control module 103, and the control module 103 can be used to control the transceiver module 101 and the measurement module 102.
[0051] In some examples, the first device 100 and the second device 200 can communicate with each other using a dedicated communication protocol. Thus, the situation of data leakage can be reduced.
[0052] In some examples, the data communicated between the first device 100 and the second device 200 can be subject to specialized encryption processing. Thereby, the security of the data can be improved.
[0053] In some examples, the first device 100 and the second device 200 can be wearable devices.
[0054] In some examples, the first device 100 and the second device 200 can be wearable devices that acquire different physiological data. In some examples, the first device 100 and the second device 200 can be different types of devices. For example, the first device 100 can be a smart bracelet that can measure heart rate, and the second device 200 can be a continuous glucose monitor that can measure blood glucose. In this case, after the first device 100 and the second device 200 perform clock synchronization, it can make the times of the different physiological data acquired by the first device 100 and the second device 200 at the same moment shown respectively be closer to the same moment more truly. Thereby, the relationship between multiple physiological data can be analyzed more accurately, and the accuracy of analyzing the physiological state by integrating the physiological data read by the first device 100 and the second device 200 can be improved.
[0055] In some examples, the first device 100 and the second device 200 can be wearable devices that acquire the same physiological data. In some examples, the first device 100 and the second device 200 can be the same type of device. For example, the first device 100 and the second device 200 can be two different electrocardiogram monitoring electrodes. In this case, after the first device 100 and the second device 200 perform clock synchronization, it can make the times of the same physiological data acquired by the first device 100 and the second device 200 at the same moment shown respectively be closer to the same moment more truly. Thereby, the overall performance of the system composed of wearable devices that acquire the same physiological data can be improved.
[0056] In some examples, the first device 100 can communicate with the second device 200 in a wired manner. For example, the first device 100 can transmit a signal to the second device 200 through a wire, and the second device 200 can also transmit a signal to the first device 100 through a wire. In this case, the first device 100 communicates with the second device 200 in a wired manner, that is to say, the first device 100 and the second device 200 are connected by a wire. When communicating, the situation of signal loss can be reduced, and thereby the stability of signal transmission can be improved.
[0057] In some examples, the wire can be a universal serial bus or the like.
[0058] In some examples, the first device 100 can communicate with the second device 200 wirelessly. For example, the first device 100 can send a signal to the second device 200 via wireless broadcasting, and the second device 200 can also send a signal to the first device 100 via wireless broadcasting. In this case, when the distance between the first device 100 and the second device 200 is relatively far, compared with the first device 100 communicating with the second device 200 in a wired manner, the wireless communication method can reduce the use of long wires between the first device 100 and the second device 200, thereby improving the convenience of signal transmission.
[0059] In the present disclosure, the first device 100 can send a communication request and receive a response, and the second device 200 can receive the communication request and send a response. In other words, the first device 100 can be a communication request sender and a response receiver, and the second device 200 can be a communication request receiver and a response sender.
[0060] In some examples, the communication request sent by the first device 100 can carry the time information of the first device 100. In the present disclosure, if the distance between the first device 100 and the second device 200 is close enough (or when the communication duration between the first device 100 and the second device 200 can be ignored), when the second device 200 receives the communication request from the first device 100, the second device 200 can adjust its own clock based on the time information of the first device 100 carried in the communication request. In some examples, considering that as time passes, the clock of the second device 200 will still be out of sync with the clock of the first device 100 after adjusting the clock, in order to reduce the time difference between the two, a communication request carrying time information can be sent to the second device 200 every certain preset time interval.
[0061] In some examples, after the first device 100 sends out a communication request, a record can be retained locally in the first device 100.
[0062] In some examples, considering the situation of data loss, after the second device 200 does not receive a communication request from the first device 100 after a preset time interval, the second device 200 can actively send a communication request to the first device 100 to access the local record of the first device 100 or the time of the first device 100.
[0063] In some examples, the preset time interval can be 10 seconds, 20 seconds, 30 seconds, or 1 minute, etc.
[0064] In addition, the clock synchronization method involved in the present disclosure is applicable to clock synchronization among multiple devices. For example, clock synchronization among three, four, five, or more devices.
[0065] Figure 2A It is the first schematic diagram showing clock synchronization among four devices involved in the examples of the present disclosure; Figure 2B It is the second schematic diagram showing clock synchronization among four devices involved in the examples of the present disclosure.
[0066] In some examples, the first device 100 can be used as the master device, and the second device 200, the third device 300, and the fourth device 400 can be used as slave devices. The clock of the master device can be regarded as an accurate clock, and the clocks of the slave devices can be synchronized with the clock of the master device.
[0067] See Figure 2A , in some examples, the first device 100 can communicate with the second device 200, the third device 300, and the fourth device 400 respectively. In other words, the second device 200, the third device 300, and the fourth device 400 can all be within the range of communicating with the first device 100.
[0068] In some examples, taking the clock of the first device 100 as a reference, the first device 100 can be clock-synchronized with the second device 200, the third device 300, and the fourth device 400 respectively. In this case, when the first device 100 can communicate with the second device 200, the third device 300, and the fourth device 400 respectively, adopting such a method can improve the consistency of clock synchronization.
[0069] In some examples, the clock synchronization of the first device 100 with the second device 200, the third device 300, and the fourth device 400 can be carried out simultaneously. In other words, the master device can synchronize the clock with each slave device simultaneously. In this case, the master device synchronizes the clock with multiple slave devices simultaneously, which can improve the efficiency of clock synchronization of multiple devices.
[0070] In some examples, the clock synchronization of the first device 100 with the second device 200, the third device 300, and the fourth device 400 can be carried out sequentially. In other words, the master device can synchronize the clock with each slave device sequentially. In this case, the master device synchronizes the clock with only one slave device each time, which can reduce the processing load of the master device, thereby improving the processing performance during clock synchronization.
[0071] See Figure 2B, in some examples, the first device 100 can communicate with the second device 200, the second device 200 can communicate with the third device 300, and the third device 300 can communicate with the fourth device 400. In other words, the first device 100, the second device 200, the third device 300, and the fourth device 400 can form a "chain" communication. In other words, the second device 200 can be within the range of communicating with the first device 100, the third device 300 can be within the range of communicating with the second device 200, and the fourth device 400 can be within the range of communicating with the third device 300.
[0072] In some examples, the clock of the second device 200 can be synchronized with the clock of the first device 100 based on the clock of the first device 100 as a reference; then, the clock of the third device 300 can be synchronized with the clock of the second device 200 based on the clock of the second device 200 as a reference; finally, the clock of the fourth device 400 can be synchronized with the clock of the third device 300 based on the clock of the third device 300 as a reference. In this case, the slave device that is not within the range of communicating with the master device can be synchronized with the master device based on the clock of the master device, thereby expanding the coverage range of clock synchronization.
[0073] It should be understood that in Figure 2A and Figure 2B , although the clock synchronization between four devices is illustrated, the present disclosure is not limited thereto, and the clock synchronization method involved in the present disclosure can also be applied to clock synchronization between more devices. For the convenience of understanding the clock synchronization method involved in the present disclosure, hereinafter, only the clock synchronization between the first device 100 and the second device 200 is taken as an example to illustrate the clock synchronization method involved in the present disclosure, but this should not be construed as any substantial limitation to the present disclosure.
[0074] Figure 3 is a flowchart showing the clock synchronization method involved in the examples of the present disclosure.
[0075] See Figure 3 , in some examples, the clock synchronization method may include: determining a first communication duration between the first device 100 and the second device 200 based on a first communication request sent by the first device 100 and a first response of the second device 200 to the first communication request (step S100); determining a second communication duration between the first device 100 and the second device 200 based on a second communication request sent by the first device 100 and a second response of the second device 200 to the second communication request (step S200); determining a time deviation between the first device 100 and the second device 200 (step S300); and synchronizing the clocks of the first device 100 and the second device 200 based on the time deviation (step S400).
[0076] See Figure 3 In some examples, the clock synchronization method may include: determining a first communication duration between the first device 100 and the second device 200 based on a first communication request sent by the first device 100 and a first response of the second device 200 to the first communication request (step S100).
[0077] In some examples, the first communication duration may be the duration required for the first device 100 and the second device 200 to communicate back and forth once.
[0078] In some examples, the first communication duration may be the duration required for the first device 100 and the second device 200 to communicate back and forth once without considering the waiting duration for the second device 200 to send the first response. In other words, during the process of the first device 100 and the second device 200 communicating back and forth once, the second device 200 may not have waited for a set time when sending the first response.
[0079] In some examples, the preset duration may refer to a specifically existing delay set. In some examples, the preset duration may be set by pre-writing a program.
[0080] In some examples, the preset duration may be set manually.
[0081] In some examples, the preset duration may change. That is to say, the preset duration may not be a fixed value.
[0082] In some examples, multiple first communication durations may be determined, and the average value of the multiple first communication durations may be calculated, and the average value of the multiple first communication durations may be used as the first communication duration. In this case, since the first communication duration determined each time may be different. For example, when the first device 100 communicates with the second device 200 in a wired manner, the transmission capacity of the wire is affected by the usage time and causes losses, so that the first communication duration may be different. Another example is that when the first device 100 communicates with the second device 200 in a wireless manner, the first communication duration is affected by network latency and may be different. By determining multiple first communication durations and using the average value of the multiple first communication durations as the first communication duration, the obtained first communication duration can be made more accurate, thereby improving the accuracy of the clock synchronization method.
[0083] Figure 4A is a flowchart showing the determination of the first communication duration involved in the examples of the present disclosure; Figure 4B is a schematic diagram showing the determination of the first communication duration involved in the examples of the present disclosure.
[0084] See Figure 4A, in some examples, the method for determining the first communication duration may include: the first device 100 sends a first communication request to the second device 200 at a first moment (step S101); if the second device 200 receives the first communication request, it sends a first response to the first device 100 (step S102); and takes the difference between the second moment and the first moment as the first communication duration (step S103). Thus, the first communication duration can be determined based on the clock of the first device 100.
[0085] See Figure 4A , in some examples, the method for determining the first communication duration may include: the first device 100 sends a first communication request to the second device 200 at a first moment (step S101).
[0086] See Figure 4B , in some examples, in step S101, the first moment may refer to the first moment of the first device 100 recorded based on the clock of the first device 100.
[0087] In some examples, a communication request may refer to a request for the expected recipient to return a response. Specifically, the recipient may have an interface for receiving the communication request, and when receiving the communication request, the recipient may return a response to the sender of the communication request.
[0088] In some examples, the communication request may carry information for the expected recipient to immediately execute the response return process.
[0089] In some other examples, the communication request may carry an instruction to activate a preset duration. In this case, when the recipient receives the communication request, it can cause the second device 200 to return a response to the first device 100 after a set waiting time.
[0090] In some examples, if the communication request does not carry an instruction to activate a preset duration, it can be considered that this communication request requires an immediate response.
[0091] See Figure 4A , in some examples, the method for determining the first communication duration may further include: if the second device 200 receives the first communication request, it sends a first response to the first device 100 (step S102) (step S102).
[0092] In some examples, in step S102, when the second device 200 receives the communication request, it can immediately enter the process of handling and returning a response to the first device 100.
[0093] In the present disclosure, when the device receives a request or an instruction, there may be a time required to respond (also referred to as the response time of the device). After the response time of the device, the device can enter the process of processing the request or instruction.
[0094] In some examples, the response time of the device can be 16 milliseconds, 25 milliseconds, 64 milliseconds, 100 milliseconds, and so on.
[0095] See Figure 4A , in some examples, the method for determining the first communication duration may further include: taking the difference between the second moment and the first moment as the first communication duration (step S103).
[0096] In some examples, in step S103, the second moment can be the moment when the first device 100 receives the first response.
[0097] See Figure 4B , in some examples, in step S103, the second moment may refer to the second moment of the first device 100 recorded based on the clock of the first device 100.
[0098] In some examples, both the second moment and the first moment may be based on the clock of the first device 100. In the present disclosure, it can be understood that the first moment and the second moment should be based on the clock of the same device. That is to say, if the first moment is based on the clock of the first device 100, then the second moment should also be based on the clock of the first device 100. In this case, the first communication duration obtained based on the first moment and the second moment can have a unique clock reference.
[0099] See Figure 3 , in some examples, the clock synchronization method may further include: determining the second communication duration between the first device 100 and the second device 200 based on the second communication request sent by the first device 100 and the second response of the second device 200 to the second communication request (step S200).
[0100] In some examples, the second communication duration can be the duration required for a round-trip communication between the first device 100 and the second device 200 when the second device 200 sends the second response after waiting for a preset duration. In other words, during the process of a round-trip communication between the first device 100 and the second device 200, the second device 200 needs to go through a set waiting time when sending the second response.
[0101] In some examples, multiple second communication durations can be determined at the same preset duration, and the average value of the multiple second communication durations can be calculated, with the average value of the multiple second communication durations being used as the second communication duration. In this case, since the second communication durations determined each time may vary. For example, when the first device 100 communicates with the second device 200 in a wired manner, the transmission capacity of the wire is affected by the usage time and causes losses, resulting in possible differences in the second communication duration. Another example is that when the first device 100 communicates with the second device 200 in a wireless manner, the second communication duration is affected by network latency and may thus be different. Therefore, by determining multiple second communication durations at the same preset duration and using the average value of the multiple second communication durations as the second communication duration, the obtained second communication duration can be made more appropriate, thereby improving the accuracy of the clock synchronization method.
[0102] Figure 5A is a flowchart showing the determination of the second communication duration involved in the examples of the present disclosure; Figure 5B is a schematic diagram showing the determination of the second communication duration involved in the examples of the present disclosure.
[0103] See Figure 5A , in some examples, the method for determining the second communication duration may include: the first device 100 sends a second communication request to the second device 200 at a third moment (step S201); if the second device 200 receives the second communication request, it returns a second response to the first device 100 after a preset duration (step S202); and the difference between the fourth moment and the third moment is used as the second communication duration (step S203). Thus, the second communication duration can be determined based on the clock of the first device 100.
[0104] See Figure 5A , in some examples, the method for determining the second communication duration may include: the first device 100 sends a second communication request to the second device 200 at a third moment (step S201).
[0105] See Figure 5B , in some examples, in step S201, the third moment may refer to the third moment of the first device 100 recorded based on the clock of the first device 100.
[0106] See Figure 5A , in some examples, the method for determining the second communication duration may further include: if the second device 200 receives the second communication request, it returns a second response to the first device 100 after a preset duration (step S202).
[0107] In some examples, the preset duration may be greater than the response time of the device. For example, the preset duration may be greater than the response time of the first device 100; or, the preset duration may be greater than the response time of the second device 200. In this case, since whether the device receives a communication request that expects an immediate response or a request that expects to wait for the preset duration before returning a response, the device needs to go through a response time to react. If the preset duration is less than the response time of the device, after the response time of the device ends, the preset duration that is waited for has ended, and at this time the actual waiting time is greater than the preset duration; and making the preset duration greater than the response time of the device can improve the consistency between the actual waiting time and the preset duration.
[0108] See Figure 5A , in some examples, the method for determining the second communication duration may further include: using the difference between the fourth moment and the third moment as the second communication duration (step S203).
[0109] In some examples, in step S203, the fourth moment may be the moment when the first device 100 receives the second response.
[0110] See Figure 5B , in some examples, in step S203, the fourth moment may refer to the fourth moment of the first device 100 recorded based on the clock of the first device 100.
[0111] In some examples, both the fourth moment and the third moment may be based on the clock of the first device 100. In the present disclosure, it can be understood that the third moment and the fourth moment should be based on the clock of the same device, that is, if the third moment is based on the clock of the first device 100, then the fourth moment should also be based on the clock of the first device 100. In this case, it can make the second communication duration obtained based on the third moment and the fourth moment have a unique clock reference.
[0112] In some examples, the first communication duration and the second communication duration may be based on the clock of the first device 100, and the preset duration may be based on the clock of the second device 200. In this case, it can make the difference between the second communication duration and the first communication duration have a different clock reference from the preset duration, thereby facilitating the judgment of the clock synchronization situation between the first device 100 and the second device 200.
[0113] See FIG. 2, in some examples, the clock synchronization method may further include: determining the time deviation between the first device 100 and the second device 200 (step S300).
[0114] In some examples, the time deviation between the first device 100 and the second device 200 can characterize the difference in the speed of time passage between the first device 100 and the second device 200.
[0115] In some examples, the time deviation can be the difference between the sum of the first communication duration and a preset duration and the second communication duration. That is:
[0116] t = (b + c) - d
[0117] where t is the time deviation, b is the first communication duration, c is the preset duration, and d is the second communication duration.
[0118] See Figure 3 , in some examples, the clock synchronization method may further include: synchronizing the clocks of the first device 100 and the second device 200 based on the time deviation (step S400).
[0119] In some examples, the preset duration can be changed to determine multiple time deviations, and the clocks of the first device 100 and the second device 200 can be synchronized based on the multiple time deviations. Specifically, multiple second communication durations can be determined under different preset durations, and the time deviation can be determined respectively based on each preset duration, the first communication duration, and each second communication duration. In this case, compared with synchronizing the clocks of the first device 100 and the second device 200 based on a single time deviation, changing the preset duration to determine multiple time deviations can reduce the contingency of the obtained time deviation, and at this time, synchronizing the clocks of the first device 100 and the second device 200 based on the multiple time deviations can improve the accuracy of clock synchronization.
[0120] In the present disclosure, it can be understood that the relationship between the time deviation and the preset duration essentially reflects the relationship between the time deviation and the length of time passage, and the length of time passage refers to the length of time elapsed.
[0121] In some examples, a correction factor can be determined based on the time deviation and the preset duration. During clock synchronization, the current clock of the first device 100 or the second device 200 can be corrected based on the correction factor. In this case, the correction factor can characterize the corresponding relationship between the time deviation and the preset duration (i.e., the length of time passage), and introducing a time deviation that changes with time can improve the adaptability when the first device 100 and the second device 200 perform clock synchronization.
[0122] In some examples, the correction factor can be determined based on the ratio of the time deviation to the preset duration.
[0123] In some examples, a plurality of correction factors may be determined based on a plurality of time deviations corresponding to different preset time durations. In some examples, a plurality of time deviations may be determined based on a plurality of second communication time durations corresponding to different preset time durations, and a plurality of correction factors may be determined based on the different preset time durations and the corresponding plurality of time deviations.
[0124] Figure 6 FIG. shows a relationship diagram between a plurality of preset time durations involved in the examples of the present disclosure and the corresponding plurality of time deviations.
[0125] Refer to Figure 6 , the dashed line a schematically shows the relationship between different preset time durations and the corresponding plurality of time deviations. According to the dashed line a, it can be seen that as different preset time durations are set, the corresponding time deviations are also different. At this time, it can be considered that there is a certain functional relationship between the time deviation between the first device 100 and the second device 200 and the preset time duration. In other words, it can be considered that the time deviation between the first device 100 and the second device 200 is affected by the preset time duration, or it can be considered that the time deviation between the first device 100 and the second device 200 changes with the length of the elapsed time.
[0126] Refer to Figure 6 , in some examples, a straight line may be fitted based on a plurality of points determined according to different preset time durations and the corresponding plurality of time deviations. The straight line may represent the corresponding relationship between the time deviation and the preset time duration. In some examples, a correction factor may be determined based on the slope of this straight line. In some examples, the clocks of the first device 100 and the second device 200 may be synchronized based on the correction factor. In this case, the errors introduced when determining the corresponding plurality of time deviations based on different preset time durations can be fully considered. These errors may be positive errors and negative errors. At this time, by fitting a straight line to a plurality of points, the influence of each error on the clock synchronization between the first device 100 and the second device 200 can be weakened, thereby improving the accuracy of clock synchronization.
[0127] In some examples, a plurality of correction factors may be determined based on different preset time durations and the corresponding time deviations respectively. For example, a plurality of straight lines may be determined according to different preset time durations and the corresponding time deviations respectively, and a plurality of correction factors may be determined based on the slopes of the plurality of straight lines.
[0128] In some examples, the clocks of the first device 100 and the second device 200 can be synchronized based on the statistical values of multiple correction factors. In some examples, the statistical values include at least one of the mode, mean, and median. In this case, the correction factors that are not equal to the statistical value among the multiple correction factors are considered to have defects or be accidental and are not taken into account. Thus, the correction factors with defects or accidents can be reduced from affecting the clock synchronization between the first device 100 and the second device 200, thereby improving the accuracy of clock synchronization.
[0129] In some examples, the relationship between different preset time durations and the corresponding multiple time deviations can be a function curve. In other words, the line fitted by multiple points determined according to different preset time durations and the corresponding multiple time deviations can be a function curve.
[0130] In some examples, the electronic clock of the first device 100 or the second device 200 can use the crystal oscillator pulse signal in the integrated circuit to calculate time. For example, the crystal oscillator works to generate a pulse signal voltage, which can be provided to the single-chip microcomputer for processing. At the same time, the single-chip microcomputer can convert this pulse signal into a corresponding level value and output it to the liquid crystal drive circuit. Then, through the liquid crystal driver, it is converted into an electric level and characters corresponding to the current date and time and displayed.
[0131] It should be understood that due to the physical characteristics of the crystal oscillator, the period of the pulse signal voltage generated by the crystal oscillator is fixed. Therefore, the period of the pulse signal voltage generated by the crystal oscillator cannot be changed.
[0132] In some examples, the frequency of the pulse signal can be changed by adjusting the parameters of the clock circuit. For example, by adjusting the frequency division coefficient or the frequency multiplication coefficient of the clock circuit, the frequency of the pulse signal can be changed. The frequency division coefficient or the frequency multiplication coefficient of the clock circuit refers to the proportional relationship between the frequency of the clock signal and the crystal oscillator frequency.
[0133] In the present disclosure, the frequency division coefficient can refer to dividing the frequency of the original clock signal by a coefficient to obtain a clock signal with a lower frequency. For example, if the frequency of the original clock signal is 10 MHz (megahertz) and the frequency division coefficient is 10, then the frequency of the clock signal after frequency division is 1 MHz.
[0134] In the present disclosure, the frequency multiplication coefficient can refer to multiplying the frequency of the original clock signal by a coefficient to obtain a clock signal with a higher frequency. For example, if the frequency of the original clock signal is 10 MHz and the frequency multiplication coefficient is 10, then the frequency of the clock signal after frequency multiplication is 100 MHz.
[0135] In some examples, the division factor or multiplication factor of the clock circuit of the first device 100 or the second device 200 can be adjusted based on a correction factor. In this case, the rate of time passage of the first device 100 or the second device 200 can be adjusted from the underlying clock circuit, thereby improving the stability of the synchronization effect after clock synchronization between the first device 100 and the second device 200.
[0136] In some examples, the correction factor can be used to amplify or reduce the division factor of the clock circuit.
[0137] In some examples, the correction factor can be used to amplify or reduce the multiplication factor of the clock circuit.
[0138] In the present disclosure, the preset duration, the first communication duration, and the second communication duration are based on the clocks of different devices. The difference between the second communication duration and the first communication duration is equivalent to the waiting time based on the clock of the first device 100, and the preset duration is equivalent to the waiting time based on the clock of the second device 200. If the rate of time passage of the first device 100 and the second device 200 is the same, the difference between the second communication duration and the first communication duration should be equal to the preset duration, that is, the time deviation between the first device 100 and the second device 200 is 0; if the rate of time passage of the first device 100 and the second device 200 is different, the difference between the second communication duration and the first communication duration should not be equal to the preset duration, that is, the time deviation between the first device 100 and the second device 200 is not 0, and the clocks of the first device 100 and the second device 200 can be synchronized based on the time deviation determined by the preset duration, the first communication duration, and the second communication duration, thereby facilitating clock synchronization between devices.
[0139] The present disclosure also provides a clock synchronization system, and the clock synchronization system can execute the clock synchronization method involved in the present disclosure. Thus, it is possible to facilitate clock synchronization between devices in the clock synchronization system.
[0140] Figure 7 It is a block diagram showing the clock synchronization system 10 involved in the examples of the present disclosure.
[0141] See Figure 7 , in some examples, the clock synchronization system 10 may include a first device 100 and a second device 200.
[0142] In some examples, the clock synchronization system 10 may further include a third device 300, a fourth device 400, or even more devices. The relevant descriptions of the first device 100, the second device 200, the third device 300, and the fourth device 400 can be found above.
[0143] In some examples, the clock synchronization system 10 may further include a processing module 110, and the processing module 110 may control the first device 100 and the second device 200. In some examples, the processing module 110 may control the clock synchronization process of the first device 100 and the second device 200. Specifically, the processing module 110 may control the process of mutual communication between the first device 100 and the second device 200. For example, the time interval of communication and the information carried during communication, etc.
[0144] In some examples, after the first device 100 and the second device 200 are clock-synchronized, the data of the first device 100 and the second device 200 may be sent to the processing module 110.
[0145] In some other examples, the clock synchronization system 10 may not include the processing module 110. In this case, the clock synchronization process between the first device 100 and the second device 200 may be performed by a predetermined program stored in itself.
[0146] In some examples, the clock synchronization system 10 may be an electrocardiogram monitoring system, and the first device 100 and the second device 200 may be electrocardiogram electrodes. In this case, after the electrocardiogram monitoring system executes the clock synchronization method, the clocks of multiple electrocardiogram electrodes can be synchronized, thereby improving the accuracy of electrocardiogram monitoring.
[0147] In some examples, the clock synchronization system 10 may be a biological monitoring system, the first device 100 may be a continuous glucose monitor, and the second device 200 may be a dynamic blood pressure monitor. In this case, after the biological monitoring system executes the clock synchronization method, the clocks of the continuous glucose monitor and the dynamic blood pressure monitor can be synchronized, thereby improving the time synchronization of different physiological data measured by the continuous glucose monitor and the dynamic blood pressure monitor at the same moment.
[0148] Although the present disclosure has been specifically described above in conjunction with the accompanying drawings and examples, it can be understood that the above description does not limit the present disclosure in any form. Those skilled in the art can make deformations and changes to the present disclosure according to needs without departing from the essence and scope of the present disclosure, and these deformations and changes all fall within the scope of the present disclosure.
Claims
1. A clock synchronization method, characterized in that, Including: Determining a first communication duration between the first device and the second device based on a first communication request sent by the first device and a first response of the second device to the first communication request, where the first communication duration is the duration required for the first device and the second device to perform a round-trip communication once without considering the waiting duration for the second device to send the first response; Determining a second communication duration between the first device and the second device based on a second communication request sent by the first device and a second response of the second device to the second communication request, where the second communication duration is the duration required for the first device and the second device to perform a round-trip communication once when the second device sends the second response after waiting for a preset duration, and wherein the first communication duration and the second communication duration are based on the clock of the first device, and the preset duration is based on the clock of the second device; Determining a time deviation between the first device and the second device, where the time deviation is the difference between the sum of the first communication duration and the preset duration and the second communication duration; and Synchronizing the clocks of the first device and the second device based on the time deviation.
2. The clock synchronization method according to claim 1, wherein The method for determining the first communication duration includes: The first device sending the first communication request to the second device at a first moment; If the second device receives the first communication request, then sending the first response to the first device; and Taking the difference between a second moment and the first moment as the first communication duration, where the second moment is the moment when the first device receives the first response.
3. The clock synchronization method according to claim 2, characterized in that The method for determining the second communication duration includes: The first device sending the second communication request to the second device at a third moment; If the second device receives the second communication request, then returning the second response to the first device after the preset duration; and Taking the difference between a fourth moment and the third moment as the second communication duration, where the fourth moment is the moment when the first device receives the second response.
4. The clock synchronization method according to claim 1, wherein The first device and the second device are wearable devices for acquiring different or the same physiological data.
5. The clock synchronization method according to claim 1, wherein, The preset duration is greater than the reaction time of the second device.
6. The clock synchronization method according to claim 1, characterized in that, Determining a correction factor based on the time deviation and the preset duration, and during the clock synchronization, correcting the current clock of the first device or the second device based on the correction factor.
7. The clock synchronization method according to claim 6, characterized in that, Fitting a straight line representing the corresponding relationship between the time deviation and the preset duration based on multiple points determined by different preset durations and the corresponding multiple time deviations, determining the correction factor based on the slope of the straight line, and synchronizing the clocks of the first device and the second device based on the correction factor.
8. The clock synchronization method according to claim 6, characterized in that, Determining multiple correction factors based on different preset durations and the corresponding time deviations respectively, and synchronizing the clocks of the first device and the second device based on the statistical value of the multiple correction factors, where the statistical value includes at least one of mode, mean, and median.
9. The clock synchronization method according to claim 7 or 8, characterized in that Adjust the frequency division coefficient or the frequency multiplication coefficient of the clock circuit of the first device or the second device based on the correction factor.
10. A clock synchronization system, characterized in that, The clock synchronization system executes the clock synchronization method according to any one of claims 1 to 9.