CN113098939B - Data transmission method, data transmission device and electronic equipment - Google Patents

Data transmission method, data transmission device and electronic equipment Download PDF

Info

Publication number
CN113098939B
CN113098939B CN202110320169.5A CN202110320169A CN113098939B CN 113098939 B CN113098939 B CN 113098939B CN 202110320169 A CN202110320169 A CN 202110320169A CN 113098939 B CN113098939 B CN 113098939B
Authority
CN
China
Prior art keywords
time
event
data
transmitted
generated
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.)
Active
Application number
CN202110320169.5A
Other languages
Chinese (zh)
Other versions
CN113098939A (en
Inventor
刘均
曾良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Golo Iov Data Technology Co ltd
Original Assignee
Golo Iov Data Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Golo Iov Data Technology Co ltd filed Critical Golo Iov Data Technology Co ltd
Priority to CN202110320169.5A priority Critical patent/CN113098939B/en
Publication of CN113098939A publication Critical patent/CN113098939A/en
Application granted granted Critical
Publication of CN113098939B publication Critical patent/CN113098939B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)
  • Electric Clocks (AREA)

Abstract

The application discloses a data transmission method, a data transmission device, electronic equipment and a computer readable storage medium. Wherein the method comprises the following steps: acquiring a data transmission instruction; determining data to be transmitted according to the data transmission instruction, wherein the data to be transmitted comprises event information and a time verification mark of an event; judging whether the time check mark of the event is not checked, if so, checking the generation time of the event to obtain the target time of event generation; replacing event generation time in the data to be transmitted with target time to obtain updated data to be transmitted; and transmitting the updated data to be transmitted to a transmission object in the data transmission instruction. According to the scheme, the situation that the electronic equipment transmits data which is not calibrated can be avoided.

Description

Data transmission method, data transmission device and electronic equipment
Technical Field
The application belongs to the technical field of data processing, and particularly relates to a data transmission method, a data transmission device, electronic equipment and a computer readable storage medium.
Background
When uploading data, the electronic device often needs to determine the generation time of the data so as to facilitate the subsequent inquiry about when an event generating the data occurs, and then can effectively process the event. However, some electronic devices do not have a clock function, which may cause the electronic device to directly upload the data that is not calibrated because the electronic device cannot know the generation time of the data, which affects the subsequent processing of the event.
Disclosure of Invention
The application provides a data transmission method, a data transmission device, electronic equipment and a computer readable storage medium, which can avoid the situation that the electronic equipment transmits uncorrected data.
In a first aspect, the present application provides a data transmission method, including:
acquiring a data transmission instruction;
determining data to be transmitted according to the data transmission instruction, wherein the data to be transmitted comprises event information and a time verification mark of an event;
judging whether the time check mark of the event is not checked,
if yes, checking the generation time of the event to obtain the target time of event generation;
replacing the event generation time in the data to be transmitted with a target time to obtain updated data to be transmitted;
And transmitting the updated data to be transmitted to a transmission object in the data transmission instruction.
Optionally, the verifying the time of generating the event to obtain the target time of generating the event specifically includes:
acquiring a first time generated by an event in the event information, wherein the first time is a local time counted by a timer of the electronic equipment when the event is generated;
acquiring a second time in the event information, wherein the second time is obtained by a server based on a timing moment sent by a timing request;
acquiring a third time in the event information, wherein the third time is based on the time counted by a timer of the electronic equipment when the electronic equipment receives the timing moment of the server;
and obtaining the target time of event generation according to the first time, the second time and the third time.
Optionally, the obtaining the target time of the event generation according to the first time, the second time and the third time specifically includes:
subtracting the third time from the second time, and adding the first time to obtain a time stamp when the event in the data to be transmitted occurs;
And determining the target time of the event generation based on the time stamp of the event generation in the data to be transmitted.
Optionally, the determining the target time of the event generation based on the time stamp of the event generation in the data to be transmitted specifically includes:
and calling a preset first time conversion function to convert a time stamp generated by the event in the data to be transmitted, so as to obtain the target time generated by the event expressed by coordinated universal time UTC.
Optionally, the method further comprises:
when an event in the data to be transmitted is generated, recording time information of the event, determining that a time check mark of the event is not checked, defaulting the time information to be a first time, wherein the first time is a local time based on the timer of the electronic equipment when the event is generated;
after the target time generated by the event is obtained, the time information of the event is updated to the target time, and the time check mark of the event is updated to be checked.
Optionally, the method further comprises:
and if the time check mark of the event is checked, transmitting the data to be transmitted according to the data transmission instruction.
In a second aspect, the present application provides a data transmission apparatus, comprising:
the acquisition unit is used for acquiring the data transmission instruction;
the determining unit is used for determining data to be transmitted according to the data transmission instruction, wherein the data to be transmitted comprises event information and event time check marks;
the judging unit is used for judging whether the time check mark of the event is unverified;
the verification unit is used for verifying the generation time of the event if the time verification mark is not verified, so as to obtain the target time of the event generation;
the replacing unit is used for replacing the event generating time in the data to be transmitted with the target time to obtain updated data to be transmitted;
and the transmission unit is used for transmitting the updated data to be transmitted to a transmission object in the data transmission instruction.
Optionally, the verification unit includes:
a first time obtaining subunit, configured to obtain a first time generated by an event in the event information, where the first time is a local time counted by a timer of the electronic device when the event is generated;
a second time obtaining subunit, configured to obtain a second time in the event information, where the second time is obtained by the server based on a timing time sent by the timing request;
A third time obtaining subunit, configured to obtain a third time in the event information, where the third time is a time based on a timer of the electronic device when the electronic device receives the timing time of the server;
and the target time acquisition subunit is used for acquiring the target time generated by the event according to the first time, the second time and the third time.
Optionally, the target time obtaining subunit includes:
a time stamp calculating subunit, configured to subtract the third time from the second time and add the first time to obtain a time stamp when the event in the data to be transmitted occurs;
and the target time determining subunit is used for determining the target time generated by the event based on the time stamp generated by the event in the data to be transmitted.
Optionally, the target time determining subunit is specifically configured to call a preset first time conversion function to convert a timestamp generated when the event in the data to be transmitted occurs, so as to obtain a target time generated by the event expressed by coordinated universal time UTC.
Optionally, the data transmission device further includes:
a recording unit, configured to record time information of an event when the event in the data to be transmitted is generated, and determine that a time check flag of the event is not checked, where the time information defaults to a first time, and the first time is a local time based on a timer of the electronic device when the event is generated;
And the updating unit is used for updating the time information of the event into the target time after obtaining the target time generated by the event, and updating the time check mark of the event into checked.
Optionally, the transmitting unit is further configured to transmit the data to be transmitted according to the data transmission instruction if it is determined that the time check flag of the event is checked.
In a third aspect, the present application provides an electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method of the first aspect when executing the computer program.
In a fourth aspect, the present application provides a computer readable storage medium storing a computer program which, when executed by a processor, performs the steps of the method of the first aspect described above.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by one or more processors, implements the steps of the method of the first aspect described above.
Compared with the prior art, the beneficial effects that this application exists are: after the electronic device obtains the data transmission instruction, determining data to be transmitted according to the data transmission instruction, wherein the data to be transmitted comprises event information and a time verification mark of an event, judging whether the time verification mark of the event is unverified, if so, verifying the generation time of the event to obtain the target time of event generation, replacing the event generation time in the data to be transmitted with the target time to obtain updated data to be transmitted, and finally transmitting the updated data to be transmitted to a transmission object in the data transmission instruction. According to the scheme, whether the data to be transmitted are calibrated or not is determined through the time check mark, for the data to be transmitted which are not calibrated, the electronic equipment can obtain the target time of event generation through calibration, and the event generation time corresponding to the data to be transmitted is replaced by the target time and then transmitted, so that the fact that all data transmitted by the electronic equipment are calibrated can be guaranteed, and a transmission object can process corresponding events in time. It will be appreciated that the advantages of the second to fifth aspects may be found in the relevant description of the first aspect, and are not described here again.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following description will briefly introduce the drawings that are needed in the embodiments or the description of the prior art, it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic implementation flow chart of a data transmission method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a specific implementation of step 104 in the data transmission method provided in the embodiment of the present application;
FIG. 3 is a schematic diagram of a first time, a second time and a third time according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a data transmission device according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
When uploading data, an electronic device often needs to determine the generation time of the data, so as to facilitate the subsequent query when an event generating the data occurs. For example, for the position data, only knowing the positioning time corresponding to each position data, a continuous track can be drawn to restore the real running track of the electronic device; for the alarm data, the electronic equipment can be timely and effectively treated based on the alarm data only if the alarm time corresponding to the alarm data is known. However, some electronic devices do not have a clock function, which may cause the electronic device to be unable to know the generation time of the data, which requires the electronic device to perform the time-checking operation in advance. Currently, the time of an electronic device is typically manually checked by a user before using the electronic device. However, this data transmission method is cumbersome, and in particular, for an embedded device without a man-machine interface, the operability is not high. Based on this, the embodiment of the application provides a data transmission method, a data transmission device, an electronic device and a computer readable storage medium, which can enable the electronic device without a man-machine interaction interface to realize automatic timing so as to avoid the transmission of data which is not timing. In order to illustrate the technical solutions proposed in the embodiments of the present application, the following description is made by specific embodiments.
The following describes a data transmission method proposed in the embodiment of the present application. Referring to fig. 1, the data transmission method is applied to an electronic device, and includes:
step 101, acquiring a data transmission instruction.
In the embodiment of the application, the electronic equipment can receive the data transmission instruction directly input by the user; alternatively, the electronic device may also receive data transmission instructions sent by other devices (e.g., servers); alternatively, the electronic device itself may generate the data transmission instruction periodically, and the manner of acquiring the data transmission instruction is not limited herein.
Step 102, determining data to be transmitted according to the data transmission instruction.
In the embodiment of the present application, the data transmission instruction points to the data to be transmitted currently, that is, the data to be transmitted. Meanwhile, the data transmission instruction also carries a transmission destination for pointing to a corresponding transmission object. That is, by the data transmission instruction, the electronic device can know which data is currently transmitted to which transmission object.
Based on the above, the corresponding data to be transmitted can be determined in the local storage space of the electronic device according to the data transmission instruction. It will be appreciated that the data to be transmitted by an electronic device is typically generated based on events occurring on the electronic device. Therefore, a piece of data to be transmitted corresponds to an event, and in general, the data to be transmitted includes event information and a time check mark of the event; the event information includes not only information generated by the event but also related time information (such as event generation time, etc.) of the event; the time check mark of the event has two states, namely checked and unchecked, wherein the checked related time information of the event completes the check operation, and the unchecked related time information of the event does not complete the check operation.
Step 103, judging whether the time check mark of the event is not checked, if yes, executing step 105, and if not, executing step 104.
In this embodiment of the present application, before the electronic device transmits the data to be transmitted, it is first determined whether the time check mark of the event is not checked, so as to determine whether a check operation is further required. If the verification is not determined, jumping to execute step 105 to perform the verification operation; otherwise, if it is determined that the data is verified, it is known that the verification operation is completed, and step 104 may be skipped to directly transmit the data to be transmitted.
Step 104, transmitting the data to be transmitted to a transmission object in the data transmission instruction.
Step 105, checking the generation time of the event to obtain the target time of event generation.
In the embodiments of the present application, there are typically one or more timers within the electronic device. When the electronic device is powered on, it will immediately initialize and start a timer inside it. In general, a timer counts seconds to indicate what second is currently the time after the electronic device is started, that is, how long the current time has elapsed from the start time of the electronic device. The electronic equipment can rely on the timer and a preset timing server to check the generation time of the event, so that the real time of the event can be obtained, and the real time is the target time.
And 106, replacing the event generation time in the data to be transmitted with the target time to obtain updated data to be transmitted.
In this embodiment of the present application, the electronic device may replace the event generation time originally carried in the data to be transmitted with the target time obtained in step 105, so that the data to be transmitted also carries the real time when the event is generated, which is convenient for the subsequent receiver (i.e. the transmission object) of the data to be transmitted to better process the data to be transmitted.
Step 107, transmitting the updated data to be transmitted to the transmission object in the data transmission instruction.
In some embodiments, the step 104 may specifically include:
step 201, obtaining a first time generated by an event in the event information, where the first time is a local time counted by a timer of the electronic device when the event is generated.
In this embodiment of the present application, for an electronic device, once an event that needs to be reported is generated, a timer may be read immediately, and the read timing result is the first time generated by the event, which is used to indicate the time period from when the electronic device is started to when the event is generated.
Step 202, obtaining a second time in the event information, where the second time is obtained by the server based on the timing moment sent by the timing request.
In this embodiment of the present application, the electronic device should have a networking function, and may establish a communication connection with a preset server, for example, a cloud server such as a timing server and a data server. Thus, after the event occurs, the electronic device may send a timing request to a preset timing server, which refers to a server having a function of checking time, to perform a timing operation. The timing server may be, for example, a NTP (Network Time Protocol) server or a global positioning system (Global Positioning System, GPS) server, etc. The time synchronization of the electronic equipment and the time correction server is realized by providing the accurate current time for the electronic equipment through the time correction server, and the accurate current time is the time correction time returned by the time correction server. In general, the timing time obtained by the electronic device is expressed in the time format of universal coordinated time (Universal Time Coordinated, UTC), that is, xx is a fraction of xx seconds. In order to keep the unit of the first time unified, the electronic equipment processes the time correction moment, and converts the time correction moment into a time length of 0 minute and 0 seconds from 1 month 1 day 0 time 1 month 1 day 1970 through a preset second time conversion function, wherein the time length is in seconds, and a conversion result is the second time. The second time is considered to be a time stamp of the time of the school time, and the concept of the time stamp is the number of seconds elapsed since 1 month 1 in 1970 (midnight of UTC/GMT), irrespective of leap seconds. For example only, the second time transfer function may be a time function in a standard C library, which is not limited herein.
Step 203, obtaining a third time in the event information, where the third time is a time counted by a timer of the electronic device when the electronic device receives the timing time of the server.
In the embodiment of the application, when the timing is successful, that is, when the timing moment fed back by the timing server based on the timing request is received, the timer is read again. For ease of understanding and computation, the data interaction of the electronic device with the timing server is considered to be very short lived; that is, although the transmission of the timing request, the feedback of the timing time and the operation of reading the timer again occur sequentially, since the occurrence speed is very fast, the three operations are completed in almost one instant, and thus, it can be regarded as being completed at the same time approximately; that is, it is approximately considered that all three occur at the timing point. Based on this, the result of the timing obtained by reading the timer again in this step can be regarded as a third time, which can be used to represent the duration from the start of the electronic device to the timing moment. That is, the electronic device obtains two times, the second time and the third time, respectively, based on the timing operation.
It is understood that the first time, the second time and the third time may be stored in the time related information of the event. That is, the event information includes time-related information of the event, and the time-related information of the event includes a first time, a second time, and a third time of the event.
Step 204, obtaining the target time of event generation according to the first time, the second time and the third time.
In this embodiment of the present application, the electronic device may subtract the third time from the second time and add the first time to obtain a time stamp of the event, that is, a time length of 0 minutes 0 seconds from 0 minutes 0 seconds of 1 month 1 day in 1970 to the time of generating the event, so that a real time (expressed as a specific time) of the event generated can be determined based on the time stamp of the event generated, specifically, the time stamp of the event generated is converted by a preset first time conversion function, and a conversion result is the real time of the event generated expressed by UTC.
As described above, the time correction operation is understood as an operation completed at one instant, and referring to fig. 3, fig. 3 shows an illustration of the first time, the second time and the third time on the same time axis, where T1 is the first time, T2 is the second time, T3 is the third time, and t2—t3+t1=t. As can be seen from fig. 2, T is the time period from 1970, 1, 0 minutes, 0 seconds to the occurrence of the event, and after converting T into UTC time, it can be known how the event is generated in what year, month, day, time, minutes, and seconds. It should be noted that, the embodiment of the present application does not limit when the electronic device performs the timing operation; that is, any time may be selected to perform the timing operation to obtain the second time and the third time after the event is generated, which is not limited herein.
In some embodiments, when an event is generated, the electronic device further records a time check mark and time information of the event in a space in which the event can be saved when the event is powered down, wherein the time check mark defaults to a preset first value (for example, "0"), and the time information defaults to a first time read based on the event. In practice, the time check flag may be considered as a flag (flag) to indicate whether the time information of the event has been timed. After the electronic device has obtained the target time generated by the event, the time information of the event can be updated to the corresponding target time, and the time check mark of the event is updated to a preset second value (for example, 1) to indicate that the time information of the event has been calibrated. It should be noted that when a plurality of events are generated, the events are sequentially recorded in the power-down storable space according to the sequence from the early to the late of the generation time of the events; that is, the first generated event will be recorded first.
It can be seen that, through the embodiment of the present application, after a data transmission instruction is obtained, an electronic device determines data to be transmitted according to the data transmission instruction, where the data to be transmitted includes event information and a time check mark of an event, and determines whether the time check mark of the event is non-checked, if yes, checks the generation time of the event to obtain a target time of event generation, then replaces the event generation time in the data to be transmitted with the target time to obtain updated data to be transmitted, and finally transmits the updated data to be transmitted to a transmission object in the data transmission instruction. According to the scheme, whether the data to be transmitted are calibrated or not is determined through the time check mark, for the data to be transmitted which are not calibrated, the electronic equipment can obtain the target time of event generation through calibration, and the event generation time corresponding to the data to be transmitted is replaced by the target time and then transmitted, so that the fact that all data transmitted by the electronic equipment are calibrated can be guaranteed, and a transmission object can process corresponding events in time.
Corresponding to the data transmission method provided above, the embodiment of the application also provides a data transmission device. As shown in fig. 4, the data transmission device 4 includes:
an acquiring unit 401, configured to acquire a data transmission instruction;
a determining unit 402, configured to determine data to be transmitted according to the data transmission instruction, where the data to be transmitted includes event information and a time check mark of an event;
a judging unit 403, configured to judge whether the time check mark of the event is unverified;
a verification unit 404, configured to verify the generation time of the event if the time verification flag is not verified, so as to obtain a target time of event generation;
a replacing unit 405, configured to replace the event generating time in the data to be transmitted with a target time, to obtain updated data to be transmitted;
and a transmission unit 406, configured to transmit the updated data to be transmitted to a transmission object in the data transmission instruction.
Optionally, the verification unit 404 includes:
a first time obtaining subunit, configured to obtain a first time generated by an event in the event information, where the first time is a local time counted by a timer of the electronic device when the event is generated;
A second time obtaining subunit, configured to obtain a second time in the event information, where the second time is obtained by the server based on a timing time sent by the timing request;
a third time obtaining subunit, configured to obtain a third time in the event information, where the third time is a time based on a timer of the electronic device when the electronic device receives the timing time of the server;
and the target time acquisition subunit is used for acquiring the target time generated by the event according to the first time, the second time and the third time.
Optionally, the target time obtaining subunit includes:
a time stamp calculating subunit, configured to subtract the third time from the second time and add the first time to obtain a time stamp when the event in the data to be transmitted occurs;
and the target time determining subunit is used for determining the target time generated by the event based on the time stamp generated by the event in the data to be transmitted.
Optionally, the target time determining subunit is specifically configured to call a preset first time conversion function to convert a timestamp generated when the event in the data to be transmitted occurs, so as to obtain a target time generated by the event expressed by coordinated universal time UTC.
Optionally, the data transmission device 4 further includes:
a recording unit, configured to record time information of an event when the event in the data to be transmitted is generated, and determine that a time check flag of the event is not checked, where the time information defaults to a first time, and the first time is a local time based on a timer of the electronic device when the event is generated;
and the updating unit is used for updating the time information of the event into the target time after obtaining the target time generated by the event, and updating the time check mark of the event into checked.
Optionally, the transmitting unit 406 is further configured to transmit the data to be transmitted according to the data transmission instruction if it is determined that the time check flag of the event is checked.
From the above, according to the present application, after the electronic device obtains the data transmission instruction, the electronic device determines to-be-transmitted data according to the data transmission instruction, where the to-be-transmitted data includes event information and a time check mark of an event, and determines whether the time check mark of the event is non-checked, if yes, checks the generation time of the event to obtain a target time of event generation, then replaces the event generation time in the to-be-transmitted data with the target time to obtain updated to-be-transmitted data, and finally transmits the updated to-be-transmitted data to a transmission object in the data transmission instruction. According to the scheme, whether the data to be transmitted are calibrated or not is determined through the time check mark, for the data to be transmitted which are not calibrated, the electronic equipment can obtain the target time of event generation through calibration, and the event generation time corresponding to the data to be transmitted is replaced by the target time and then transmitted, so that the fact that all data transmitted by the electronic equipment are calibrated can be guaranteed, and a transmission object can process corresponding events in time.
Corresponding to the data transmission method provided above, the embodiment of the application also provides electronic equipment. Referring to fig. 5, an electronic device 5 in an embodiment of the present application includes: memory 501, one or more processors 502 (only one shown in fig. 5) and computer programs stored on memory 501 and executable on the processors. Wherein: the memory 501 is used for storing software programs and units, and the processor 502 executes various functional applications and diagnoses by running the software programs and units stored in the memory 501 to obtain the resources corresponding to the preset events. Specifically, the processor 502 realizes the following steps by running the above-described computer program stored in the memory 501:
acquiring a data transmission instruction;
determining data to be transmitted according to the data transmission instruction, wherein the data to be transmitted comprises event information and a time verification mark of an event;
judging whether the time check mark of the event is unverified;
if yes, checking the generation time of the event to obtain the target time of event generation;
replacing the event generation time in the data to be transmitted with a target time to obtain updated data to be transmitted;
And transmitting the updated data to be transmitted to a transmission object in the data transmission instruction.
In a second possible implementation manner provided by the first possible implementation manner, assuming that the foregoing is a first possible implementation manner, the verifying the generation time of the event to obtain the target time of the event generation specifically includes:
acquiring a first time generated by an event in the event information, wherein the first time is a local time counted by a timer of the electronic equipment when the event is generated;
acquiring a second time in the event information, wherein the second time is obtained by a server based on a timing moment sent by a timing request;
acquiring a third time in the event information, wherein the third time is based on the time counted by a timer of the electronic equipment when the electronic equipment receives the timing moment of the server;
and obtaining the target time of event generation according to the first time, the second time and the third time.
In a third possible implementation manner provided by the second possible implementation manner, the obtaining the target time of the event generation according to the first time, the second time and the third time specifically includes:
Subtracting the third time from the second time, and adding the first time to obtain a time stamp when the event in the data to be transmitted occurs;
and determining the target time of the event generation based on the time stamp of the event generation in the data to be transmitted.
In a fourth possible implementation manner provided by the third possible implementation manner, the determining, based on a time stamp when the event occurs in the data to be transmitted, the target time of the event occurrence specifically includes:
and calling a preset first time conversion function to convert a time stamp generated by the event in the data to be transmitted, so as to obtain the target time generated by the event expressed by coordinated universal time UTC.
In a fifth possible implementation provided on the basis of the above first possible implementation, or the above second possible implementation, or the above three possible implementations, or the above fourth possible implementation, the processor 502 further implements the following steps by running the above computer program stored in the memory 501:
when an event in the data to be transmitted is generated, recording time information of the event, determining that a time check mark of the event is not checked, defaulting the time information to be a first time, wherein the first time is a local time based on the timer of the electronic equipment when the event is generated;
After the target time generated by the event is obtained, the time information of the event is updated to the target time, and the time check mark of the event is updated to be checked.
In a sixth possible implementation provided by the fifth possible implementation as a basis, the processor 502 further implements the following steps by running the above-mentioned computer program stored in the memory 501:
and if the time check mark of the event is checked, transmitting the data to be transmitted according to the data transmission instruction.
It should be appreciated that in embodiments of the present application, the processor 502 may be a central processing unit (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Memory 501 may include read only memory and random access memory and provides instructions and data to processor 502. Some or all of memory 501 may also include non-volatile random access memory. For example, the memory 501 may also store information of a device class.
From the above, according to the present application, after the electronic device obtains the data transmission instruction, the electronic device determines to-be-transmitted data according to the data transmission instruction, where the to-be-transmitted data includes event information and a time check mark of an event, and determines whether the time check mark of the event is non-checked, if yes, checks the generation time of the event to obtain a target time of event generation, then replaces the event generation time in the to-be-transmitted data with the target time to obtain updated to-be-transmitted data, and finally transmits the updated to-be-transmitted data to a transmission object in the data transmission instruction. According to the scheme, whether the data to be transmitted are calibrated or not is determined through the time check mark, for the data to be transmitted which are not calibrated, the electronic equipment can obtain the target time of event generation through calibration, and the event generation time corresponding to the data to be transmitted is replaced by the target time and then transmitted, so that the fact that all data transmitted by the electronic equipment are calibrated can be guaranteed, and a transmission object can process corresponding events in time.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of external device software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the system embodiments described above are merely illustrative, e.g., the division of modules or units described above is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above-described embodiments, or may be implemented by a computer program to instruct associated hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. The computer program comprises computer program code, and the computer program code can be in a source code form, an object code form, an executable file or some intermediate form and the like. The above computer readable storage medium may include: any entity or device capable of carrying the computer program code described above, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer readable Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier wave signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the content of the computer readable storage medium described above may be appropriately increased or decreased according to the requirements of the jurisdiction's legislation and the patent practice, for example, in some jurisdictions, the computer readable storage medium does not include electrical carrier signals and telecommunication signals according to the legislation and the patent practice.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (7)

1. A data transmission method, applied to an electronic device, the method comprising:
acquiring a data transmission instruction;
determining data to be transmitted according to the data transmission instruction, wherein the data to be transmitted comprises event information and a time verification mark of an event;
judging whether the time check mark of the event is unverified;
if yes, checking the generation time of the event to obtain the target time of event generation;
replacing event generation time in the data to be transmitted with target time to obtain updated data to be transmitted;
transmitting the updated data to be transmitted to a transmission object in the data transmission instruction;
When an event in the data to be transmitted is generated, recording time information of the event, and determining that a time check mark of the event is not checked, wherein the time information defaults to a first time, and the first time is a local time based on the timer of the electronic equipment when the event is generated; the timer is an internal timer which is initialized and started immediately after the electronic equipment is powered on and started, and is used for recording a duration value of the current distance from the starting moment of the electronic equipment;
after the target time generated by the event is obtained, updating the time information of the event into the target time, and updating the time verification mark of the event into verified; after the event is generated, a timing request is sent to a preset timing server to execute timing operation, and the timing server is used for realizing time synchronization with the electronic equipment;
the step of verifying the generation time of the event to obtain the target time of event generation specifically comprises the following steps:
acquiring first time generated by an event in the event information, wherein the first time is local time counted by a timer of the electronic equipment when the event is generated;
Acquiring a second time in the event information, wherein the second time is obtained by a server based on a timing moment sent by a timing request;
acquiring third time in the event information, wherein the third time is based on the time counted by a timer of the electronic equipment when the electronic equipment receives the timing moment of the server;
and obtaining the target time of event generation according to the first time, the second time and the third time.
2. The method according to claim 1, wherein the obtaining the target time of event generation according to the first time, the second time and the third time specifically includes:
subtracting the third time from the second time, and adding the first time to obtain a time stamp when an event in the data to be transmitted occurs;
and determining the target time of event generation based on the time stamp of event generation in the data to be transmitted.
3. The method according to claim 2, wherein the determining the target time for event generation based on the time stamp of event generation in the data to be transmitted specifically comprises:
and calling a preset first time conversion function to convert a time stamp generated by an event in the data to be transmitted, and obtaining target time generated by the event expressed by coordinated universal time UTC.
4. A method according to any one of claims 1-3, wherein the method further comprises:
and if the time check mark of the event is checked, transmitting the data to be transmitted according to the data transmission instruction.
5. An electronic device, the electronic device comprising:
the acquisition unit is used for acquiring the data transmission instruction;
the determining unit is used for determining data to be transmitted according to the data transmission instruction, wherein the data to be transmitted comprises event information and a time check mark of an event;
the judging unit is used for judging whether the time check mark of the event is unverified;
the verification unit is used for verifying the generation time of the event if the time verification mark is not verified, so as to obtain the target time of the event generation;
the replacing unit is used for replacing the event generating time in the data to be transmitted with the target time to obtain updated data to be transmitted;
a transmission unit, configured to transmit the updated data to be transmitted to a transmission object in the data transmission instruction;
the recording unit is used for recording time information of the event when the event in the data to be transmitted is generated, determining that a time check mark of the event is not checked, and defaulting the time information to be first time, wherein the first time is local time based on the timer of the electronic equipment when the event is generated; the timer is an internal timer which is initialized and started immediately after the electronic equipment is powered on and started, and is used for recording a duration value of the current distance from the starting moment of the electronic equipment;
The updating unit is used for updating the time information of the event into the target time after the target time generated by the event is obtained, and updating the time verification mark of the event into verified; after the event is generated, a timing request is sent to a preset timing server to execute timing operation, and the timing server is used for realizing time synchronization with the electronic equipment;
the verification unit includes:
a first time obtaining subunit, configured to obtain a first time generated by an event in the event information, where the first time is a local time that is based on a timer of the electronic device when the event is generated;
a second time obtaining subunit, configured to obtain a second time in the event information, where the second time is obtained by the server based on a timing time sent by the timing request;
a third time obtaining subunit, configured to obtain a third time in the event information, where the third time is a time based on a timer of the electronic device when the electronic device receives the timing moment of the server;
and the target time acquisition subunit is used for acquiring the target time generated by the event according to the first time, the second time and the third time.
6. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 4 when executing the computer program.
7. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the method according to any one of claims 1 to 4.
CN202110320169.5A 2021-03-25 2021-03-25 Data transmission method, data transmission device and electronic equipment Active CN113098939B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110320169.5A CN113098939B (en) 2021-03-25 2021-03-25 Data transmission method, data transmission device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110320169.5A CN113098939B (en) 2021-03-25 2021-03-25 Data transmission method, data transmission device and electronic equipment

Publications (2)

Publication Number Publication Date
CN113098939A CN113098939A (en) 2021-07-09
CN113098939B true CN113098939B (en) 2023-06-02

Family

ID=76669636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110320169.5A Active CN113098939B (en) 2021-03-25 2021-03-25 Data transmission method, data transmission device and electronic equipment

Country Status (1)

Country Link
CN (1) CN113098939B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309228A (en) * 2013-06-21 2013-09-18 厦门雅迅网络股份有限公司 Time correcting method of car-mounted terminal system
CN108765703A (en) * 2018-05-23 2018-11-06 深圳怡化电脑股份有限公司 Clocking method, device, storage medium and self-service device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017090046A (en) * 2014-02-13 2017-05-25 日本電気株式会社 Repeating device, time synchronization system, and time synchronization method
CN108964825A (en) * 2018-07-10 2018-12-07 重庆思柏高科技有限公司 Calibration method, correction device and time server
CN111596721B (en) * 2020-04-09 2022-05-10 深圳市元征科技股份有限公司 Data time tag synchronization method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103309228A (en) * 2013-06-21 2013-09-18 厦门雅迅网络股份有限公司 Time correcting method of car-mounted terminal system
CN108765703A (en) * 2018-05-23 2018-11-06 深圳怡化电脑股份有限公司 Clocking method, device, storage medium and self-service device

Also Published As

Publication number Publication date
CN113098939A (en) 2021-07-09

Similar Documents

Publication Publication Date Title
CN111585682B (en) Sensor time synchronization method and device and terminal equipment
CN108737636B (en) Message reminding method and device and electronic equipment
US20200021443A1 (en) Method and timer for providing security-protected time information
CN109981206B (en) Time synchronization method, device, system, terminal equipment and storage medium
CN112383675A (en) Time synchronization method and device and terminal equipment
CN107566794B (en) Video data processing method and system and terminal equipment
CN110099236B (en) Video data storage method, video data request method, video data storage device and video data request device
CN110913038B (en) IP address determination method, device, server and computer readable storage medium
CN113110016A (en) Common-view data generation method, receiver and time calibration system
CN113098939B (en) Data transmission method, data transmission device and electronic equipment
CN115987477A (en) Multi-reference source time synchronization method, system, module and medium
CN109005509B (en) Terminal positioning method, device, terminal and storage medium
JP6920738B2 (en) Logging device, control method, and program
WO2024103432A1 (en) Trusted space positioning calibration service system and operation method thereof
CN116306508A (en) Date data conversion method and device
CN113590017A (en) Method, electronic device and computer program product for processing data
CN115913437A (en) Time synchronization method, system, fault injection equipment and storage medium
CN110794426B (en) Cold start control method and device of receiver, terminal equipment and medium
CN113985431A (en) Data acquisition method, system, device, electronic equipment and storage medium
CN114928425A (en) Terminal device time synchronization system, method, device and storage medium
CN110601785B (en) Rapid high-precision synchronization method for satellite time service
CN114509791A (en) Satellite positioning error analysis method and device capable of reducing storage
CN114499816A (en) Clock synchronization method and device, terminal equipment and readable storage medium
CN113259039A (en) Time synchronization method and device, computer equipment and storage medium
US20240142634A1 (en) Trusted space positioning calibration service system and operation method thereof

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
GR01 Patent grant
GR01 Patent grant