CN115767706A - Time calibration method and device, mobile terminal and storage medium - Google Patents

Time calibration method and device, mobile terminal and storage medium Download PDF

Info

Publication number
CN115767706A
CN115767706A CN202211268137.6A CN202211268137A CN115767706A CN 115767706 A CN115767706 A CN 115767706A CN 202211268137 A CN202211268137 A CN 202211268137A CN 115767706 A CN115767706 A CN 115767706A
Authority
CN
China
Prior art keywords
time
server
mobile terminal
local
difference
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
CN202211268137.6A
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.)
Chezhi Interconnection Beijing Technology Co ltd
Original Assignee
Chezhi Interconnection Beijing 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 Chezhi Interconnection Beijing Technology Co ltd filed Critical Chezhi Interconnection Beijing Technology Co ltd
Priority to CN202211268137.6A priority Critical patent/CN115767706A/en
Publication of CN115767706A publication Critical patent/CN115767706A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Electric Clocks (AREA)

Abstract

The invention discloses a time calibration method, a device, a mobile terminal and a storage medium, wherein the method is suitable for being executed in the mobile terminal, the mobile terminal is in communication connection with a server, and the method comprises the following steps: sending a time acquisition request to a server to indicate the server to feed back the current server time, and recording the local time of sending the time acquisition request as a first time; receiving server time fed back by the server, and recording local time of the received server time as second time; determining whether the local time in the mobile terminal is accurate or not according to the first time, the second time and the server time; and if the local time in the mobile terminal is inaccurate, calibrating the local time in the mobile terminal according to the server time and the second time.

Description

Time calibration method, device, mobile terminal and storage medium
Technical Field
The invention relates to the technical field of internet, in particular to a time calibration method, a time calibration device, a mobile terminal and a storage medium.
Background
The Read Native (RN) is an open-source cross-platform mobile application development framework, can support two large platforms of iOS (mobile operating system developed by apple) and Android (Android), and develops mobile applications by using JS (JavaScript, a lightweight, interpreted, or just-in-time compilation programming language with function priority) and CSS (Cascading Style Sheets).
The RN is used as a JS framework for constructing a user interface, response type and componentization development of data are realized, and the RN can be used for website projects and mobile terminal application projects. In other words, based on the RN, JS can be used to write logic of different platform applications, and a UI (User Interface) can be kept entirely native, which is simpler and more efficient than native code development applications.
Currently, the number of websites or applications developed through RN has increased, and the coverage types are also wider and wider, including tourism applications, information applications, shopping applications, etc. Taking the shopping application as an example, when a user wants to participate in the second killing of the commodity in the shopping application, the time accuracy and precision are highly required. At this time, the local time of the mobile terminal for installing the shopping application is ensured to be consistent with the server time of the server for providing services for the shopping application as much as possible, so that the probability of obtaining the psychographic goods by the user can be improved.
If there is a large deviation between the local time and the server time, the local time needs to be calibrated. The conventional time alignment scheme includes three types, the first type is that the RN acquires the server time maintained by the native code as the local time to achieve alignment by means of communication with the native code, but since the time update frequency is low, this does not meet the precision requirement of the second killing, and there is a certain time difference in the above communication. The second method is to calculate and store the difference value between the local time and the server time returned by the interface periodically, and directly add the corresponding difference value to the local time when calibration is needed.
The third is to retrieve the server time when the data is requested from the server for the first time, and then use a timer to count time, so as to realize the calibration of the local time. However, when the server time is obtained, the interface has a delay of response time, and then is timed by a timer, for example, the built-in methods of setTimeout (for calling a function or calculating an expression after a specified number of milliseconds) and setInterval (for calling a function or calculating an expression according to a specified period) also have errors, the errors of different platforms are different, and are affected by various factors such as machine performance, memory occupation and the like, and a few seconds of error is possible, which is unacceptable in a second killing scenario.
Therefore, a new time alignment method is needed to optimize the above process.
Disclosure of Invention
To this end, the present invention provides a time alignment scheme in an attempt to solve or at least alleviate the above-presented problems.
According to a method of the present invention, a time calibration method is provided, which is suitable for being executed in a mobile terminal, wherein the mobile terminal is in communication connection with a server, and the method comprises the following steps: firstly, sending a time acquisition request to a server to indicate the server to feed back the current server time, and simultaneously recording the local time of sending the time acquisition request as a first time; receiving server time fed back by the server, and recording local time of the received server time as second time; determining whether the local time in the mobile terminal is accurate or not according to the first time, the second time and the server time; and if the local time in the mobile terminal is inaccurate, calibrating the local time in the mobile terminal according to the server time and the second time.
Optionally, in the time calibration method according to the present invention, the step of determining whether the local time in the mobile terminal is accurate according to the first time, the second time and the server time includes: calculating a result of subtracting the first time from the second time as a first difference; and if the first difference is smaller than a preset first time threshold, determining whether the local time in the mobile terminal is accurate or not based on the size relationship among the first time, the second time and the server time and the first difference.
Optionally, in the time calibration method according to the present invention, the step of determining whether the local time in the mobile terminal is accurate based on a magnitude relationship between the first time, the second time, and the server time and the first difference, includes: and if the server time is greater than the first time and less than the second time and the first difference is less than a preset second time threshold, determining that the local time in the mobile terminal is accurate, otherwise determining that the local time in the mobile terminal is inaccurate.
Optionally, in the time calibration method according to the present invention, the step of calibrating the local time in the mobile terminal according to the server time and the second time includes: calculating the result of subtracting the second time from the server time as a second difference value; and acquiring local time in the mobile terminal according to a preset time interval, and calibrating the acquired local time through a second difference value.
Optionally, in the time calibration method according to the present invention, the step of calibrating the obtained local time by using the second difference includes: calculating a result obtained by subtracting the corresponding expected time from the local time obtained this time as a third difference value; and if the third difference is larger than a preset third time threshold, taking the sum of the local time acquired this time, the second difference and the third difference as the calibrated local time.
Optionally, in the time calibration method according to the present invention, the step of calibrating the obtained local time by using the second difference includes: and if the third difference is smaller than or equal to the third time threshold, taking the sum of the local time acquired this time and the second difference as the calibrated local time.
Optionally, in the time calibration method according to the present invention, the expected time is the sum of the last acquired local time and the time interval.
According to one aspect of the present invention, a time calibration apparatus adapted to reside in a mobile terminal, the mobile terminal being in communication with a server, the apparatus includes a sending module, a receiving module, a determining module, and a calibration module. The sending module is suitable for sending a time obtaining request to the server so as to indicate the server to feed back the current server time, and meanwhile, the local time for sending the time obtaining request is recorded as a first time; the receiving module is suitable for receiving the server time fed back by the server and recording the local time of the received server time as second time; the determining module is suitable for determining whether the local time in the mobile terminal is accurate according to the first time, the second time and the server time; the calibration module is suitable for calibrating the local time in the mobile terminal according to the server time and the second time when the local time in the mobile terminal is inaccurate.
According to an aspect of the present invention, there is provided a mobile terminal including: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the time calibration method as described above.
According to an aspect of the present invention, there is provided a readable storage medium storing program instructions that, when read and executed by a mobile terminal, cause the mobile terminal to perform the time alignment method as described above.
According to the time calibration scheme, firstly, a time acquisition request is sent to the server to acquire the current server time fed back by the server, the local time for sending the time acquisition request is respectively recorded as a first time, the local time for receiving the server time is recorded as a second time, and whether the local time in the mobile terminal is accurate or not is determined according to the first time, the second time and the third time, so that the problem that the interface response time of the server is too long due to network delay and the like is solved. When the local time is not accurate, the time is calibrated according to the server time and the second time so as to reduce errors generated in the timing process to a receivable range, realize the unification of the time of the mobile terminal and the server, namely the front end and the back end, and meet the high-precision requirement on the time in a second killing scene.
In the specific calibration process, in order to prevent inaccurate time caused by local time modification, a result of subtracting the second time from the server time is calculated as a second difference value, the local time is obtained according to a preset time interval, a result of subtracting the corresponding expected time from the obtained local time is calculated as a third difference value, and the obtained local time is calibrated correspondingly according to the magnitude relation between the third difference value and a third time threshold value and in combination with the second difference value.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
Fig. 1 illustrates a block diagram of a mobile terminal 100 according to an embodiment of the present invention;
FIG. 2 shows a flow diagram of a method 200 of time calibration according to one embodiment of the invention; and
fig. 3 shows a schematic diagram of a time alignment apparatus 300 according to an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 illustrates a block diagram of a mobile terminal 100 according to an embodiment of the present invention. The mobile terminal 100 may be a mobile phone, a tablet computer, a notebook computer, a multimedia player, a wearable device, etc. configured with a front camera and a display screen, but is not limited thereto. As shown in FIG. 1, the mobile terminal 100 may include a memory interface 102, a multi-core processor 104, and a peripheral interface 106.
The memory interface 102, the multicore processor 104, and/or the peripheral interface 106 may be discrete components or may be integrated in one or more integrated circuits. In the mobile terminal 100, the various elements may be coupled by one or more communication buses or signal lines. Sensors, devices, and subsystems can be coupled to peripheral interface 106 to facilitate a variety of functions.
For example, the acceleration sensor 110, the magnetic field sensor 112, and the gravity sensor 114 may be coupled to the peripheral interface 106, the acceleration sensor 110 may collect acceleration data in three coordinate axis directions of the body coordinate system, the magnetic field sensor 112 may collect magnetic field data (magnetic induction intensity) in three coordinate axis directions of the body coordinate system, the gravity sensor 114 may collect gravity data in three coordinate axes of the body coordinate system, and the above sensors may conveniently implement functions such as step counting, orientation, and intelligent horizontal and vertical screen switching. Other sensors 116 may also be coupled to the peripheral interface 106, such as a positioning system (e.g., a GPS receiver), a temperature sensor, a biometric sensor, or other sensing device, to facilitate related functions.
The camera subsystem 120 and optical sensor 122, which may be, for example, a charge-coupled device (CCD) or a complementary metal-oxide semiconductor (CMOS) optical sensor, may be used to facilitate implementation of camera functions such as recording photographs and video clips. Communication functions may be facilitated by one or more wireless communication subsystems 124, which may include radio frequency receivers and transmitters and/or optical (e.g., infrared) receivers and transmitters. The particular design and implementation of the wireless communication subsystem 124 may be dependent upon one or more communication networks supported by the mobile terminal 100. For example, the mobile terminal 100 may include a wireless communication subsystem 124 designed to support LTE, 3G, GSM networks, GPRS networks, EDGE networks, wi-Fi or WiMax networks, and Bluetooth networks.
The audio subsystem 126 may be coupled to a speaker 128 and a microphone 130 to facilitate voice-enabled functions, such as voice recognition, voice replication, digital recording, and telephony functions. The I/O subsystem 140 may include a touch screen controller 142 and/or one or more other input controllers 144. The touch screen controller 142 may be coupled to a touch screen 146. For example, the touch screen 146 and touch screen controller 142 may detect contact and movement or pauses made therewith using any of a variety of touch sensing technologies, including but not limited to capacitive, resistive, infrared, and surface acoustic wave technologies. One or more other input controllers 144 may be coupled to other input/control devices 148 such as one or more buttons, rocker switches, thumbwheels, infrared ports, USB ports, and/or pointing devices such as styluses. The one or more buttons (not shown) may include up/down buttons for controlling the volume of the speaker 128 and/or microphone 130.
The memory interface 102 may be coupled with a memory 150. The memory 150 may include an internal memory such as, but not limited to, a Static Random Access Memory (SRAM), a non-volatile memory (NVRAM), and the like; the external memory may be, for example, a hard disk, a removable hard disk, a U disk, etc., but is not limited thereto. The memory 150 may store program instructions, which may include, for example, an operating system 152 and applications 154. The operating system 152 may be, for example, android, iOS, windows Phone, etc., which includes program instructions for handling basic system services and for performing hardware dependent tasks. The memory 150 may also store applications 154, and the applications 154 may include program instructions for implementing various user-desired functions. The application 154 may be provided separately from the operating system or may be native to the operating system. In addition, a driver module may also be added to the operating system when the application 154 is installed in the mobile terminal 100. While the mobile device is running, the operating system 152 is loaded from the memory 150 and executed by the processor 104. The application 154 is also loaded from the memory 150 and executed by the processor 104 at runtime. The application 154 runs on top of an operating system, and utilizes interfaces provided by the operating system and underlying hardware to implement various user-desired functions, such as hardware management, instant messaging, web browsing, and the like.
In one embodiment, the above-mentioned memory 150 stores program instructions comprising a plurality of program instructions adapted to perform the time alignment method 200 of the present invention, which can be executed by a processor, so that the time alignment method 200 of the present invention can be executed in the mobile terminal 100.
In one embodiment, the application 154 includes a time calibration apparatus 300 therein, and the time calibration apparatus 300 includes a plurality of program instructions adapted to execute the time calibration method 200 of the present invention therein, which can be executed by a processor, so that the time calibration method 200 of the present invention can be executed in the time calibration apparatus 300 of the mobile terminal 100.
FIG. 2 shows a flow diagram of a method 200 of time calibration according to one embodiment of the invention. The method 200 may be performed in a mobile terminal, such as the mobile terminal 100 described above.
In this embodiment, the application A1 developed by RN is installed in the mobile terminal 100, the application A1 is a shopping application, and the user can browse, inquire, and purchase goods using the application A1 in the mobile terminal 100. The mobile terminal 100 is in communication connection with a server, the server provides services for the application A1 to the user, for example, when the user operates the application A1 to purchase a certain item, the mobile terminal 100 sends a corresponding request to the server in an interface manner through the application A1, and the server receives the request and then responds and feeds back a processing result.
Assuming that the user wants to participate in the second killing of the special price commodity developed in the application A1, which is started at 12 pm every day, in order to ensure that the local time in the mobile terminal and the server time in the server are as consistent as possible, the local time needs to be calibrated by the method 200 of the present invention. Of course, it should be noted that the following time calibration scheme is not limited to the second killing scenario, and may be applied to other similar scenarios where the accuracy requirement for the local time is high.
As shown in fig. 2, the method 200 begins at step S210. In step S210, a time acquisition request is sent to the server to instruct the server to feed back the current server time, while recording the local time of sending the time acquisition request as the first time.
According to an embodiment of the present invention, the corresponding interface is called to send a time obtaining request to the server, and after receiving the time obtaining request, the server feeds back the current server time to the mobile terminal 100. While sending the time acquisition request, recording local time of sending the time acquisition request as a first time.
Subsequently, step S220 is entered, the server time fed back by the server is received, and the local time of receiving the server time is recorded as the second time. For convenience of description, the first time, the second time, and the server time are respectively denoted as LBT, LET, and ST.
In step S230, it is determined whether the local time in the mobile terminal is accurate according to the first time, the second time, and the server time.
According to an embodiment of the present invention, whether the local time in the mobile terminal is accurate may be determined according to the first time, the second time, and the server time in the following manner. In this embodiment, first, the result of subtracting the first time from the second time is calculated as a first difference, and the first difference is denoted as C1, so that C1= LET-LBT can be obtained.
If the first difference is smaller than a preset first time threshold, determining that the local time in the mobile terminal is available, but further judging whether the local time is accurate, and at the moment, determining whether the local time in the mobile terminal is accurate or not based on the size relationship among the first time, the second time and the server time and the first difference. Specifically, if the server time is greater than the first time and less than the second time, and the first difference is less than a preset second time threshold, it is determined that the local time in the mobile terminal is accurate, otherwise it is determined that the local time in the mobile terminal is inaccurate.
If the first difference is greater than or equal to the first time threshold, it indicates that the local time is incorrect, and a manual adjustment may be required. Typically, the first time threshold is preset to 3000ms (milliseconds) and the second time threshold is preset to 1000ms. In other words, if C1<3000ms, the local time is considered available, on this basis, if LBT < ST < LET and C1<1000ms, the local time is judged to be accurate and can be used directly without calibration.
Finally, step S240 is executed, and if the local time in the mobile terminal is not accurate, the local time in the mobile terminal is calibrated according to the server time and the second time.
According to one embodiment of the present invention, the local time in the mobile terminal may be calibrated according to the server time and the second time in the following manner. In this embodiment, the result of subtracting the second time from the server time is calculated as a second difference, and if the second difference is denoted as C2, then C2= ST-LET. And then, acquiring the local time in the mobile terminal according to a preset time interval, and calibrating the acquired local time through a second difference value. The time interval is denoted by S and is typically set to 500ms.
When the acquired local time is calibrated by the second difference, firstly, a result obtained by subtracting the corresponding expected time from the local time acquired this time is calculated as a third difference, where the expected time is a sum of the local time acquired last time and a time interval, that is, the local time which should be acquired this time theoretically. And respectively representing the local time acquired this time, the local time acquired last time, the expected time and a third difference value by LT, BT, ZT and C3, wherein ZT = BT + S and C3= LT-ZT correspondingly.
If the third difference is greater than a preset third time threshold, the sum of the local time obtained this time, the second difference and the third difference is used as the calibrated local time, and if the third difference is less than or equal to the third time threshold, the sum of the local time obtained this time and the second difference is used as the calibrated local time. In this case, the calibrated local time may be equivalent to the server time at the same time.
The third time threshold here is a predefined constant, and is used to control an error range between the local time actually obtained this time and the expected time, and if the requirement on the accuracy of time is relatively high, the preset third time threshold needs to be smaller, for example, 300ms, and vice versa. And Z represents a third threshold value, when C3> Z, the calibrated local time is LT + C2+ C3, and when C3 is less than or equal to Z, the calibrated local time is LT + C2.
In addition, the calibration time can also adopt the return time after switching, namely, the calibration is carried out again each time the switching is carried out by monitoring the switching of the foreground and the background. The foreground means that the current application or page is in a visible state, and the background means that the current application or page leaves from the current application or page, the current application or page is switched to the desktop or other applications, but the current application is not ended or the current page is closed, and the current application or page is switched back again by the return finger. For example, the user browses details of the second killing of the special price commodity in the application A1, and if the user restarts another application review message to leave from the application A1, and returns to the application A1 again to continue to view the second killing after a while, the calibration of the local time may be started at the time when the user returns to the application A1.
Fig. 3 shows a schematic diagram of a time alignment apparatus 300 according to an embodiment of the invention. The time alignment apparatus 300 resides in a mobile terminal (e.g., the aforementioned mobile terminal 100). The time alignment apparatus 300 aligns the local time by performing the time alignment method 200 of the present invention.
As shown in fig. 3, the time calibration apparatus 300 includes a transmitting module 310, a determining module 330, and a calibrating module 340 connected in sequence, and a receiving module 320 connected to the determining module 330 and the calibrating module 340, respectively.
The sending module 310 may send a time obtaining request to the server to instruct the server to feed back the current server time, and record the local time of sending the time obtaining request as the first time. The receiving module 320 may receive the server time fed back by the server and record a local time of receiving the server time as the second time. The determining module 330 may determine whether the local time in the mobile terminal is accurate based on the first time, the second time, and the server time. The calibration module 340 may calibrate the local time in the mobile terminal according to the server time and the second time when the local time in the mobile terminal is inaccurate.
It should be noted that the sending module 310 is configured to execute the aforementioned step S210, the receiving module 320 is configured to execute the aforementioned step S220, the determining module 330 is configured to execute the aforementioned step S230, and the calibrating module 340 is configured to execute the aforementioned step S240. Here, for the execution logic of the sending module 310, the receiving module 320, the determining module 330 and the calibrating module 340, reference may be made to the detailed description of steps S210 to S240 in the method 200, and details are not repeated here.
According to the time calibration scheme provided by the embodiment of the invention, firstly, a time acquisition request is sent to the server to acquire the current server time fed back by the server, the local time for sending the time acquisition request is respectively recorded as the first time, and the local time for receiving the server time is recorded as the second time, and whether the local time in the mobile terminal is accurate is determined according to the first time, the second time and the third time, so that the problem of overlong interface response time of the server caused by network delay and the like is solved. When the local time is inaccurate, the local time is calibrated according to the server time and the second time so as to reduce errors generated in the timing process to a receivable range, realize unification of the time of the mobile terminal and the server, namely the front end and the back end, and meet the high-precision requirement on the time in the second killing scene.
In the technical scheme, an RN and native communication mode is not needed, accurate local time can be ensured in a website or application developed based on the RN, the situations that errors and timers are unreliable due to communication are avoided, and the time calibration mode can be used in other similar scenes. In the specific calibration process, in order to prevent inaccurate time caused by local time modification, a result of subtracting the second time from the server time is calculated as a second difference value, the local time is obtained according to a preset time interval, a result of subtracting the corresponding expected time from the obtained local time is calculated as a third difference value, and the obtained local time is calibrated correspondingly according to the magnitude relation between the third difference value and a third time threshold value and in combination with the second difference value.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the mobile terminal generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to perform the time alignment method of the present invention according to instructions in said program code stored in the memory.
By way of example, and not limitation, readable media includes readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. 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. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system is apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: rather, the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Additionally, some of the embodiments are described herein as a method or combination of method elements that can be implemented by a processor of a computer system or by other means of performing the described functions. A processor with the necessary instructions for carrying out the method or the method elements thus forms a device for carrying out the method or the method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed with respect to the scope of the invention, which is to be considered as illustrative and not restrictive, and the scope of the invention is defined by the appended claims.

Claims (10)

1. A time calibration method adapted to be executed in a mobile terminal, the mobile terminal being in communication connection with a server, the method comprising:
sending a time acquisition request to the server to indicate the server to feed back the current server time, and recording local time for sending the time acquisition request as first time;
receiving the server time fed back by the server, and recording local time of receiving the server time as second time;
determining whether the local time in the mobile terminal is accurate or not according to the first time, the second time and the server time;
and if the local time in the mobile terminal is inaccurate, calibrating the local time in the mobile terminal according to the server time and the second time.
2. The method of claim 1, wherein the determining whether the local time in the mobile terminal is accurate based on the first time, the second time, and the server time comprises:
calculating a result of subtracting the first time from the second time as a first difference;
and if the first difference is smaller than a preset first time threshold, determining whether the local time in the mobile terminal is accurate or not based on the first time, the size relationship among the second time and the server time and the first difference.
3. The method of claim 2, wherein the step of determining whether the local time in the mobile terminal is accurate based on the magnitude relationship between the first time, the second time and the server time and the first difference comprises:
if the server time is greater than the first time and less than the second time, and the first difference is less than a preset second time threshold, determining that the local time in the mobile terminal is accurate, otherwise determining that the local time in the mobile terminal is inaccurate.
4. The method according to any of claims 1-3, wherein said step of calibrating the local time in the mobile terminal based on the server time and the second time comprises:
calculating a result of subtracting the second time from the server time as a second difference value;
and acquiring local time in the mobile terminal according to a preset time interval, and calibrating the acquired local time through the second difference value.
5. The method of claim 4, wherein the calibrating the acquired local time by the second difference comprises:
calculating a result obtained by subtracting the corresponding expected time from the local time obtained this time as a third difference value;
and if the third difference is larger than a preset third time threshold, taking the sum of the local time acquired this time, the second difference and the third difference as the calibrated local time.
6. The method of claim 5, wherein the calibrating the acquired local time by the second difference comprises:
and if the third difference is smaller than or equal to the third time threshold, taking the sum of the local time acquired this time and the second difference as the calibrated local time.
7. The method according to claim 5 or 6, wherein the expected time is the sum of the last acquired local time and the time interval.
8. A time alignment apparatus adapted to reside in a mobile terminal, the mobile terminal being communicatively coupled to a server, the apparatus comprising:
the sending module is suitable for sending a time obtaining request to the server so as to indicate the server to feed back the current server time, and simultaneously recording the local time for sending the time obtaining request as first time;
the receiving module is suitable for receiving the server time fed back by the server and recording local time of receiving the server time as second time;
a determining module adapted to determine whether the local time in the mobile terminal is accurate according to the first time, the second time and the server time;
and the calibration module is suitable for calibrating the local time in the mobile terminal according to the server time and the second time when the local time in the mobile terminal is inaccurate.
9. A mobile terminal, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-7.
10. A readable storage medium storing program instructions that, when read and executed by a mobile terminal, cause the mobile terminal to perform the method of any of claims 1-7.
CN202211268137.6A 2022-10-17 2022-10-17 Time calibration method and device, mobile terminal and storage medium Pending CN115767706A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211268137.6A CN115767706A (en) 2022-10-17 2022-10-17 Time calibration method and device, mobile terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211268137.6A CN115767706A (en) 2022-10-17 2022-10-17 Time calibration method and device, mobile terminal and storage medium

Publications (1)

Publication Number Publication Date
CN115767706A true CN115767706A (en) 2023-03-07

Family

ID=85351648

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211268137.6A Pending CN115767706A (en) 2022-10-17 2022-10-17 Time calibration method and device, mobile terminal and storage medium

Country Status (1)

Country Link
CN (1) CN115767706A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116131988A (en) * 2023-04-14 2023-05-16 深圳酷源数联科技有限公司 Standard time generation device, method, device, readable storage medium and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116131988A (en) * 2023-04-14 2023-05-16 深圳酷源数联科技有限公司 Standard time generation device, method, device, readable storage medium and system

Similar Documents

Publication Publication Date Title
EP3346696A1 (en) Image capturing method and electronic device
US8655970B1 (en) Automatic entertainment caching for impending travel
EP3128411A1 (en) Interface display method and device
CN110765398A (en) Page content display method and mobile terminal
US10817355B2 (en) Method and apparatus for communication between webpage and operating system
US10863076B2 (en) Apparatus and method for controlling auto focus function in electronic device
CN107656866B (en) Method for testing application fluency, mobile terminal and computing device
CN115767706A (en) Time calibration method and device, mobile terminal and storage medium
CN108966316B (en) Method, device and equipment for displaying multimedia resources and predicting connection waiting duration
CN111679875A (en) Page content display method and system and mobile terminal
CN111273841B (en) Page processing method and mobile terminal
RU2630371C2 (en) Firmware update method and device
CN110515850B (en) Application program testing method, mobile terminal and storage medium
EP3068097B1 (en) Method and device for filtering information
US20140157147A1 (en) Feedback system, feedback method and recording media thereof
CN111385336A (en) Page communication method and device, computer equipment and storage medium
CN111813851B (en) Method, system and mobile terminal for synchronizing data from mobile application to webpage
CN109492163B (en) List display recording method and device, terminal equipment and storage medium
CN107704489B (en) Processing method and device for read-write timeout and computer readable storage medium
CN115269077A (en) Picture display method, module, mobile terminal and storage medium
CN112818265B (en) Interaction method and mobile terminal
CN113534957A (en) Single-hand control method and device and mobile terminal
CN113434076B (en) Single-hand control method and device and mobile terminal
CN111931093B (en) Page form display method and mobile terminal
CN113867845A (en) Application data loading method and device and mobile terminal

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