CN113783649B - Terminal timing method, system, electronic equipment and storage medium - Google Patents

Terminal timing method, system, electronic equipment and storage medium Download PDF

Info

Publication number
CN113783649B
CN113783649B CN202110901044.1A CN202110901044A CN113783649B CN 113783649 B CN113783649 B CN 113783649B CN 202110901044 A CN202110901044 A CN 202110901044A CN 113783649 B CN113783649 B CN 113783649B
Authority
CN
China
Prior art keywords
time
request
receiving
time difference
timing
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
CN202110901044.1A
Other languages
Chinese (zh)
Other versions
CN113783649A (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.)
Shenzhen Clou Electronics Co Ltd
Original Assignee
Shenzhen Clou Electronics 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 Shenzhen Clou Electronics Co Ltd filed Critical Shenzhen Clou Electronics Co Ltd
Priority to CN202110901044.1A priority Critical patent/CN113783649B/en
Publication of CN113783649A publication Critical patent/CN113783649A/en
Application granted granted Critical
Publication of CN113783649B publication Critical patent/CN113783649B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • GPHYSICS
    • G04HOROLOGY
    • G04GELECTRONIC TIME-PIECES
    • G04G5/00Setting, i.e. correcting or changing, the time-indication

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Electric Clocks (AREA)

Abstract

The application discloses a terminal timing method, a terminal timing system, electronic equipment and a storage medium, which are applied to the technical field of computers. The terminal timing method comprises the following steps: the method comprises the steps that a terminal for producing an ammeter sends a first timing request to a first service end, wherein the first timing request comprises first request time, the terminal obtains first standard time sent by the first service end and obtains first receiving time, the first receiving time is time when the terminal receives the first standard time sent by the first service end, the terminal calculates to obtain first timing time according to the first request time, the first standard time and the first receiving time, and then the local time is updated according to the first timing time. The method can be realized by designing a terminal timing method according to the current production conditions and production environments of manufacturers for producing the electric meters: the terminal can check the local time corresponding to the terminal without connecting with the Internet in the production process of the ammeter, and the accuracy of time checking is improved.

Description

Terminal timing method, system, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a terminal timing method, a system, an electronic device, and a storage medium.
Background
When the device is used, clock signals inside the device are important factors for normal operation of the device, for example, some functional modules in the device need the clock signals inside the device to work normally, and in the communication between the devices, the clock signals of the devices need to be kept consistent to ensure the communication quality, so that in general, the clock signals inside the device need to be kept consistent with standard time.
For example, in the process of manufacturing an electric meter, there is a setting that the internal time of the electric meter is aligned with the standard time, and the time error between the internal time of the electric meter and the standard time cannot exceed the error range, because many parameters in the electric meter are based on the time alignment of the electric meter, it is important to ensure the accuracy of the time. On the other hand, the electric meter is also electronic equipment, such as crystal oscillation, individual difference of a capacitor element, the electric meter can show the phenomenon of automatic fast running or slow running under a certain measurement standard, if the time errors of the electric meter and the standard time are accumulated for a long time, the clock time and the standard time of the electric meter have obvious differences, so that most factories write the standard time into the electric meter as the starting time of the electric meter by using a communication means as far as possible with millisecond-level deviation when the electric meter leaves a factory.
The device for writing standard time to the electricity meter is typically one or more conventional terminals, such as a computer, none of which is connected to the internet for network security. At present, timing is usually performed by manually checking computer time at regular time, but timing is not accurate enough due to the fact that timing is performed by naked eyes.
Disclosure of Invention
The present application aims to solve at least one of the technical problems existing in the prior art. Therefore, the terminal timing method, the system, the electronic equipment and the storage medium can check the local time corresponding to the terminal for producing the ammeter in a closed network environment, and improve the accuracy of time check.
According to an embodiment of the first aspect of the present application, a terminal timing method includes:
sending a first timing request to a first service end; the first timing request includes a first request time;
receiving a first standard time generated by the first server according to the first timing request, and acquiring a first receiving time; wherein the first reception time is a time at which the first standard time is received;
obtaining a first timing time according to the first request time, the first standard time and the first receiving time;
And updating the local time according to the first timing time.
The terminal timing method according to the embodiment of the application has at least the following beneficial effects:
the method comprises the steps that a terminal for producing an ammeter sends a first timing request to a first service end, wherein the first timing request comprises first request time, the first service end generates first standard time according to the first request time sent by the terminal and sends the first standard time to the terminal, the terminal obtains the first standard time sent by the first service end and obtains first receiving time, the first receiving time is the time when the terminal receives the first standard time sent by the first service end, the terminal calculates to obtain first timing time according to the first request time, the first standard time and the first receiving time, and then local time is updated according to the first timing time. The method can be realized by designing a terminal timing method according to the current production conditions and production environments of manufacturers for producing the electric meters: the terminal can check the local time corresponding to the terminal without connecting with the Internet in the production process of the ammeter, and the accuracy of time checking is improved.
According to some embodiments of the present application, the obtaining a first timing time according to the first request time, the first standard time, and the first receiving time includes:
Obtaining a first time difference according to the first request time and the first receiving time;
and obtaining a first timing time according to the first time difference and the first standard time.
According to some embodiments of the present application, the method further comprises:
acquiring a preset time difference threshold;
judging the magnitude relation between the first time difference and the time difference threshold;
and if the first time difference is larger than the time difference threshold, executing the step of sending a first timing request to the first service end.
According to some embodiments of the present application, the method further comprises:
sending a second time-correction request to a second server side and a third server side; the second time-correction request includes a second request time;
receiving a second standard time generated by the second server according to the second time-correcting request, and acquiring a second receiving time; wherein the second reception time is a time at which the second standard time is received;
receiving a third standard time generated by the third server according to the second time-correcting request, and acquiring a third receiving time; wherein the third reception time is a time at which the third standard time is received;
obtaining a second correction time according to the second request time, the second standard time, the second receiving time, the third standard time and the third receiving time;
And updating the local time according to the second correction time.
According to some embodiments of the present application, the obtaining a second calibration time according to the second request time, the second standard time, the second receiving time, the third standard time, and the third receiving time includes:
comparing the magnitude relation of the second receiving time and the third receiving time;
if the second receiving time is earlier than or equal to the third receiving time, obtaining a second time difference according to the second request time and the second receiving time, and obtaining a third time difference according to the second request time and the third receiving time;
judging the magnitude relation among the second time difference, the third time difference and a preset time difference threshold;
and if the second time difference and the third time difference are smaller than or equal to the time difference threshold, obtaining the second timing time according to the second time difference and the second standard time.
According to some embodiments of the present application, the method further comprises:
and if the second time difference is larger than the time difference threshold and the third time difference is smaller than or equal to the time difference threshold, obtaining the second time correction time according to the third time difference and the third standard time.
According to some embodiments of the present application, if the second time difference and the third time difference are both greater than the time difference threshold, a prompt message for prompting a timing failure is generated.
A terminal timing system according to an embodiment of the second aspect of the present application includes:
and a sending module: the sending module is used for sending a first timing request to a first service end; the first timing request includes a first request time;
and a receiving module: the receiving module is used for receiving a first standard time generated by the first server according to the first timing request and acquiring a first receiving time; wherein the first reception time is a time at which the first standard time is received;
the generation module is used for: the generation module is used for obtaining a first timing time according to the first request time, the first standard time and the first receiving time;
and an updating module: the updating module is used for updating the local time according to the first timing time.
The terminal timing system according to the embodiment of the application has at least the following beneficial effects:
the terminal timing system of the embodiment of the application comprises: the terminal comprises a sending module, a receiving module, a generating module and an updating module, wherein the sending module of the terminal sends a first timing request to a first service end, the first timing request comprises first request time, the first service end generates first standard time according to the first request time sent by the terminal and sends the first standard time to the terminal, the receiving module is used for obtaining first receiving time sent by the first service end and obtaining first receiving time, the first receiving time is the time of the terminal receiving the first standard time sent by the first service end, the generating module calculates to obtain first timing time according to the first request time, the first standard time and the first receiving time, and the updating module updates local time according to the first timing time. The method relies on the current production conditions and production environment of the manufacturer for producing the electric meter, and can be realized by designing a terminal timing system: the terminal can check the local time corresponding to the terminal without connecting with the Internet in the production process of the ammeter, and the accuracy of time checking is improved.
An electronic device according to an embodiment of a third aspect of the present application includes:
at least one processor, and,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions that are executed by the at least one processor to cause the at least one processor to implement a terminal timing method as in any of the embodiments of the first aspect of the present application when the instructions are executed.
A computer readable storage medium according to an embodiment of a fourth aspect of the present application, comprising:
the computer readable storage medium stores computer executable instructions for performing a terminal timing method according to an embodiment of the first aspect of the present application.
Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application.
Drawings
The application is further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a first flowchart of a terminal timing method according to some embodiments of the present disclosure;
fig. 2 is a specific flowchart of step S130 in the terminal timing method provided in some embodiments of the present application;
FIG. 3 is a second flowchart of a terminal timing method provided in some embodiments of the present application;
FIG. 4 is a third flowchart of a terminal timing method according to some embodiments of the present disclosure;
fig. 5 is a specific flowchart of step S340 in the terminal timing method provided in some embodiments of the present application;
fig. 6 is a block diagram of a module structure of a terminal timing system according to some embodiments of the present application.
Description of the drawings:
a transmitting module 100, a receiving module 200, a generating module 300, and an updating module 400.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
In the description of the present application, a description with reference to the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
In the process of ammeter production and manufacturing, one setting is to time the ammeter internal time and the standard time, the time error between the ammeter internal time and the standard time cannot exceed the error range, and because a plurality of parameters in the ammeter are based on the time alignment of the ammeter, the accuracy of time is very important. On the other hand, the electric meter is also electronic equipment, such as crystal oscillation, individual difference of a capacitor element, the electric meter can show the phenomenon of automatic fast running or slow running under a certain measurement standard, if the time errors of the electric meter and the standard time are accumulated for a long time, the clock time and the standard time of the electric meter have obvious differences, so that most factories write the standard time into the electric meter as the starting time of the electric meter by using a communication means as far as possible with millisecond-level deviation when the electric meter leaves a factory.
The device for writing standard time to the electricity meter is typically one or more conventional terminals, such as a computer, none of which is connected to the internet for network security. At present, timing is usually performed by manually checking computer time at regular time, but timing is not accurate enough due to the fact that timing is performed by naked eyes.
Based on the above, the application provides a terminal timing method, a system, an electronic device and a storage medium, wherein the terminal is used for producing an ammeter and sends a first timing request to a first service end, the first timing request comprises first request time, the first service end generates first standard time according to the first request time sent by the terminal and sends the first standard time to the terminal, the terminal obtains the first standard time sent by the first service end and obtains first receiving time, the first receiving time is the time when the terminal receives the first standard time sent by the first service end, the terminal calculates to obtain first timing time according to the first request time, the first standard time and the first receiving time, and then the local time is updated according to the first timing time. The method can be realized by designing a terminal timing method according to the current production conditions and production environments of manufacturers for producing the electric meters: the terminal can check the local time corresponding to the terminal without connecting with the Internet in the production process of the ammeter, and the accuracy of time checking is improved.
First, several terms and techniques involved in the present disclosure are explained:
MES (manufacturing execution system ): MES software, namely manufacturing enterprise production process execution management software, is a set of production informatization management system facing to a workshop execution layer of a manufacturing enterprise. MES servers are typically computers and computer software that aggregate data, process data.
ERP (enterprise resource planning ): the ERP system is a management platform which is built on the basis of information technology, integrates the information technology and advanced management ideas, and provides decision means for enterprise staff and decision layers by using systematic management ideas. The ERP server is a server which is provided with an ERP system and stores ERP programs.
SAP (enterprise management solution, systems applications and products in data processing): the SAP system is a management system that is customized and created for the enterprise by means of software programs. The SAP server is a server in which an SAP system is installed and SAP programs are stored.
NTP (Network Time Protocol) is a protocol for synchronizing computer time, which allows a computer to synchronize its server or clock source, which provides highly accurate time correction, and which prevents attack of certain protocols by means of encryption validation.
In a first aspect, an embodiment of the present application provides a terminal timing method.
Referring to fig. 1, the terminal timing method of the present application specifically includes the steps of:
s110, sending a first timing request to a first service end;
s120, receiving a first standard time generated by a first server according to a first timing request, and acquiring a first receiving time;
S130, obtaining a first timing time according to the first request time, the first standard time and the first receiving time;
and S140, updating the local time according to the first timing time.
In step S110, the terminal sends a first timing request to a first service end, where the terminal may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and in this embodiment of the present application, the terminal may also be referred to as a client terminal, for the production of an electric meter, where the client terminal mainly writes local time into the electric meter, as a start time of the electric meter, the service end is used to provide a standard time source, and performs time synchronization on the multiple terminals, and it needs to be described that the embodiment of the present application includes multiple service ends, where the first service end is one or more servers that are used to provide standard time in the multiple service ends. In practical application, the application environment of the application is as follows: the system comprises a computer cluster in a closed network environment, wherein the computer cluster basically comprises a plurality of or dozens of servers and a plurality of client terminals, the servers can be but are not limited to various MES servers, ERP servers and SAP servers, a first timing request refers to a request of the terminal for acquiring the time of the first server to a first server, the first timing request is used for timing the local time of the terminal, the first timing request comprises a first request time, and the first request time is the time of the terminal for sending the first timing request to the first server.
In some embodiments, the ways for providing the standard time source by the service end in the embodiments of the present application mainly include: one way is that a server for providing a standard time source is connected with the internet, and the server can realize a time setting function by acquiring standard time corresponding to the internet, specifically: the time setting function of the server is realized by setting a corresponding time server on an operating system of the server, and the other way is that the server for providing the standard time source is not connected with the Internet, in this case, the standard time source can be obtained by adopting an NTP protocol, in addition, the time interval of the server for obtaining the standard time source can be set, for example, time setting is carried out every second, and the accuracy of time checking is improved.
In step S120, the terminal receives a first standard time generated by the first server according to the first timing request, and obtains a first receiving time, where the first standard time is: the first server receives a standard time corresponding to a first timing request sent by the terminal, for example, beijing time, and the first receiving time is a time when the terminal receives the first standard time, that is, a time when the terminal receives a response of the first server.
In step S130, the terminal obtains the first time correction time according to the first request time, the first standard time and the first receiving time, and because the terminal puts forward the first time correction request to the first service end and the first service end responds to the terminal according to the first time correction request in the process of the first standard time, a time error caused by communication can be generated, so that the first request time corresponding to the first time correction request is required to be recorded, the first receiving time of the terminal receiving the response of the first service end is recorded, the time error corresponding to the first standard time is adjusted through the first request time and the first receiving time, and the first time correction time of the terminal requiring time correction is obtained after adjustment.
In some embodiments, as shown in fig. 2, step S130 specifically includes the steps of:
s131, obtaining a first time difference according to the first request time and the first receiving time;
s132, obtaining a first timing time according to the first time difference and the first standard time.
In step S131, the terminal obtains a first time difference according to the first request time and the first receiving time, specifically, subtracting the first request time from the first receiving time to obtain the first time difference, that is, a time difference between a time when the terminal sends the first timing request and a time when the terminal receives the first standard time.
In step S132, the terminal obtains the first time correction time according to the first time difference and the first standard time, and because the first server end consumes a certain time to send the first standard time to the terminal, for accuracy of time correction, the time consumed in the communication process needs to be considered, the first time difference, that is, the time consumed by the terminal to send the request and receive the response, before time correction is performed on the terminal, the time required by the terminal to perform time correction can be obtained by adding the first standard time to the time consumed by the first server end to send the first standard time to the terminal.
In step S140, the terminal updates the local time according to the first timing time, specifically: and updating the local time of the terminal into the first time correcting time to finish the terminal time correcting.
In some embodiments, as shown in fig. 3, the terminal timing method mentioned in the present application specifically further includes the steps of:
s210, acquiring a preset time difference threshold;
s220, judging the magnitude relation between the first time difference and the time difference threshold; if the first time difference is greater than the time difference threshold, step S110 is performed; if the first time difference is less than or equal to the time difference threshold, step S230 is performed;
and S230, updating the local time of the terminal according to the first standard time and the first time difference sent by the first service end.
In step S210, the terminal obtains a preset time difference threshold, where the preset time difference threshold refers to a time difference threshold corresponding to a request sent by the terminal and a response request received by the terminal from the server, and in practical application, the time difference threshold is generally set to 10 ms.
And step S110 is executed by judging the relation between the first time difference and the time difference threshold through step S220, if the first time difference is larger than the time difference threshold, namely, a first timing request is sent to a first service end, when the first time difference is larger than the time difference threshold, the terminal considers that the first service end is overtime, and after the terminal detects that the first service end is overtime, the terminal directly initiates the next first timing request to the service end without waiting for a response message sent by the first service end in order to enable the timing speed of the terminal to be faster. In practical application, the first time difference can be set to be 1 second, that is, the interval frequency of the terminal for requesting timing is set to be 1 second, so that the possibility of real-time timing of second level and a server side is realized, and even if data loss occurs in the middle, the terminal can initiate timing request again; if the first time difference is less than or equal to the time difference threshold, step S230 is performed.
In step S230, since the terminal detects that the first time difference is less than or equal to the time difference threshold, which indicates that the response of the first service end is not overtime, the time consumed by the terminal for acquiring the response of the first service end from the first service end is within the normal range, and the terminal can perform local time correction by using the first standard time sent by the first service end, specifically: and calculating the standard time corresponding to the time when the terminal receives the first standard time according to the first standard time and the first time difference sent by the first service end, and then updating the local time of the terminal to the standard time to finish terminal timing.
In some embodiments, as shown in fig. 4, the terminal timing method mentioned in the present application specifically further includes the steps of:
s310, sending a second time-correction request to a second server side and a third server side;
s320, receiving a second standard time generated by the second server according to the second time-correction request, and acquiring a second receiving time;
s330, receiving a third standard time generated by a third server according to the second time-correction request, and acquiring a third receiving time;
s340, obtaining a second correction time according to the second request time, the second standard time, the second receiving time, the third standard time and the third receiving time;
And S350, updating the local time according to the second correction time.
In step S310, in order to further improve the validity and accuracy of terminal timing, the present application considers that the second server and the third server are utilized to verify the accuracy and consistency of the time of the terminal, where the second server is one or more servers for providing standard time, and similarly, the third server is one or more servers for providing standard time, where the second timing request refers to a request that the terminal obtains standard time from the second server and the third server at the same time, for timing the local time of the terminal, the second timing request includes a second request time, and the second request time is a time that the terminal sends the second timing request to the second server and the third server at the same time.
In step S320, a second standard time generated by the second server according to the second time-correction request is received, and a second receiving time is obtained, where the second standard time is: and the second server receives the standard time corresponding to the second time when the second time correction request sent by the terminal is received, for example, beijing time, and the second receiving time is the time when the terminal receives the second standard time, that is, the time when the terminal acquires the response of the second server.
In step S330, a third standard time generated by the third server according to the second time-correction request is received, and a third receiving time is obtained, where the third standard time is: and the third receiving time is the time when the terminal receives the third standard time, namely the time when the terminal acquires the response of the third server.
In step S340, the second time correction time is obtained according to the second request time, the second standard time, the second receiving time, the third standard time and the third receiving time, and since the terminal respectively proposes the second time correction request to the second server and the third server, and the second server and the third server respectively respond to the second standard time and the third standard time to the terminal according to the second time correction request, a time error caused by communication can be generated, so that the second request time corresponding to the second time correction request is required to be recorded, the second receiving time when the terminal receives the second server response and the third receiving time when the terminal receives the third server response are recorded, and the second time error corresponding to the second standard time or the third standard time is obtained after adjustment by the second request time, the second receiving time and the third receiving time.
In some embodiments, as shown in fig. 5, the terminal timing method mentioned in the present application specifically further includes the steps of:
s341, comparing the magnitude relation between the second receiving time and the third receiving time; if the second receiving time is later than the third receiving time, obtaining a second correcting time according to the third time difference and the third standard time; if the second receiving time is earlier than or equal to the third receiving time, step S342 is performed;
s342, obtaining a second time difference according to the second request time and the second receiving time, and obtaining a third time difference according to the second request time and the third receiving time;
s343, judging the magnitude relation between the second time difference, the third time difference and a preset time difference threshold; if the second time difference is larger than the time difference threshold and the third time difference is smaller than or equal to the time difference threshold, obtaining second correction time according to the third time difference and the third standard time; if the second time difference is smaller than the time difference threshold and the third time difference is greater than or equal to the time difference threshold, then step S344 is performed; if the second time difference and the third time difference are less than or equal to the time difference threshold, step S344 is also performed;
s344, obtaining a second correction time according to the second time difference and the second standard time.
Through step S341, the magnitude relation between the second receiving time and the third receiving time is compared, if the second receiving time is later than the third receiving time, a second time difference is obtained according to the second request time and the second receiving time, and a third time difference is obtained according to the second request time and the third receiving time, if the second time difference and the third time difference are both less than or equal to a time difference threshold, a third timing time is obtained according to the third time difference and a third standard time, so that the terminal receives an earlier response, for example, the terminal receives the earlier response as a response of the third server, and the response is within the time difference threshold, the local time corresponding to the terminal is considered to be adjusted according to the response, and the other server, for example, the second server is used for further checking the timing accuracy of the terminal, if the second receiving time is earlier than or equal to the third receiving time, then step S342 is executed. Further, the second time difference is a time difference between a time when the terminal transmits the second timing request and a time when the terminal receives the second standard time, and the third time difference is a time difference between a time when the terminal transmits the third timing request and a time when the terminal receives the third standard time.
In step S342, a second time difference is obtained according to the second request time and the second receiving time, and a third time difference is obtained according to the second request time and the third receiving time. Here, two cases are divided, in which one case is that the second reception time is equal to the third reception time, specifically: the second receiving time corresponding to the response of the second server is equal to the third receiving time corresponding to the response of the third server, the time when the response is received by the terminal is consistent, the terminal simultaneously responds through the second server and the third server, and verification of accuracy and consistency of the acquired standard time is completed by the terminal. Alternatively, the second reception time is earlier than the third reception time, and further determination is required.
The magnitude relation between the second time difference, the third time difference and the preset time difference threshold is determined in step S343. If the second time difference is greater than the time difference threshold and the third time difference is less than or equal to the time difference threshold, it is indicated that the second server has too long response time, and at this time, it may be considered to verify the relationship between the third time difference and the time difference threshold, and if the third time difference is less than or equal to the time difference threshold, it is indicated that the third server has response time within a preset time range, and the terminal may consider the standard time returned by the third server, specifically: the second correction time is obtained based on the third time difference and the third standard time. If the second time difference is less than the time difference threshold and the third time difference is greater than or equal to the time difference threshold, step S344 is performed. If the second time difference and the third time difference are smaller than the time difference threshold, step S344 is also performed.
In step S344, a second correction time is obtained from the second time difference and the second standard time. The method includes the steps that the second time difference is detected to be smaller than a time difference threshold value by the terminal, the third time difference is larger than or equal to the time difference threshold value, the second server response time is within a preset range, the second server response time is earlier than the third server response time, and the terminal can consider the standard time returned by the second server; in another case, the terminal detects that the second time difference and the third time difference are smaller than the time difference threshold, which means that the response time of the second service end and the response time of the third service end meet the time difference requirement, and because the response time of the second terminal is early, the terminal can consider the standard time returned by the second service end, and after the terminal determines the second service end, the terminal obtains the second timing time according to the second time difference and the second standard time sent by the second service end, wherein the second timing time is used for updating the local time of the terminal. In the embodiment of the application, whether the response efficiency is within the time difference threshold is judged according to the response time of different service ends, so that the response efficiency can be known in real time, for example, the terminal receives an earlier response, for example, the terminal receives the earlier response as the response of the second service end, and the response is within the time difference threshold, the local time corresponding to the terminal is considered to be adjusted according to the response, and the other service ends, for example, the third service end, are used for further checking the terminal timing accuracy.
In some embodiments, the terminal timing method mentioned in the present application specifically further includes the steps of: if the second time difference is larger than the time difference threshold and the third time difference is smaller than or equal to the time difference threshold, obtaining second calibration time according to the third time difference and third standard time, if the second time difference is larger than the time difference threshold, the second server-side response time is too long, at the moment, the relationship between the third time difference and the time difference threshold can be considered for verification, if the third time difference is smaller than or equal to the time difference threshold, the third server-side response time is within a preset time range, the terminal can consider the standard time returned by the third server-side, and the two server-side response is performed simultaneously.
In some embodiments, the terminal timing method mentioned in the present application specifically further includes the steps of: if the second time difference and the third time difference are both larger than the time difference threshold, the fact that the response time of the second server side and the response time of the third server side are too long are indicated, prompt information for prompting failure of timing is required to be generated at the moment, and a user is prompted to find a problem in an alarm mode.
In step S350, the local time is updated according to the second calibration time, specifically: and updating the local time of the terminal to the second time correcting time to finish the terminal time correcting.
In the embodiment of the application, a terminal for producing an ammeter sends a first timing request to a first service end, wherein the first timing request comprises a first request time, the first service end generates a first standard time according to the first request time sent by the terminal and sends the first standard time to the terminal, the terminal obtains the first standard time sent by the first service end and obtains a first receiving time, the first receiving time is the time when the terminal receives the first standard time sent by the first service end, the terminal calculates to obtain the first timing time according to the first request time, the first standard time and the first receiving time, and then the local time is updated according to the first timing time. The method can be realized by designing a terminal timing method according to the current production conditions and production environments of manufacturers for producing the electric meters: the terminal can check the local time corresponding to the terminal without connecting with the Internet in the production process of the ammeter, and the accuracy of time checking is improved.
In a second aspect, as shown in fig. 6, an embodiment of the present application further provides a terminal timing system, including: the terminal comprises a sending module 100, a receiving module 200, a generating module 300 and an updating module 400, wherein the sending module 100 of the terminal sends a first timing request to a first service end, the first timing request comprises a first request time, the first service end generates a first standard time according to the first request time sent by the terminal and sends the first standard time to the terminal, the receiving module 200 is used for obtaining a first receiving time sent by the first service end and obtaining the first receiving time, the first receiving time is the time when the terminal receives the first standard time sent by the first service end, the generating module 300 calculates to obtain the first timing time according to the first request time, the first standard time and the first receiving time, and the updating module 400 updates the local time according to the first timing time. The method relies on the current production conditions and production environment of the manufacturer for producing the electric meter, and can be realized by designing a terminal timing system: the terminal can check the local time corresponding to the terminal without connecting with the Internet in the production process of the ammeter, and the accuracy of time checking is improved.
In a third aspect, an embodiment of the present application further provides an electronic device.
In some embodiments, an electronic device includes: at least one processor, and a memory communicatively coupled to the at least one processor; the memory stores instructions that are executed by the at least one processor to cause the at least one processor to implement any one of the terminal timing methods in the embodiments of the present application when executing the instructions.
The processor and the memory may be connected by a bus or other means.
The memory is used as a non-transitory computer readable storage medium for storing non-transitory software programs and non-transitory computer executable programs, such as the terminal timing method described in the embodiments of the present application. The processor implements the terminal timing method described above by running a non-transitory software program and instructions stored in memory.
The memory may include a memory program area and a memory data area, wherein the memory program area may store an operating system, at least one application program required for a function; the storage data area may store and execute the terminal timing method described above. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory remotely located relative to the processor, the remote memory being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The non-transitory software programs and instructions required to implement the terminal timing method described above are stored in memory and when executed by one or more processors, perform the terminal timing method referred to in the embodiments of the first aspect described above.
In a fourth aspect, embodiments of the present application also provide a computer-readable storage medium.
In some embodiments, a computer readable storage medium stores computer executable instructions for performing the terminal timing method mentioned in the embodiments of the first aspect.
In some embodiments, the storage medium stores computer-executable instructions that are executed by one or more control processors, e.g., by one of the processors in the electronic device, which may cause the one or more processors to perform the terminal timing method.
The above described apparatus embodiments are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Those of ordinary skill in the art will appreciate that all or some of the steps, systems, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as known to those skilled in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Furthermore, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media.
The embodiments of the present application have been described in detail above with reference to the accompanying drawings, but the present application is not limited to the above embodiments, and various changes can be made within the knowledge of one of ordinary skill in the art without departing from the spirit of the present application. Furthermore, embodiments of the present application and features of the embodiments may be combined with each other without conflict.

Claims (5)

1. A terminal timing method, comprising:
sending a first timing request to a first service end; the first timing request includes a first request time;
receiving a first standard time generated by the first server according to the first timing request, and acquiring a first receiving time; wherein the first reception time is a time at which the first standard time is received;
obtaining a first time difference according to the first request time and the first receiving time;
acquiring a preset time difference threshold;
judging the magnitude relation between the first time difference and the time difference threshold;
if the first time difference is larger than the time difference threshold, executing the step of sending a first timing request to a first service end;
if the first time difference is smaller than or equal to the time difference threshold, dividing the first time difference by two to obtain a consumed time difference; adding the first standard time and the consumed time difference to obtain a first time correction time;
Updating the local time according to the first timing time;
sending a second time-correction request to a second server side and a third server side; the second time-correction request includes a second request time;
receiving a second standard time generated by the second server according to the second time-correcting request, and acquiring a second receiving time; wherein the second reception time is a time at which the second standard time is received;
receiving a third standard time generated by the third server according to the second time-correcting request, and acquiring a third receiving time; wherein the third reception time is a time at which the third standard time is received;
comparing the magnitude relation of the second receiving time and the third receiving time;
if the second receiving time is earlier than or equal to the third receiving time, obtaining a second time difference according to the second request time and the second receiving time, and obtaining a third time difference according to the second request time and the third receiving time;
judging the magnitude relation among the second time difference, the third time difference and a preset time difference threshold;
if the second time difference and the third time difference are smaller than or equal to the time difference threshold, obtaining a second correction time according to the second time difference and the second standard time;
If the second time difference is larger than the time difference threshold and the third time difference is smaller than or equal to the time difference threshold, obtaining the second time correction time according to the third time difference and the third standard time;
and updating the local time according to the second correction time.
2. The terminal timing method as set forth in claim 1, further comprising:
and if the second time difference and the third time difference are both larger than the time difference threshold, generating prompt information for prompting failure of timing.
3. A terminal timing system, comprising:
and a sending module: the sending module is used for sending a first timing request to a first service end; the first timing request includes a first request time;
and a receiving module: the receiving module is used for receiving a first standard time generated by the first server according to the first timing request and acquiring a first receiving time; wherein the first reception time is a time at which the first standard time is received;
the generation module is used for: the generating module is used for obtaining a first time difference according to the first request time and the first receiving time; acquiring a preset time difference threshold; judging the magnitude relation between the first time difference and the time difference threshold; if the first time difference is larger than the time difference threshold, executing the step of sending a first timing request to a first service end; if the first time difference is smaller than or equal to the time difference threshold, dividing the first time difference by two to obtain a consumed time difference; adding the first standard time and the consumed time difference to obtain a first time correction time;
And an updating module: the updating module is used for updating the local time according to the first timing time;
sending a second time-correction request to a second server side and a third server side; the second time-correction request includes a second request time;
receiving a second standard time generated by the second server according to the second time-correcting request, and acquiring a second receiving time; wherein the second reception time is a time at which the second standard time is received;
receiving a third standard time generated by the third server according to the second time-correcting request, and acquiring a third receiving time; wherein the third reception time is a time at which the third standard time is received;
comparing the magnitude relation of the second receiving time and the third receiving time;
if the second receiving time is earlier than or equal to the third receiving time, obtaining a second time difference according to the second request time and the second receiving time, and obtaining a third time difference according to the second request time and the third receiving time;
judging the magnitude relation among the second time difference, the third time difference and a preset time difference threshold;
if the second time difference and the third time difference are smaller than or equal to the time difference threshold, obtaining a second correction time according to the second time difference and the second standard time;
If the second time difference is larger than the time difference threshold and the third time difference is smaller than or equal to the time difference threshold, obtaining the second time correction time according to the third time difference and the third standard time;
and updating the local time according to the second correction time.
4. An electronic device, comprising:
at least one processor, and,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions that are executed by the at least one processor to cause the at least one processor to implement the terminal timing method of any of claims 1 to 2 when the instructions are executed.
5. A computer readable storage medium storing computer executable instructions for performing the terminal timing method according to any one of claims 1 to 2.
CN202110901044.1A 2021-08-06 2021-08-06 Terminal timing method, system, electronic equipment and storage medium Active CN113783649B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110901044.1A CN113783649B (en) 2021-08-06 2021-08-06 Terminal timing method, system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110901044.1A CN113783649B (en) 2021-08-06 2021-08-06 Terminal timing method, system, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113783649A CN113783649A (en) 2021-12-10
CN113783649B true CN113783649B (en) 2023-12-29

Family

ID=78836919

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110901044.1A Active CN113783649B (en) 2021-08-06 2021-08-06 Terminal timing method, system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113783649B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116165868B (en) * 2023-03-20 2023-12-15 苏州东剑智能科技有限公司 Time calibration method and device for data acquisition instrument

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105490798A (en) * 2015-11-25 2016-04-13 尹璐 Synchronization method and synchronization system for standard time and fighting time of cross-platform terminals of multiple types
CN110855394A (en) * 2018-08-21 2020-02-28 杭州海康威视系统技术有限公司 Time correction method, device, system, equipment and storage medium
CN111490843A (en) * 2020-04-03 2020-08-04 腾讯科技(深圳)有限公司 Time checking method and device, computer equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105490798A (en) * 2015-11-25 2016-04-13 尹璐 Synchronization method and synchronization system for standard time and fighting time of cross-platform terminals of multiple types
CN110855394A (en) * 2018-08-21 2020-02-28 杭州海康威视系统技术有限公司 Time correction method, device, system, equipment and storage medium
CN111490843A (en) * 2020-04-03 2020-08-04 腾讯科技(深圳)有限公司 Time checking method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113783649A (en) 2021-12-10

Similar Documents

Publication Publication Date Title
CN107295080B (en) Data storage method applied to distributed server cluster and server
CN109951331B (en) Method, device and computing cluster for sending information
US20180034646A1 (en) Method and apparatus for seamless remote renewal of offline generated digital identity certificates to field deployed hardware security modules
US20100174807A1 (en) System and method for providing configuration synchronicity
CN110572443B (en) Long connection state updating method, server and storage medium
CN112866098B (en) Gateway time service method, device, electronic equipment and computer readable medium
CN103024065A (en) System configuration management method for cloud storage system
CN113835336B (en) Multi-dimensional self-adaptive metering device patrol and timing method for supporting electric power spot market
CN113783649B (en) Terminal timing method, system, electronic equipment and storage medium
CN111212135A (en) Message subscription method, device, system, electronic equipment and storage medium
CN105450682A (en) Method, device, and system for data synchronous storage and synchronizing data to client
CN111352943A (en) Method and device for realizing data consistency, server and terminal
CN107592199B (en) Data synchronization method and system
CN113051539A (en) Method and device for calling digital certificate
CN112769517B (en) T-BOX time synchronization method and device
JP4943783B2 (en) Time synchronization apparatus, time synchronization system, time synchronization method, and program
US20090075643A1 (en) System and method of object simulation in an intermittently connected mobile application
CN108737184B (en) Management method and device of disaster recovery system
CN109032646B (en) Method, device and system for updating application
US20220393888A1 (en) Method for distributed and secure timekeeping
CN110572857A (en) Network connection processing method and device
CN110750424B (en) Resource inspection method and device
CN113157472A (en) Service information processing method, device, equipment and computer storage medium
CN109947727B (en) Data processing method, device, computer equipment and storage medium
CN117640664B (en) Identification data synchronization method, system, electronic equipment 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
GR01 Patent grant
GR01 Patent grant