CN116582834A - Time synchronization method, device and system - Google Patents
Time synchronization method, device and system Download PDFInfo
- Publication number
- CN116582834A CN116582834A CN202310611445.2A CN202310611445A CN116582834A CN 116582834 A CN116582834 A CN 116582834A CN 202310611445 A CN202310611445 A CN 202310611445A CN 116582834 A CN116582834 A CN 116582834A
- Authority
- CN
- China
- Prior art keywords
- time
- terminal
- data
- synchronization
- message
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 80
- 238000004891 communication Methods 0.000 claims abstract description 60
- 230000001360 synchronised effect Effects 0.000 claims abstract description 57
- 230000004044 response Effects 0.000 claims abstract description 21
- 230000007547 defect Effects 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 15
- 238000004590 computer program Methods 0.000 description 8
- 230000002159 abnormal effect Effects 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 239000013078 crystal Substances 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 241000613130 Tima Species 0.000 description 2
- 230000005856 abnormality Effects 0.000 description 2
- 230000005059 dormancy Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000006855 networking Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000007792 addition Methods 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000008878 coupling Effects 0.000 description 1
- 238000010168 coupling process Methods 0.000 description 1
- 238000005859 coupling reaction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000007958 sleep Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/30—Services specially adapted for particular environments, situations or purposes
- H04W4/40—Services specially adapted for particular environments, situations or purposes for vehicles, e.g. vehicle-to-pedestrians [V2P]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0602—Systems characterised by the synchronising information used
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W56/00—Synchronisation arrangements
- H04W56/001—Synchronization between nodes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W56/00—Synchronisation arrangements
- H04W56/003—Arrangements to increase tolerance to errors in transmission or reception timing
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Synchronisation In Digital Transmission Systems (AREA)
Abstract
The application discloses a time synchronization method, a time synchronization device and a time synchronization system. The time synchronization method applied to the first terminal comprises the following steps: the method comprises the steps of acquiring time data from a plurality of time acquisition paths, wherein the time acquisition paths are communication paths of a first terminal, the time data are time when acquisition requests are received on each time acquisition path, generating a time message in response to the time data fed back by any time acquisition path, and sending the time message to a second terminal, so that the second terminal controls the time of a first vehicle on a terminal to be synchronous with the time data according to the time message, and the first vehicle is a vehicle carrying the second terminal. Through setting up first terminal and second terminal, can make the inside multistage time source that has of vehicle, avoid using single time source to lead to synchronous defect, be convenient for improve the inside time synchronization's of vehicle precision.
Description
Technical Field
The application relates to the technical field of vehicles, in particular to a time synchronization method, device and system.
Background
In recent years, society is continuously developed, living standard of people is continuously improved, and vehicle use rate is continuously increased. In general, the time on each ECU (electronic control unit) in the vehicle is determined by each clock crystal, and the accuracy of each clock crystal is different, so that the time on different ECUs after long-time operation can be greatly different. In order to solve the difference problem, in the related art, it is common to provide a certain ECU in the vehicle as a time source, synchronize the time of the time source with other ECUs, and improve the problem that there is a difference in time between the ECUs. However, the timing structure on the ECU serving as a time source is liable to deviate greatly from the actual time after long-term use, resulting in a large deviation of the vehicle time from the actual time; in addition, in the related art, the vehicle is usually calibrated through a network, and in an area with a poor signal environment, time calibration may not be achieved, which affects the use experience of the vehicle.
Disclosure of Invention
The embodiment of the application aims to provide a time synchronization method, a time synchronization device and a time synchronization system, which can acquire time data through various paths, and are convenient for improving the accuracy of vehicle time.
The technical scheme of the application is as follows:
in a first aspect, a time synchronization method is provided, applied to a first terminal, and the method includes:
acquiring time data from a plurality of time acquisition paths, wherein the time acquisition paths are communication paths of a first terminal, and the time data are time when acquisition requests are received on each time acquisition path;
generating a time message in response to receiving time data fed back by any time acquisition path;
and sending a time message to the second terminal so that the second terminal controls the time of the first vehicle on the terminal to be synchronous with the time data according to the time message, wherein the first vehicle is a vehicle carrying the second terminal.
In a second aspect, a time synchronization method is provided, applied to a second terminal, and the method includes:
responding to the received time message, analyzing and obtaining time data, and synchronizing the time on the second terminal with the time data;
and sending second target data to the terminal of the vehicle so as to synchronize the time of the first vehicle on the terminal of the vehicle with the second terminal.
In a third aspect, a time synchronization system is provided, the system comprising:
the first terminal is used for realizing the time synchronization method applied to the first terminal;
the second terminal is used for realizing the time synchronization method applied to the second terminal;
the vehicle-mounted terminal is used for receiving the second target data and synchronizing time according to the second target data.
In a fourth aspect, a time synchronization apparatus is provided, applied to a first terminal, where the apparatus includes:
the acquisition module is used for acquiring time data from a plurality of time acquisition paths, wherein the time acquisition paths are communication paths of the first terminal, and the time data are the time when the acquisition request is received on each time acquisition path;
the first receiving module is used for responding to the time data fed back by the receiving path at any time to generate a time message;
the first sending module is used for sending a time message to the second terminal so that the second terminal controls the time of the first vehicle on the terminal to be synchronous with the time data according to the time message, and the first vehicle is a vehicle carrying the second terminal.
In a fifth aspect, there is provided a time synchronization apparatus applied to a second terminal, the apparatus comprising:
the second receiving module is used for responding to the received time message, analyzing and obtaining time data and synchronizing the time on the second terminal with the time data;
and the second sending module is used for sending second target data to the vehicle terminal so as to synchronize the time of the first vehicle on-board with the second terminal.
In a sixth aspect, an embodiment of the present application provides an electronic device, where the electronic device includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, where the program or instructions implement steps of any one of the time synchronization methods according to the embodiments of the present application when executed by the processor.
In a seventh aspect, an embodiment of the present application provides a readable storage medium, where a program or an instruction is stored, where the program or the instruction implements the steps of the time synchronization method according to any one of the embodiments of the present application when executed by a processor.
In an eighth aspect, embodiments of the present application provide a computer program product, instructions in which, when executed by a processor of an electronic device, enable the electronic device to perform the steps of the time synchronization method of any of the embodiments of the present application.
The technical scheme provided by the embodiment of the application at least has the following beneficial effects:
the time synchronization method provided by the embodiment of the application can be applied to a first terminal, time data are acquired from a plurality of time acquisition paths, the time acquisition paths are communication paths of the first terminal, the time data are the time when an acquisition request is received on each time acquisition path, a time message is generated in response to the time data fed back by any time acquisition path, and the time message is sent to a second terminal, so that the second terminal controls the time of a first vehicle on a terminal to be synchronous with the time data according to the time message, and the first vehicle is a vehicle carrying the second terminal. Firstly, through setting up first terminal and second terminal, can make the vehicle inside have multistage time source, avoid using single time source to lead to synchronous defect, be convenient for improve the accuracy of vehicle inside time synchronization, secondly, through using the first terminal that has multiple communication path as the time source of first stage, acquire time data to the outside, can guarantee that time data's source is extensive, improved time data's acquisition ability and the accuracy of obtained time data.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application and do not constitute a undue limitation on the application.
FIG. 1 is a schematic diagram of a time synchronization system according to an embodiment of the present application;
fig. 2 is a flowchart of a time synchronization method applied to a first terminal according to an embodiment of the present application;
fig. 3 is a flowchart of a time synchronization method applied to a first terminal according to another embodiment of the present application;
fig. 4 is a flowchart of a time synchronization method applied to a first terminal according to still another embodiment of the present application;
fig. 5 is a flowchart of a time synchronization method applied to a first terminal according to still another embodiment of the present application;
fig. 6 is a flowchart of a time synchronization method applied to a first terminal according to still another embodiment of the present application;
fig. 7 is a flowchart of a time synchronization method applied to a second terminal according to an embodiment of the present application;
fig. 8 is a flowchart of a time synchronization method applied to a second terminal according to another embodiment of the present application;
FIG. 9 is a flowchart of a time synchronization method according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a time synchronization device applied to a first terminal according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a time synchronization device applied to a second terminal according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to enable a person skilled in the art to better understand the technical solutions of the present application, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the particular embodiments described herein are meant to be illustrative of the application only and not limiting. It will be apparent to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the application by showing examples of the application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of implementations consistent with aspects of the application as set forth in the following claims.
As described in the background art, after the time source is set in the related art, the time of the whole vehicle and the actual time still have a large deviation due to the problems of communication environment and the like, so that the use experience of the vehicle is seriously affected.
In order to solve the above problems, the embodiments of the present application provide a time synchronization method, apparatus, and system, where the time synchronization method may be applied to a first terminal, acquire time data from a plurality of time acquisition paths, where the time acquisition paths are communication paths of the first terminal, the time data is time when an acquisition request is received on each time acquisition path, and in response to receiving time data fed back by any time acquisition path, generate a time message, and send the time message to a second terminal, so that the second terminal controls, according to the time message, that the time of a first vehicle on a terminal is synchronized with the time data, and the first vehicle is a vehicle on which the second terminal is mounted. Firstly, through setting up first terminal and second terminal, can make the vehicle inside have multistage time source, avoid using single time source to lead to synchronous defect, be convenient for improve the accuracy of vehicle inside time synchronization, secondly, through using the first terminal that has multiple communication path as the time source of first stage, acquire time data to the outside, can guarantee that time data's source is extensive, improved time data's acquisition ability and the accuracy of obtained time data.
The time synchronization method provided by the embodiment of the application is described in detail below through specific embodiments and application scenarios thereof with reference to the accompanying drawings.
Before introducing the time synchronization method provided by the embodiment of the application, a time synchronization system for implementing the embodiment of the application is first introduced.
Fig. 1 is a schematic structural diagram of a time synchronization system according to an embodiment of the present application.
As shown in fig. 1, a time synchronization system 100 provided in an embodiment of the present application includes a first terminal 110, a second terminal 120, and a vehicle terminal 130.
The first terminal 110 is configured to implement a time synchronization method applied to the first terminal 110;
a second terminal 120 for implementing a time synchronization method applied to the second terminal 120;
the vehicle-mounted terminal 130 is configured to receive the second target data and synchronize time according to the second target data.
In some alternative embodiments of the present application, the first terminal 110 may be disposed in the first vehicle, may be a vehicle TBOX (telematics box), and may be connected to external communication through NTP (network time protocol), TIMA background, TMC background, GPS, or the like. The first terminal 110 may be in communication connection with a cloud platform for communication, and obtain time data on the cloud platform. For example, the first terminal 110 may be connected with the second terminal 120 through a CAN (controller area network) bus.
In some alternative embodiments of the present application, the second terminal 120 may be any ECU within the first vehicle, and illustratively, the second terminal 120 may be a vehicle dashboard, and the second terminal 120 may be connected to other ECUs within the first vehicle via a CAN bus.
The time synchronization method provided by the embodiment of the application is described in detail below.
The execution subject of the time synchronization method may be the first terminal 110 of fig. 1 described above.
It should be noted that, in the embodiments of the present application, the same terms and terms as those in the above embodiments are not repeated here.
Fig. 2 is a flowchart of a time synchronization method applied to a first terminal according to an embodiment of the present application.
As shown in fig. 2, the time synchronization method applied to the first terminal provided in the embodiment of the present application includes:
s210, acquiring time data from a plurality of time acquisition paths, wherein the time acquisition paths are communication paths of a first terminal, and the time data are the time when acquisition requests are received on each time acquisition path;
s220, responding to time data fed back by any time acquisition path, and generating a time message;
s230, sending a time message to the second terminal so that the second terminal controls the time of the first vehicle on the terminal to be synchronous with the time data according to the time message, and the first vehicle is a vehicle carrying the second terminal.
In S210, the communication path refers to a path through which the first terminal is connected to external communication, such as the Internet, a remote sensing network, and the like. For example, S210 may be to obtain time data of a remote platform through the Internet, or obtain time data through NTP, or obtain time data through a GPS time system (GPStimesystem).
In S220, the time message may include a specific year, month, day, time, minute, and second.
Firstly, through setting up first terminal and second terminal, can make the vehicle inside have multistage time source, avoid using single time source to lead to synchronous defect, be convenient for improve the accuracy of vehicle inside time synchronization, secondly, through using the first terminal that has multiple communication path as the time source of first stage, acquire time data to the outside, can guarantee that time data's source is extensive, improved time data's acquisition ability and the accuracy of obtained time data.
Illustratively, when the plurality of time acquisition paths are sequentially fed back, S220 may be to generate a first time message in response to receiving time data of a first feedback, generate a second time message in response to receiving time data of a second feedback, and the like. S230 may be that a first time message, a second time message, etc. are sequentially sent to the second terminal.
In some alternative embodiments of the present application, the time acquisition path includes a platform path, a GPS path, and a network time protocol path.
The platform path refers to a path for obtaining time data on a remote platform through an Internet network, such as a TIMA background, a TMC background and the like. The GPS path refers to a path through which time data is acquired by a GPS time system (GPStimesystem). Network time protocol path obtains a path of time data through NTP.
Fig. 3 is a flowchart of a time synchronization method applied to a first terminal according to another embodiment of the present application.
As shown in fig. 3, in some alternative embodiments of the present application, in order to reduce the accumulated deviation of time on the vehicle, the step of acquiring time data from a plurality of time acquisition paths may include:
s310, responding to the starting of the first terminal, acquiring time data from a plurality of time acquisition paths.
In S310, the starting of the first terminal refers to that the first terminal is switched from the non-working state to the working state, for example, the first terminal is turned on, the first terminal is awakened, the first terminal is restarted, and the like.
By responding to the starting of the first terminal and acquiring time data from a plurality of time acquisition paths, time synchronization action can be carried out when the first terminal is started each time, time deviation caused by long-time use of the first terminal is reduced, and time precision is improved.
For example, S310 may be to acquire time data from a plurality of time acquisition paths in response to the restart of the first terminal.
In some alternative embodiments of the present application, the first terminal is started up including application abnormal restart, system abnormal restart and power-off abnormal restart.
The first terminal is taken as a TBOX for explanation, the application abnormal restart can be a restart caused by application abnormality in the TBOX, for example, the TBOX restart caused by redundancy memory abnormality of the TBOX, the system abnormal restart can be a TBOX restart caused by TBOX system error, and the power-off abnormal restart can be a TBOX restart caused by TBOX abnormal power-off, for example, the first vehicle is powered off abnormally, and the like. For example, when a system is restarted, the TBOX is usually in a live state, so the TBOX time will be resynchronized, but when the system is restarted, the TBOX is in a powered-down state, so the TBOX time is resynchronized, the TBOX time may be lost, and the TBOX time module may be an RTC (real time clock).
Fig. 4 is a flowchart of a time synchronization method applied to a first terminal according to still another embodiment of the present application.
As shown in fig. 4, in some alternative embodiments of the present application, in order to improve accuracy and efficiency of the first vehicle acquiring time data, the step of acquiring time data from the plurality of time acquisition paths may further include:
s410, acquiring communication environment data of a plurality of time acquisition paths;
s420, acquiring time data by using a path with a better communication environment from a plurality of time acquisition paths.
In S410, the communication environment data refers to a parameter capable of characterizing the communication quality of the time acquisition path, and may be signal strength, such as network signal strength, GPS signal strength, and the like. Illustratively, when the time acquisition path takes a network approach, the communication environment data may also include a communication service quality (QualityofService, QOS), which refers to the service capability of the network communication, which is visually represented by network delay and congestion, such as a communication networking delay amount and a communication networking packet loss rate.
In S420, the path with the better communication environment may be the one with the best communication environment data among the plurality of time acquisition paths, or may be one or more of the communication environment data among the plurality of time acquisition paths better than the communication threshold.
The communication environment data of the plurality of time acquisition paths is acquired, and the time data is acquired by using a path with a better communication environment among the plurality of time acquisition paths. The time data can be acquired by using the time acquisition path with higher communication quality, so that the smoothness of time data acquisition is improved, and time synchronization is facilitated.
For example, S420 may be to select a time acquisition path acquisition time data in which the communication environment data is better than the communication threshold according to the communication environment data. The communication environment data is taken as signal strength to explain, and according to the communication environment data, a time acquisition path with the communication signal strength larger than a signal threshold value is selected to acquire time data. The signal threshold refers to a critical value of the communication signal, and a communication signal greater than the signal threshold may be considered to be better than the current communication signal.
Fig. 5 is a flowchart of a time synchronization method applied to a first terminal according to still another embodiment of the present application.
As shown in fig. 5, in some alternative embodiments of the present application, in order to improve accuracy and efficiency of acquiring time data of the first vehicle, the step of acquiring time data using one of a plurality of time acquisition paths with a better communication environment may include:
s520, when the communication environments of the plurality of time acquisition paths are poor, time data is acquired by using a time module built in the first terminal.
In S520, the time module refers to a module for timing in the first terminal, and the first terminal is described as TBOX, and the time module may be an RTC, a clock crystal oscillator, or the like.
When the communication environments of the plurality of time acquisition paths are poor, the time data are acquired by using the time module built in the first terminal, so that the first terminal can acquire the time data by using a time structure carried by the first terminal when the first terminal cannot acquire the time data to the outside.
Fig. 6 is a flowchart of a time synchronization method applied to a first terminal according to still another embodiment of the present application.
As shown in fig. 6, in some alternative embodiments of the present application, in order to improve the time precision on the second terminal, in response to receiving the time data fed back by the acquisition path at any time, the step of generating the time message may include:
s620, acquiring first target data in response to receiving the time data, wherein the first target data comprises state data of the first terminal;
s630, according to the first target data, a synchronous control instruction is obtained, and a time message is obtained by combining the synchronous control instruction and time data, so that the second terminal performs subsequent time synchronization according to the synchronous control instruction.
In S620, the state data of the first terminal refers to parameters capable of representing the working state of the first terminal, for example, may include working, dormancy, shutdown, etc., and in the shutdown state and the dormancy state, the first terminal cannot acquire time data and send time messages, and the second terminal needs to autonomously time.
In S630, the second terminal performs subsequent time synchronization according to the synchronization control instruction, which may be that the second terminal determines an acquisition path of the time data in the subsequent time synchronization operation according to the synchronization control instruction.
In some alternative embodiments of the present application, the first target data includes a normal operation state and an operation to be stopped, the synchronization control instruction includes a subsequent synchronization instruction and a subsequent non-synchronization instruction, the subsequent synchronization instruction is an instruction obtained when the first terminal is in the normal operation state, the subsequent non-synchronization instruction is an instruction obtained when the first terminal is to be stopped,
according to the first target data, a synchronous control instruction is obtained, and a time message is obtained by combining the synchronous control instruction and time data, comprising:
when the working state of the first terminal is normal, a subsequent synchronous instruction is obtained, and a time message is obtained by combining the subsequent synchronous instruction and time data so as to enable the second terminal to normally perform subsequent time synchronization,
when the first terminal is about to stop working, a subsequent asynchronous instruction is obtained, and a time message is obtained by combining the subsequent asynchronous instruction and time data, so that the second terminal uses a built-in time module to obtain time data when in subsequent synchronous time.
The first terminal is about to stop working, which means that the first terminal is about to be switched from a working state to a non-working state, for example, the first terminal is about to be powered down, the first terminal is about to be dormant, the first terminal is about to be restarted, and the like.
And obtaining a time message by responding to the received time data and the first target data, wherein the first target data comprises state data of the first terminal, when the first terminal is about to stop working, a subsequent asynchronous instruction is obtained, and the time message is obtained by combining the subsequent asynchronous instruction and the time data, so that the second terminal uses a built-in time module for timing. When the first terminal is about to enter a non-working state, the time synchronization of the time data obtained outwards on the second terminal can be stopped, the occupation of processing resources on the second terminal is reduced, and the time precision on the second terminal is improved.
When the first terminal is about to sleep, a subsequent unsynchronized instruction is obtained, and a time message is obtained by combining the subsequent unsynchronized instruction with time data, so that realtem_ub in the time message is 0, and after the time synchronization, the second terminal does not perform time synchronization, and a time module built in the second terminal is used for timing. When the first terminal works normally, a subsequent synchronization instruction is obtained, and a time message is obtained by combining the subsequent synchronization instruction with time data, so that realtem_ub in the time message is 1, and the second terminal performs time synchronization according to the time data.
Further methods of time synchronization provided by embodiments of the present application are described in detail below.
The execution subject of the time synchronization method may be the second terminal 120 of fig. 1 described above.
Fig. 7 is a flowchart of a time synchronization method applied to a second terminal according to an embodiment of the present application.
As shown in fig. 7, the time synchronization method applied to the second terminal provided in the embodiment of the present application includes:
s710, responding to the received time message, analyzing and obtaining time data, and synchronizing the time on the second terminal with the time data;
s720, sending second target data to the vehicle terminal so as to synchronize the time of the first vehicle on-board with the second terminal.
And analyzing and obtaining time data in response to the received time message, synchronizing the time on the second terminal with the time data, and sending second target data to the vehicle terminal so as to synchronize the time of the first vehicle on the vehicle terminal with the second terminal, thereby realizing the synchronization of the time on the second terminal and the vehicle terminal.
Fig. 8 is a flowchart of a time synchronization method applied to a second terminal according to another embodiment of the present application.
As shown in fig. 8, in some alternative embodiments of the present application, in order to improve the time precision on the second terminal, in response to receiving the time packet, parsing to obtain synchronization data, synchronizing the time on the second terminal with the time data may include:
s810, in response to receiving the time message, analyzing and obtaining the time data and the synchronous control instruction, and enabling the second terminal to perform subsequent time synchronization according to the synchronous control instruction.
In S810, the synchronization control instruction may include synchronization and synchronization to be terminated, where the synchronization control instruction synchronizes the time on the second terminal with the time data when the synchronization control instruction is synchronization, synchronizes the time on the second terminal with the time data when the synchronization control instruction is synchronization to be terminated, and starts a path for acquiring the time data using a time module built in the second terminal.
By responding to the received time message and analyzing to obtain the time data and the synchronous control instruction, the second terminal performs time synchronization according to the synchronous control instruction, so that the second terminal can stop time synchronization when the first terminal is about to enter a non-working state, and the time module carried by the second terminal is used for timing, thereby ensuring the continuity of time synchronization between the second terminal and the vehicle terminal and improving the accuracy of the time synchronization from the second terminal to the vehicle terminal.
In some optional embodiments of the present application, in response to receiving the time message, parsing the time data and the synchronization control instruction, so that the second terminal performs subsequent time synchronization according to the synchronization control instruction, including:
responding to the received time message, analyzing and obtaining time data and a synchronous control instruction;
when the synchronous control instruction is a subsequent synchronous instruction and the subsequent synchronous time is used, the time data of the time message received by the second terminal is used,
and when the synchronous control instruction is a subsequent asynchronous instruction and the subsequent synchronous time is performed, acquiring time data by using a time module built in the second terminal.
In some optional embodiments of the present application, when the synchronization control instruction is a subsequent unsynchronized instruction, the acquiring time data using the time module built in the second terminal when synchronizing time later includes:
and when the synchronous control instruction is a subsequent asynchronous instruction, starting a time module built-in the second terminal to count time, and acquiring time data by using the time module built-in the second terminal when the subsequent synchronous time is realized.
Further methods of time synchronization provided by embodiments of the present application are described in detail below.
Fig. 9 is a flowchart of a time synchronization method according to an embodiment of the present application.
As shown in fig. 9, a time synchronization method includes:
s910, in response to the starting of the first terminal, acquiring communication environment data of a plurality of time acquisition paths, acquiring time data from paths with better communication environments in the plurality of time acquisition paths, and acquiring the time data by using a time module built in the first terminal when the communication environments of the plurality of time acquisition paths are worse, wherein the time acquisition paths are communication paths of the first terminal, and the time data are time when acquisition requests are received on each time acquisition path;
s920, the first terminal responds to the time data to acquire first target data, wherein the first target data comprises state data of the first terminal;
s930, according to the first target data, when the first terminal is about to stop working, a synchronous control instruction is obtained, and a time message is obtained by combining the synchronous control instruction and time data, so that the synchronous time of the second terminal is timed by using a built-in time module;
s940, the first terminal sends a time message to the second terminal;
s950, the second terminal responds to the received time message, analyzes and obtains time data and a synchronous control instruction, synchronizes the time on the second terminal with the time data, and enables the second terminal to perform subsequent time synchronization according to the synchronous control instruction;
s960, sending second target data to the terminal so as to synchronize the time of the first vehicle on the terminal with the second terminal.
Some time synchronization apparatuses provided by embodiments of the present application are described in detail below.
Fig. 10 is a schematic structural diagram of a time synchronization device applied to a first terminal according to an embodiment of the present application.
As shown in fig. 10, the time synchronization apparatus applied to the first terminal includes:
an acquiring module 1010, configured to acquire time data from a plurality of time acquisition paths, where the time acquisition paths are communication paths of the first terminal, and the time data is a time when an acquisition request is received on each time acquisition path;
a first receiving module 1020, configured to generate a time message in response to receiving time data fed back by any time acquisition path;
the first sending module 1030 is configured to send a time message to the second terminal, so that the second terminal controls, according to the time message, time of the first vehicle on the terminal to be synchronous with time data, where the first vehicle is a vehicle on which the second terminal is mounted.
Fig. 11 is a schematic structural diagram of a time synchronization device applied to a second terminal according to an embodiment of the present application.
Further time synchronization devices provided by embodiments of the present application are described in detail below.
As shown in fig. 11, the time synchronization apparatus applied to the second terminal includes:
a second receiving module 1110, configured to parse and obtain time data in response to receiving the time message, and synchronize time on the second terminal with the time data;
and the second sending module 1120 is configured to send second target data to the vehicle terminal, so that the time of the first vehicle on the vehicle terminal is synchronized with the second terminal.
Fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
As shown in fig. 12, the electronic device may include a processor 1201 and a memory 1202 storing computer programs or instructions.
In particular, the processor 1201 may include a Central Processing Unit (CPU), or Application specific integrated circuit (Application SpecificIntegratedCircuit, ASIC), or may be configured as one or more integrated circuits to implement embodiments of the present application.
Memory 1202 may include mass storage for data or instructions. By way of example, and not limitation, memory 1202 may include a hard disk drive (HardDiskDrive, HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or universal serial bus (UniversalSerialBus, USB) drive, or a combination of two or more of these. Memory 1202 may include removable or non-removable (or fixed) media where appropriate. Memory 1202 may be internal or external to the integrated gateway disaster recovery device, where appropriate. In a particular embodiment, the memory 1202 is a non-volatile solid-state memory. The memory may include read-only memory (ReadOnlyMemoryimage, ROM), random access memory (Random-AccessMemory, RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical, or other physical/tangible memory storage devices. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software comprising computer-executable instructions and when the software is executed (e.g., by one or more processors) it is operable to perform the operations described in the time synchronization methods provided by the above embodiments.
The processor 1201 implements any of the time synchronization methods of the above embodiments by reading and executing computer program instructions stored in the memory 1202.
In one example, the electronic device may also include a communication interface 1203 and a bus 1210. As shown in fig. 12, the processor 1201, the memory 1202, and the communication interface 1203 are connected to each other via a bus 1210 and perform communication with each other.
The communication interface 1203 is mainly used for implementing communication among the modules, devices, units and/or devices in the embodiment of the present application.
Bus 1210 includes hardware, software, or both, coupling components of an electronic device to each other. By way of example, and not limitation, the buses may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a micro channel architecture (MCa) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus, or a combination of two or more of the above. Bus 1210 may include one or more buses, where appropriate. Although embodiments of the application have been described and illustrated with respect to a particular bus, the application contemplates any suitable bus or interconnect.
The electronic device can execute the time synchronization method in the embodiment of the application, thereby realizing the time synchronization method described in each embodiment.
In addition, in combination with the time synchronization method in the above embodiment, the embodiment of the present application may be implemented by providing a readable storage medium. The readable storage medium has program instructions stored thereon; the program instructions, when executed by a processor, implement any of the time synchronization methods of the above embodiments.
In addition, in combination with the time synchronization method in the above embodiment, the embodiment of the present application may provide a computer program product, where the instructions in the computer program product when executed by the processor of the electronic device enable the electronic device to perform any one of the time synchronization methods in the above embodiment.
It should be understood that the application is not limited to the particular arrangements and instrumentality described above and shown in the drawings. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between steps, after appreciating the spirit of the present application.
The functional blocks shown in the above-described structural block diagrams may be implemented in hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, a plug-in, a function card, or the like. When implemented in software, the elements of the application are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine readable medium or transmitted over transmission media or communication links by a data signal carried in a carrier wave. A "machine-readable medium" may include any medium that can store or transfer information. Examples of machine-readable media include electronic circuitry, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio Frequency (RF) links, and the like. The code segments may be downloaded via computer networks such as the internet, intranets, etc.
It should also be noted that the exemplary embodiments mentioned in this disclosure describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, or may be performed in a different order from the order in the embodiments, or several steps may be performed simultaneously.
Aspects of the present application are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to being, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware which performs the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In the foregoing, only the specific embodiments of the present application are described, and it will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the systems, modules and units described above may refer to the corresponding processes in the foregoing method embodiments, which are not repeated herein. It should be understood that the scope of the present application is not limited thereto, and any equivalent modifications or substitutions can be easily made by those skilled in the art within the technical scope of the present application, and they should be included in the scope of the present application.
Claims (15)
1. A method of time synchronization, applied to a first terminal, the method comprising:
acquiring time data from a plurality of time acquisition paths, wherein the time acquisition paths are communication paths of the first terminal, and the time data are time when acquisition requests are received on each time acquisition path;
generating a time message in response to receiving the time data fed back by any time acquisition path;
and sending the time message to a second terminal so that the second terminal controls the time of the first vehicle on the terminal to be synchronous with the time data according to the time message, wherein the first vehicle is a vehicle carrying the second terminal.
2. The time synchronization method of claim 1, wherein the time acquisition path comprises a platform path, a GPS path, and a network time protocol path.
3. The time synchronization method according to claim 1, wherein acquiring time data from a plurality of time acquisition paths includes:
and responding to the starting of the first terminal, acquiring time data from a plurality of time acquisition paths.
4. The method of claim 3, wherein the starting of the first terminal comprises an application critical restart, a system critical restart, and a power-off critical restart.
5. The time synchronization method according to claim 1, wherein acquiring time data from a plurality of time acquisition paths includes:
acquiring communication environment data of a plurality of time acquisition paths;
and acquiring time data by using a path with a better communication environment from a plurality of time acquisition paths.
6. The time synchronization method according to claim 5, wherein the time data is acquired using one of a plurality of time acquisition paths, which is better in communication environment, further comprising:
when the communication environments of the plurality of time acquisition paths are poor, the time data are acquired by using the time module built in the first terminal.
7. The method of claim 6, wherein generating a time message in response to receiving the time data fed back by any one of the time acquisition paths comprises:
acquiring first target data in response to receiving the time data, wherein the first target data comprises state data of a first terminal;
and acquiring a synchronous control instruction according to the first target data, and acquiring a time message by combining the synchronous control instruction and the time data so as to enable the second terminal to perform subsequent time synchronization according to the synchronous control instruction.
8. The method according to claim 7, wherein the first target data includes an operation state normal and an operation to be stopped, the synchronization control instruction includes a subsequent synchronization instruction and a subsequent non-synchronization instruction, the subsequent synchronization instruction being an instruction obtained when the first terminal is in the operation state normal, the subsequent non-synchronization instruction being an instruction obtained when the first terminal is to be stopped,
according to the first target data, a synchronous control instruction is obtained, and a time message is obtained by combining the synchronous control instruction and the time data, wherein the method comprises the following steps:
when the working state of the first terminal is normal, a subsequent synchronous instruction is obtained, and a time message is obtained by combining the subsequent synchronous instruction and the time data so as to enable the second terminal to normally perform subsequent time synchronization,
when the first terminal stops working, a subsequent asynchronous instruction is obtained, and a time message is obtained by combining the subsequent asynchronous instruction and the time data, so that the second terminal uses a built-in time module to obtain the time data when the second terminal subsequently synchronizes time.
9. A method of time synchronization, applied to a second terminal, the method comprising:
responding to the received time message, analyzing and obtaining time data, and synchronizing the time on the second terminal with the time data;
and sending the second target data to the vehicle terminal so as to synchronize the time of the first vehicle on the vehicle terminal with the second terminal.
10. The method of claim 9, wherein in response to receiving the time message, parsing to obtain synchronization data synchronizes time on the second terminal with the time data, comprising:
and responding to the received time message, analyzing and obtaining time data and a synchronous control instruction, and enabling the second terminal to perform subsequent time synchronization according to the synchronous control instruction.
11. The method according to claim 10, wherein in response to receiving the time message, parsing the time data and the synchronization control command to enable the second terminal to perform subsequent time synchronization according to the synchronization control command, comprising:
responding to the received time message, analyzing and obtaining time data and a synchronous control instruction;
when the synchronous control instruction is a subsequent synchronous instruction and the subsequent synchronous time is used, the time data of the time message received by the second terminal is used,
and when the synchronous control instruction is a subsequent asynchronous instruction and the subsequent synchronous time, acquiring time data by using a time module built in the second terminal.
12. The time synchronization method according to claim 11, wherein when the synchronization control instruction is a subsequent unsynchronized instruction, the time data is acquired using a time module built in the second terminal when the time is subsequently synchronized, comprising:
and when the synchronous control instruction is a subsequent asynchronous instruction, starting a time module built-in the second terminal to count time, and acquiring time data by using the time module built-in the second terminal when the subsequent synchronous time is realized.
13. A time synchronization device for use in a first terminal, the device comprising:
the acquisition module is used for acquiring time data from a plurality of time acquisition paths, wherein the time acquisition paths are communication paths of the first terminal, and the time data are the time when the acquisition request is received on each time acquisition path;
the first receiving module is used for responding to the time data fed back by the receiving path at any time to generate a time message;
the first sending module is used for sending a time message to the second terminal so that the second terminal controls the time of the first vehicle on the terminal to be synchronous with the time data according to the time message, and the first vehicle is a vehicle carrying the second terminal.
14. A time synchronization device for use in a second terminal, the device comprising:
the second receiving module is used for responding to the received time message, analyzing and obtaining time data and synchronizing the time on the second terminal with the time data;
and the second sending module is used for sending second target data to the vehicle terminal so as to synchronize the time of the first vehicle on-board with the second terminal.
15. A time synchronization system, the system comprising:
a first terminal for implementing the time synchronization method according to any one of claims 1-8;
a second terminal for implementing the time synchronization method according to any one of claims 9-12;
and the vehicle-mounted terminal is used for receiving the second target data and synchronizing time according to the second target data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310611445.2A CN116582834A (en) | 2023-05-26 | 2023-05-26 | Time synchronization method, device and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310611445.2A CN116582834A (en) | 2023-05-26 | 2023-05-26 | Time synchronization method, device and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116582834A true CN116582834A (en) | 2023-08-11 |
Family
ID=87535626
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310611445.2A Pending CN116582834A (en) | 2023-05-26 | 2023-05-26 | Time synchronization method, device and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116582834A (en) |
-
2023
- 2023-05-26 CN CN202310611445.2A patent/CN116582834A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103988453B (en) | Method for synchronizing clocks in nodes of a vehicle network and node designed to perform the method | |
EP3846379A1 (en) | Clock synchronization method and apparatus, system, storage medium, and electronic device | |
CN112769517B (en) | T-BOX time synchronization method and device | |
CN111130673B (en) | Vehicle-mounted terminal time synchronization method and system | |
CN113271169B (en) | Vehicle time service method and system based on wireless communication terminal | |
CN105700337B (en) | Clock synchronizing method and device applied to car-mounted terminal | |
CN107402534B (en) | Adjusting method, EtherCAT main station and computer readable storage medium | |
CN112394634A (en) | Time service method, device, equipment and storage medium for vehicle-mounted computing platform | |
US9736801B1 (en) | Methods and apparatus for synchronizing devices in a wireless data communication system | |
CN111511013B (en) | Method, electronic device, and computer storage medium for synchronizing control signals | |
CN112787742A (en) | Clock synchronization method and device, wireless earphone and readable storage medium | |
CN113075710A (en) | Positioning difference information acquisition method, device, equipment and computer storage medium | |
CN117639991A (en) | Time synchronization method and device for vehicle | |
US10142934B2 (en) | Wireless communication apparatus and communication system | |
CN113630364B (en) | Equipment end, server end, network system and network connection method | |
CN117793879A (en) | Method, device, equipment and storage medium for determining synchronization source | |
CN116582834A (en) | Time synchronization method, device and system | |
CN113396553B (en) | Clock switching method, device and storage medium | |
WO2016000324A1 (en) | Method and apparatus for implementing time synchronization | |
CN112332955B (en) | Data synchronization method, system and storage medium | |
CN115250159B (en) | Time synchronization method, device, electronic equipment, storage medium and program product | |
CN115604306A (en) | Data sending method, device, equipment and medium | |
CN112272070B (en) | Method, system, equipment and readable storage medium for accurate time synchronization of SAS expander | |
CN116243586B (en) | Vehicle time correction method and related equipment | |
CN116527190A (en) | Method and device for synchronizing vehicle time, vehicle and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |