CN114609891A - Method and device for determining time, electronic equipment and storage medium - Google Patents

Method and device for determining time, electronic equipment and storage medium Download PDF

Info

Publication number
CN114609891A
CN114609891A CN202210237041.7A CN202210237041A CN114609891A CN 114609891 A CN114609891 A CN 114609891A CN 202210237041 A CN202210237041 A CN 202210237041A CN 114609891 A CN114609891 A CN 114609891A
Authority
CN
China
Prior art keywords
time
count value
pulse signal
counting
target pulse
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210237041.7A
Other languages
Chinese (zh)
Inventor
刘均
梅梦醒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
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 CN202210237041.7A priority Critical patent/CN114609891A/en
Publication of CN114609891A publication Critical patent/CN114609891A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G04HOROLOGY
    • G04RRADIO-CONTROLLED TIME-PIECES
    • G04R20/00Setting the time according to the time information carried or implied by the radio signal
    • G04R20/02Setting the time according to the time information carried or implied by the radio signal the radio signal being sent by a satellite, e.g. GPS

Landscapes

  • Engineering & Computer Science (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Position Fixing By Use Of Radio Waves (AREA)

Abstract

The application is applicable to the technical field of electronics, and provides a method and a device for determining time, electronic equipment and a storage medium. The method comprises the following steps: the method comprises the steps of counting the duration of a first target pulse signal with a known time length from a GPS module, determining a first counting value, and determining the time length required for increasing any counting value by one unit value according to the time length of the first target pulse signal and the first counting value.

Description

Method and device for determining time, electronic equipment and storage medium
Technical Field
The present application relates to the field of electronic technologies, and in particular, to a method and an apparatus for determining time, an electronic device, and a storage medium.
Background
At present, in the process of determining the time length within a certain period of time by using a hardware device, the time length within the certain period of time is generally determined according to the oscillation frequency of a crystal oscillator in the hardware device, but since a change (for example, a temperature change) of an external environment may have a certain influence on the oscillation frequency of the crystal oscillator, a large error may exist in the time length within the certain period of time determined in this way.
Disclosure of Invention
The embodiment of the application provides a method and a device for determining time, electronic equipment and a storage medium, and can solve the problem of improving the accuracy of time determination.
In a first aspect, an embodiment of the present application provides a method for determining time, where the method includes: s1, counting the duration of the first target pulse signal with known time length from the GPS module, and determining a first count value; and S2, determining the time length required for increasing any one count value by one unit value according to the time length of the first target pulse signal and the first count value.
In one possible implementation manner of the first aspect, the counting during a duration of a first target pulse signal of a known time length from the GPS module, and determining the first count value includes: counting between a first time and a second time of the duration of the first target pulse signal, and determining the first count value, wherein the first time and the second time are the time when the first target pulse signal jumps, and the second time is after the first time.
In a possible implementation manner of the first aspect, the first time is a time corresponding to when a rising edge of the first target pulse signal is detected, or a time corresponding to when a falling edge of the first target pulse signal is detected, and the second time is a time corresponding to when a rising edge of the first target pulse signal is detected, or a time corresponding to when a falling edge of the first target pulse signal is detected.
In one possible implementation manner of the first aspect, the counting during a duration of a first target pulse signal of a known time length from the GPS module, and determining the first count value includes: determining a count value counted during the duration of the first target pulse signal as the first count value if no interruption occurs in the process of counting during the duration of the first target pulse signal; or, if an interruption occurs during the counting during the duration of the first target pulse signal, determining the first count value according to a preset count value, a second count value and the number of interruptions in the counting process, wherein the second count value is a count value counted after the last interruption in the counting process occurs, and the interruption occurs when the count value is equal to the preset count value during the counting during the duration of the first target pulse signal.
In a possible implementation manner of the first aspect, before determining the first count value, the method further includes: after receiving the indication information from the GPS module, determining the starting time of the first target pulse according to a pulse signal output by the GPS module after the indication information is sent, wherein the indication information indicates that the positioning of the GPS module is effective.
In a possible implementation manner of the first aspect, the method further includes: acquiring a time parameter of a third moment according to a preset protocol of the GPS module; and determining the time parameter of a fourth time according to the time parameter of the third time, the time length required for increasing one unit value for any counting value and a third counting value, wherein the third counting value is a counting value counted from the third time to the fourth time.
In a possible implementation manner of the first aspect, after determining a time length required for increasing each unit value by any one of the count values, the method further includes: after each interval for a preset length of time, the loop executes S1 to S2.
According to the method and the device, counting is carried out in the duration of a first target pulse signal with known time length from a GPS module, a first counting value is determined, and the time length required for increasing one unit value by any one counting value is determined according to the length of the first target pulse signal and the first counting value.
It should be understood that, since the first target pulse signal with a known time length in the present application is from the GPS module, the known time length is very close to the time length of the first target pulse signal determined based on the international standard time (greenwich mean time), that is, the accuracy of the known time length corresponding to the first target pulse signal is high, counting is performed during the first target pulse duration to obtain a first count value, and the accuracy of the time length required for increasing each unit value of any one determined count value is high according to the known time length and the first count value. Compared with the technical scheme that the time length required for increasing one unit value by any one counting value determined by the oscillation frequency of the crystal oscillator in the prior art is longer, the time length required for increasing one unit value by any one counting value determined by the method is higher in accuracy. Therefore, according to the time length required by increasing one unit value by any one counting value, the time length corresponding to the increase of a plurality of counting values is determined to have higher accuracy.
In a second aspect, an embodiment of the present application provides a device for determining a time, where the device is configured to perform the method in the first aspect or any one of the possible implementation manners of the first aspect. In particular, the apparatus may include means for performing the first aspect or determining the time in any of its possible implementations.
In a third aspect, an embodiment of the present application provides a device for determining time, including: memory, a communication interface, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method of the first aspect or any of the first aspects when executing the computer program.
In a fourth aspect, this embodiment provides a computer-readable storage medium, which stores a computer program, where the computer program is implemented to implement the method of the first aspect or any one of the first aspects when executed by a processor.
In a fifth aspect, embodiments of the present application provide a computer program product, which when run on a device, causes the device to perform the method of the first aspect or any one of the first aspects.
It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic diagram of a system 100 for determining a time according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a pulse per second output by a GPS module according to an embodiment of the present disclosure;
fig. 3 is a flow chart illustrating a method 300 for determining a time according to an embodiment of the present disclosure;
fig. 4 (a) is a schematic diagram of a first target pulse signal provided in an embodiment of the present application;
fig. 4 (b) is a schematic diagram of another first target pulse signal provided in the embodiment of the present application;
FIG. 4 (c) is a schematic diagram of a first target pulse signal provided in an embodiment of the present application;
FIG. 4 (d) is a schematic diagram of a first target pulse signal provided in the embodiment of the present application;
FIG. 4 (e) is a schematic diagram of a first target pulse signal provided in the embodiment of the present application;
fig. 5 is a schematic structural diagram of a timing determining apparatus 500 according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an apparatus 600 for determining a time 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 structures, 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.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather mean "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
When it is necessary to determine an accurate time period, for example, when a signal is collected by a sampler having a high sampling frequency and analyzed, it is necessary to determine a time period of high accuracy matching a certain amount of the acquired sample data. For another example, when the precise time parameter needs to be obtained, the precise timing value needs to be determined, so as to determine the required time parameter.
Currently, in the process of determining the time length of a certain period of time, a count value determined by a timer is generally converted into a corresponding time length, so as to determine the corresponding time. It should be understood that, in the counting process by the timer, the counting value is determined according to the frequency of the crystal oscillator, however, the crystal oscillator frequency is easily affected by the external environment, for example, when the temperature changes significantly, the crystal oscillator frequency also changes, and this situation may cause the corresponding time length to be different at different temperatures when every 1 counting value is added. For example, at a temperature of 25 °, 1 count value determined by the timer corresponds to a time length of 10 microseconds, whereas when the temperature rises to 35 °, 1 count value determined by the timer no longer corresponds to a time length of 10 microseconds. In this case, the time determined by the count value obtained by the timer may have a large error, and the longer the time is counted, the larger the error. Based on the above findings, embodiments of the present application provide a method for determining a time, in which a first target pulse signal with a known time length from a GPS module is counted in the first target pulse signal, a first count value is determined, and in accordance with the time length of the first target pulse signal and the first count value, since the time length determined based on a pulse signal sent by the GPS module is very close to the time length determined based on an international standard time (greenwich mean time), the time length of the first target pulse signal is accurate, and therefore, an accurate time length corresponding to one count value can be determined according to the count value counted in the time length of the first target pulse signal, so as to solve the problem in the prior art that an error exists when determining the time length in a certain period.
Fig. 1 illustrates a system 100 for determining time according to an embodiment of the present disclosure. The system 100 includes: a GPS module 101 and a timer module 102.
In some embodiments, a communication connection is established between the timer module 102 and the GPS module 101, and the timer module 102 may directly acquire the first target pulse signal of a known time length from the GPS module.
In some embodiments, there is an interface in the timer module 102 that can catch sudden changes in the pulse, and the interface establishes a communication connection with the GPS module 101.
In some embodiments, the timer module 102 may be a timer in a single chip, and the interface of the timer module 102 is a pin on the timer in the single chip, and the pin may capture a certain time of the pulse signal.
For example, a pin on the timer may capture a time when the pulse signal transitions, and the time when the pulse signal transitions may be a time corresponding to a rising edge or a falling edge of the pulse signal.
In some embodiments of the present application, the GPS module 101 may output a pulse-per-second signal as shown in fig. 2, and when the GPS module 101 outputs the pulse-per-second signal and the pulse-per-second signal changes suddenly, a pin of the timer may capture a time when the signal changes suddenly in time, and start to count from the time when the signal changes suddenly is captured, so as to determine an accurate count value corresponding to the pulse signal length.
For example, the embodiment of the present application is only described by taking the GPS module 101 as an example, and in a practical application process, the GPS module 101 may also be another module that can output a pulse signal with a known time length, where the known time length has a smaller error than the time length of the pulse signal determined by the world international standard world.
Fig. 3 illustrates a method 300 for determining a time according to an embodiment of the present application, which is applied to the above-described system for determining a time illustrated in fig. 1, and can be implemented by software and/or hardware of the timer module 102. As shown in fig. 3, the method includes steps S301 to S302. The specific realization principle of each step is as follows:
s301, counting is carried out during the duration of a first target pulse signal with known time length from the GPS module, and a first counting value is determined, wherein the first target pulse signal is a pulse signal output by the GPS module.
For example, the first target pulse signal is a pulse signal output by the GPS module, and the first target pulse may be a pulse signal of one period in the pulse signal sent by the GPS module, or may be a pulse signal of a known time length in the pulse signal sent by the GPS module, that is, the time length of the first target pulse signal is known.
For example, counting is performed during the duration of the first target pulse signal, and the determined first count value is the corresponding count value at the time length of the first target pulse signal.
For example, when counting is performed during the first target pulse signal duration, the count value may be set to 0, and the count value obtained after the end of counting may be the first count value, or the count value increased during the first target pulse signal duration may be determined as the first count value by continuing counting from an arbitrary count value.
S302, determining a time length required for increasing one unit value by any one count value according to the time length of the first target pulse signal and the first count value.
In some embodiments, since the first count value is a count value corresponding to the time length of the first target pulse signal, the time length required for increasing any one count value by one unit value may be determined according to the time length of the first target pulse signal and the first count value.
Illustratively, the time length of the first target pulse signal is 1 second, and the first count value determined during the duration of the first target pulse signal is 9990, which means that the count value increased within 1 second is 9990, and the time length required for increasing any one count value by one unit value is 100.1001 microseconds according to the time length of the first target pulse signal and the first count value.
It should be understood that, for example, when the count value is 10000, which is increased within 1 second of the count value setting, the count value is increased from zero to 10000, and the corresponding time length is 1 second, however, according to the method proposed in the embodiment of the present application, the count value obtained by counting within 1 second is 9990, in this case, it can be seen that the count value of the timer is slower due to the crystal frequency, so that the actual count value within 1 second is 10 count values smaller than the set count value. That is, when the counting is performed within 1 second and the counted count value is 10000, the time length required for increasing one unit value by any one count value is 100 microseconds, and when the counting is actually performed within 1 second and the counted count value is 9990, the time length required for increasing one unit value by any one obtained count value should be 100.1001 microseconds.
For example, when the time length required for increasing any one count value by one unit value is determined based on the time length of the first pulse signal and the first count value, the time length required for increasing any one count value by a specified unit value may be directly determined, for example, the time length required for increasing any one count value by two unit values or the time length required for increasing any one count value by ten unit values.
In some embodiments, when the time length corresponding to one count value is used to determine the time length according to the count value, if the count value is increased from 0 to 10000, the time length corresponding to 1 count value set according to the crystal frequency of the timer is 100 microseconds, the obtained time length is 1000000 microseconds, and actually the time length corresponding to 1 count value obtained as above is 100.1001 microseconds, so the obtained actual time length should be 1001001 microseconds.
It follows that the length of time obtained from the set value presents a larger error value. According to the method and the device, the accurate time length and the counting value corresponding to the time length can be obtained according to the first target pulse signal, and then the time length required by increasing one unit numerical value for any counting value is obtained, so that the accurate time can be determined according to the counting value obtained through statistics.
It should be understood that, the embodiment is only described by taking the case that the count value is increased from 0 to 10000, and in an actual application process, when the count value starts to increase from the count value corresponding to the first time of the first time and ends to count at the second time to obtain the count value corresponding to the second time, the time length corresponding to the first time to the second time may be determined according to the count value increased between the first time and the second time.
On the basis of the above embodiment of the determination time shown in fig. 3, the step S302 counts the duration of the first target pulse signal, and the step of determining the first count value may be specifically implemented by:
counting between a first time and a second time of the duration of the first target pulse signal, and determining a first count value, wherein the first time and the second time are the time when the first target pulse signal jumps, and the second time is after the first time.
It should be understood that when the amplitude of the pulse signal changes suddenly, the pulse signal may be considered to have a transition, for example, the amplitude of the pulse signal remains 5V for a period of time, and when the amplitude of the pulse signal increases suddenly to 7V or the amplitude of the pulse signal decreases suddenly to 2V, the pulse signal may be considered to have a transition. For another example, the amplitude of the pulse signal is reduced by 1V per second according to a certain rule, and when the amplitude of the pulse signal is suddenly increased, it is considered that the pulse signal has a transition.
In some embodiments, the first time may be a time corresponding to detection of a rising edge of the first target pulse signal, or a time corresponding to detection of a falling edge of the first target pulse signal, and the second time is after the first time.
Illustratively, when the first time corresponds to a time at which a rising edge of the first target pulse signal is detected, and the second time corresponds to a time at which a falling edge of the first target pulse signal is detected, the obtained first target pulse signal is a pulse signal as shown in (a) of fig. 4, it should be understood that since the pulse signal output by the GPS module is a pulse-per-second signal, a time length corresponding to the pulse signal within one period is 1 second. The duty ratio of the pulse per second signal is one half, that is, in the pulse signal of one cycle, the duration of the pulse signal in the high level period is 0.5 second, and the duration of the pulse signal in the low level period is 0.5 second. It can be seen that, as shown in fig. 4 (a), the pulse signal is a pulse signal of a high level duration in one period, and the pulse signal is counted for the duration of the first target pulse signal, so that the first count value is determined. Wherein the determined first count value is a count value counted within 0.5 seconds of the time length t 1.
For example, in the case where the first time corresponds to the time when the falling edge and the rising edge of the first target pulse signal are detected, and the second time corresponds to the time when the rising edge of the first target pulse signal is detected, the obtained first target pulse signal may be a pulse signal as shown in (b) of fig. 4, and it should be understood that since the pulse signal output by the GPS module is a pulse-per-second signal, the time length corresponding to the pulse signal in one period is 1 second. The duty ratio of the pulse per second signal is one half, that is, in the pulse signal of one cycle, the duration of the pulse signal in the high level period is 0.5 second, and the duration of the pulse signal in the low level period is 0.5 second. It can be seen that, as shown in (b) of fig. 4, the pulse signal is a pulse signal of a low level duration in one period, and the duration of the first target pulse signal is counted, so that the first count value can be determined. Wherein the determined first count value is a count value counted within 0.5 seconds of the time length t 2.
For example, in the case where the first time and the second time correspond to the time at which the rising edge of the first target pulse signal is detected, the obtained first target pulse signal may be a pulse signal as shown in (c) of fig. 4, and it should be understood that the pulse signal output by the GPS module is a pulse per second signal. It can be seen that the pulse signal shown in (c) of fig. 4 is a pulse signal within one period, counting is performed during the duration of the first target pulse signal, and the first count value can be determined. Wherein the determined first count value is a count value counted within 1 second of the time length t 3.
For example, in the case where the first time and the second time correspond to the time when the falling edge of the first target pulse signal is detected, the obtained first target pulse signal may be a pulse signal as shown in (d) of fig. 4, and it should be understood that the pulse signal output by the GPS module is a pulse per second signal. It can be seen that the pulse signal shown in (d) of fig. 4 is a pulse signal within one period, and counting is performed during the duration of the first target pulse signal, and then the first count value can be determined. Wherein the determined first count value is a count value counted within 1 second of the time length t 4.
For example, the first time may be a time corresponding to the ith detected rising edge of the first target pulse signal, and the second time may be a time corresponding to the i +2 th detected rising edge of the first target pulse signal, in which case, the obtained first target pulse signal may be a pulse signal as shown in (e) of fig. 4, and it should be understood that, since the pulse signal output by the GPS module is a pulse-per-second signal, the time length corresponding to the pulse signal in one period is 1 second. It can be seen that the pulse signal shown in the graph (e) in fig. 4 is a pulse signal in two cycles, counting is performed during the duration of the first target pulse signal, and the determined first count value is a count value counted within 2 seconds of the time length t 5.
In some embodiments, counting is performed during the duration of the first target pulse signal, and when determining the first count value, the first count value may be determined by:
it should be understood that, after the timer is set, a preset count value may be obtained, and according to the setting of the timer, when the count value is increased from 0 to the preset count value, the timer considers that the time length in the period is 1 second, so that when the count value is increased to the preset count value, an interrupt may be generated, and according to the generated interrupt signal, the timer considers that the time length is increased by 1 second. When the timer is interrupted, the count value starts to be counted again from 0.
For example, the preset count value is 10000, when the count value increases to 10000, an interrupt occurs, and if the count value continues to increase, the current count value is considered to be in an overflow state, in which case, the count value starts to increase again from 0. After the overflow occurs, the actual count value needs to be determined according to the preset count value, the number of times of interruption and the counted count value after interruption.
Therefore, when the first target pulse signal duration is counted, the obtained count value may be a count value obtained after the overflow or may be a count value obtained without the overflow. That is, when the interruption does not occur during the counting of the first target pulse signal duration, the first target pulse signal duration may be counted, and the counted count value may be directly determined as the first count value.
Illustratively, in the process of counting during the duration of the first target pulse signal, when the count value is increased to a preset count value, an interruption phenomenon occurs, and the count value is counted again from 0, and the count value counted after the last interruption is determined as the second count value. In this case, the first count value may be determined based on a preset count value, the second count value, and the number of interrupts in the counting process.
For example, if the preset count value is 10000, when the count value reaches 10000, an interrupt occurs and counting is resumed from 0, and if only one interrupt occurs during the counting process, the second count value after the first interrupt is counted as 10, and the count value 10010 obtained by adding the second count value and the preset count value is determined as the first count value.
For another example, when the preset count value is 10000 and the first count value is 9990, the first count value does not exceed the preset count value, and thus no interruption occurs, and when no interruption occurs during the counting process, the first count value 9990 may be directly determined as the first count value.
In some embodiments, before step S301, the present application further includes the following steps:
after the indication information from the GPS module is received, the starting time of the first target pulse signal is determined according to the pulse signal output by the GPS module after the indication information is sent.
It should be understood that, because the GPS module is in an unlocked state within a short time after the GPS module is powered on, that is, the positioning of the GPS module is not in an effective state, the GPS module does not output a pulse signal, or the output pulse signal is an irregular pulse signal, and after the GPS module is successfully positioned, an indication information indicating that the positioning of the GPS module at the current time is effective is output, indicating that the pulse signal output by the current GPS module is a standard pulse-per-second signal, which is required by the present application. Therefore, after receiving the indication information from the GPS module, the start time of the first target pulse signal may be determined according to the pulse signal output by the GPS module after outputting the indication information.
Optionally, when the positioning of the GPS module is valid, an indication message indicating that the positioning of the GPS module at the current time is valid may be output, and when the positioning of the GPS module is invalid, an indication message indicating that the positioning of the GPS module at the current time is invalid may be output.
For example, when the information output by the GPS module is a, it is considered that the GPS module outputs an indication that the GPS module positioning at the current time is valid, and when the information output by the GPS module is V, it is considered that the GPS module positioning at the current time is invalid, and therefore it is considered that the GPS module does not output an indication that the GPS module positioning at the current time is valid.
In some embodiments, the present application embodiments may further include the following steps:
for example, the time parameter at the third time may be obtained according to a preset protocol of the GPS module, and then the time parameter at the third time is determined according to the time parameter at the third time, the time length required for increasing one unit value by any one count value determined in step S302, and a third count value, where the third count value is a count value counted in the process of counting from the third time to the fourth time.
Optionally, the third time may be a real-time parameter obtained according to a preset protocol of the GPS module.
Optionally, the preset protocol of the GPS module may be a National Marine Electronics Association (NMEA) protocol.
For example, the time length required for increasing one unit value by any one count value determined in step S302 is 80 microseconds, the acquired real-time parameter is 10 minutes 10 seconds at 17 points 1/10 days 2021 according to the preset protocol of the GPS module, the count is started from the third time at 10 minutes 10 seconds at 17 points 1/10 days 2021 as the third time, the count is stopped at the fourth time, the count counted from the third time to the fourth time is counted to obtain a count value of 9123, the time length corresponding to the third time to the fourth time is 729840 microseconds, and the time parameter at the fourth time is 729 milliseconds 840 microseconds at 10 points 10 minutes 10 days at 17 points 1/10 days 2021/1.
In some embodiments, after determining the time length required for increasing any one count value by one unit value, the embodiments of the present application further include the steps of:
and after every preset time length, circularly executing the steps S101 to S102.
It should be understood that, since the external environment may change at any time, after the time length required for determining each count value to increase by one count unit is determined, because the time length required for each count value to increase by one count unit changes due to the influence of the external environment, for example, the crystal frequency in the timer changes due to the temperature change, and the time length required for each count value to increase by one count unit changes, the steps S101 to S102 need to be executed again to re-determine the time length required for each count value to increase by one count unit, so as to prevent an error caused by the environmental change in the process of determining the time. The accuracy of the time determined by the timer in the working process at any moment is further improved.
For example, the preset time period is 5 minutes, and the time period is 13: at time 00, if the time length required for executing steps S101 to S102 to obtain a count value to increase by one count unit is 90 μ S, then at time 13: 00 to 13: 05, the time may be determined according to the 90 microsecond length of time required for each increment of one count value, 13: at time 05, step S101 to step S102 are executed again, and the time length required for increasing one count unit by one count value is 85 microseconds, then at time 13: 05 to 13: for 10 periods, the time may be determined according to the time length required for increasing one count unit by 85 microseconds, and after that, the steps S101 to S102 are executed once every 5 minutes (for example, time 13: 15, time 13: 20, etc.), and the time may be determined according to the time length required for increasing one count unit by the newly determined count value.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Corresponding to the method for determining time shown in fig. 3, fig. 5 shows an apparatus 500 for determining time provided by an embodiment of the present application, including:
and a counting module 501, configured to count the duration of the first target pulse signal with a known time length from the GPS module, and determine a first count value.
A determining module 502, configured to determine, according to the time length of the first target pulse signal and the first count value, a time length required for increasing any one count value by one unit value.
Optionally, the counting module 501 is further configured to count between a first time and a second time of the duration of the first target pulse signal, and determine the first count value, where the first time is a time when the first target pulse signal makes a transition, the second time is a time when the first target pulse signal makes a transition, and the second time is after the first time.
Optionally, the counting module 501 is further configured to determine a first count value as the first count value when no interruption occurs during counting of the duration of the first target pulse signal, where the first count value is a count value counted when no interruption occurs during the counting; or, when the counting period of the first target pulse signal duration is interrupted, determining the first count value according to the preset count value, a second count value and the interruption times in the counting process, wherein the second count value is a count value counted after the last interruption in the counting process, and the interruption occurs when the count value is equal to the preset count value when the counting period of the first target pulse signal duration is counted.
Optionally, the first time is a time corresponding to when a rising edge of the first target pulse signal is detected, or a time corresponding to when a falling edge of the first target pulse signal is detected, and the second time is a time corresponding to when a rising edge of the first target pulse signal is detected, or a time corresponding to when a falling edge of the first target pulse signal is detected.
Optionally, before determining the first count value, the determining module 502 is further configured to determine an initial time of the first target pulse according to a pulse signal output by the GPS module after receiving indication information from the GPS module, where the indication information indicates that the positioning of the GPS module is valid.
Optionally, the apparatus 500 further includes an obtaining module 503, where the obtaining module 503 is configured to obtain a time parameter at a third time according to a preset protocol of the GPS module.
Optionally, the determining module 502 is further configured to determine the time parameter of a fourth time according to the time parameter of the third time, the time length required for increasing one unit value by any one count value, and a third count value, where the third count value is a count value counted from the third time to the fourth time.
Optionally, the method further includes a loop module, configured to loop through S1 to S2 every preset time interval after determining a time interval required for increasing each unit value by any one of the count values.
It is understood that various embodiments and combinations of the embodiments in the above embodiments and their advantages are also applicable to this embodiment, and are not described herein again.
Fig. 6 is a schematic structural diagram of a device for determining time according to an embodiment of the present application. As shown in fig. 6, wherein the device 600 comprises a processor 601, a memory 602, a communication interface 603, and a bus 604. The processor 601, the memory 602, and the communication interface 603 communicate with each other via the bus 604, or may communicate with each other via other means such as wireless transmission. The memory 602 is used for storing instructions and the processor 601 is used for executing the instructions stored by the memory 602. The memory 602 stores program code 6021 and the processor 601 may call the program code 6021 stored in the memory 602 to perform the method of determining time shown in fig. 3.
It should be understood that in the embodiments of the present application, the processor 601 may be a CPU, and the processor 601 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or any conventional processor or the like.
The memory 602 may include both read-only memory and random access memory and provides instructions and data to the processor 601. The memory 602 may also include non-volatile random access memory. The memory 502 may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM), which acts as external cache memory. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and direct bus RAM (DR RAM).
The bus 604 may include a power bus, a control bus, a status signal bus, and the like, in addition to a data bus. But for clarity of illustration the various busses are labeled in figure 6 as bus 604.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
Embodiments of the present application provide a computer program product, which when running on a device, enables the device to implement the steps in the above method embodiments when executed.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned functions may be distributed as different functional units and modules according to needs, that is, the internal structure of the apparatus may be divided into different functional units or modules to implement all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of 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 processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
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 computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. 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/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the above modules or units is only one logical function division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method of determining time, comprising:
s1: counting the duration of a first target pulse signal of a known time length from a GPS module, and determining a first count value;
s2: and determining the time length required for increasing any one unit value by any one count value according to the time length of the first target pulse signal and the first count value.
2. The method of claim 1, wherein counting for a first target pulse signal duration, determining a first count value comprises:
counting between a first time and a second time of the duration of the first target pulse signal, and determining the first count value, wherein the first time and the second time are the time when the first target pulse signal jumps, and the second time is after the first time.
3. The method according to claim 2, wherein the first time corresponds to when a rising edge of the first target pulse signal is detected, or a falling edge of the first target pulse signal is detected, and the second time corresponds to when a rising edge of the first target pulse signal is detected, or a falling edge of the first target pulse signal is detected.
4. A method according to any one of claims 1 to 3, wherein counting for a first target pulse signal duration, determining a first count value comprises:
determining a count value counted during the duration of the first target pulse signal as the first count value if no interruption occurs in the process of counting during the duration of the first target pulse signal; or the like, or, alternatively,
and if the interruption occurs in the process of counting in the duration of the first target pulse signal, determining the first count value according to a preset count value, a second count value and the interruption times in the counting process, wherein the second count value is a count value counted after the last interruption in the counting process occurs, and the interruption occurs when the count value is equal to the preset count value in the process of counting in the duration of the first target pulse signal.
5. The method of claim 1, wherein prior to determining the first count value, the method further comprises:
after receiving the indication information from the GPS module, determining the starting time of the first target pulse according to a pulse signal output by the GPS module after the indication information is sent, wherein the indication information indicates that the positioning of the GPS module is effective.
6. The method of claim 1, wherein the method further comprises:
acquiring a time parameter of a third moment according to a preset protocol of the GPS module;
and determining the time parameter of a fourth time according to the time parameter of the third time, the time length required for increasing one unit value for any counting value and a third counting value, wherein the third counting value is a counting value counted from the third time to the fourth time.
7. A method according to any one of claims 1 to 6, wherein after determining the length of time required for each increment of any one count value by one unit value, the method further comprises:
after each interval for a preset length of time, the loop executes S1 to S2.
8. An apparatus for determining time, comprising:
the counting module is used for counting the duration of a first target pulse signal with known time length from the GPS module and determining a first counting value;
the determining module is further configured to determine, according to the time length of the first target pulse signal and the first count value, a time length required for increasing one unit value by any one count value.
9. 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 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
CN202210237041.7A 2022-03-10 2022-03-10 Method and device for determining time, electronic equipment and storage medium Pending CN114609891A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210237041.7A CN114609891A (en) 2022-03-10 2022-03-10 Method and device for determining time, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210237041.7A CN114609891A (en) 2022-03-10 2022-03-10 Method and device for determining time, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114609891A true CN114609891A (en) 2022-06-10

Family

ID=81863696

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210237041.7A Pending CN114609891A (en) 2022-03-10 2022-03-10 Method and device for determining time, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114609891A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07311290A (en) * 1994-05-17 1995-11-28 Hakusan Kogyo Kk Time generation method and device and its appliance
JP2004029037A (en) * 2003-09-29 2004-01-29 Hakusan Kogyo Kk Time generation apparatus and method thereof
CN101090268A (en) * 2006-06-16 2007-12-19 北京信威通信技术股份有限公司 Method and system for regulating accuracy of crystal vibration frequency using GPS timing pulse
CN101848076A (en) * 2010-05-10 2010-09-29 新邮通信设备有限公司 Clock signal holding method and device
CN103731145A (en) * 2013-12-31 2014-04-16 中国国土资源航空物探遥感中心 Time scale signal generator based on standard time pulse signals
CN106154816A (en) * 2016-07-14 2016-11-23 南京国电南自电网自动化有限公司 A kind of punctual method of automaton high accuracy
CN109407498A (en) * 2018-01-04 2019-03-01 国网四川省电力公司电力科学研究院 A kind of clock of power meter test method and clock of power meter test device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07311290A (en) * 1994-05-17 1995-11-28 Hakusan Kogyo Kk Time generation method and device and its appliance
JP2004029037A (en) * 2003-09-29 2004-01-29 Hakusan Kogyo Kk Time generation apparatus and method thereof
CN101090268A (en) * 2006-06-16 2007-12-19 北京信威通信技术股份有限公司 Method and system for regulating accuracy of crystal vibration frequency using GPS timing pulse
CN101848076A (en) * 2010-05-10 2010-09-29 新邮通信设备有限公司 Clock signal holding method and device
CN103731145A (en) * 2013-12-31 2014-04-16 中国国土资源航空物探遥感中心 Time scale signal generator based on standard time pulse signals
CN106154816A (en) * 2016-07-14 2016-11-23 南京国电南自电网自动化有限公司 A kind of punctual method of automaton high accuracy
CN109407498A (en) * 2018-01-04 2019-03-01 国网四川省电力公司电力科学研究院 A kind of clock of power meter test method and clock of power meter test device

Similar Documents

Publication Publication Date Title
KR100819720B1 (en) Data processing system having an on-chip background debug system and method therefor
CN109981737B (en) Network request processing method, device, terminal and storage medium
CN101221200A (en) Frequency measurement method and apparatus
FR2831968A1 (en) Microcontroller for use in automation applications has R-C oscillator circuit with external reference signal used by calibration device to correct oscillator signal to produce accurate clock signal
WO2023151339A1 (en) Method and system for high-accuracy measurement of interrupt duration of embedded system, and medium
KR20040068971A (en) High accuracy method for determining the frequency of a pulse input signal over a wide frequency range
CN116256532A (en) Speed measurement method, device, equipment and storage medium
CN117519116B (en) Performance data determining method and device of equipment to be monitored and electronic equipment
CN114609891A (en) Method and device for determining time, electronic equipment and storage medium
CN110262920A (en) The indirect dog-feeding method of the external house dog of linux system, house dog feed dog and act on behalf of drive module, watchdog system
CN109491771B (en) Task processing method based on system performance optimization and related equipment
CN107168902B (en) Method for realizing automatic identification of high-speed CAN baud rate by using DMA
CN110990229A (en) System information acquisition method and device
CN111556535B (en) Communication method, communication device, electronic equipment and storage medium
JP4952406B2 (en) Time correction method, microcomputer internal clock, electronic control unit
CN107491358B (en) Rapid fault-tolerant processing method based on large data volume of ground micrometer of carrier rocket
CN112904090A (en) Signal duration acquisition method
CN107632787B (en) Data reading method, device and system
CN111175573A (en) Method, device, equipment and medium for detecting alternating voltage frequency
CN115826731B (en) Sleep control method and device, storage medium and computing equipment
KR100207926B1 (en) Pulse width measuring method and its apparatus
CN111189471A (en) Correction method, correction device and computer storage medium
Yokoyama et al. A real-time operating system with GNSS-based tick synchronization
CN117076169B (en) Method and device for detecting interruption abnormality of operating system and electronic equipment
CN112148444B (en) Data processing method, device, system 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