Time updating method, device, storage medium and electronic device

By receiving network equipment time information and updating the terminal's anchor time information, the problem of inaccurate time of smart terminals is solved, and the accuracy of time and the availability of related functions are improved.

CN115706610BActive Publication Date: 2025-05-13BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110902647.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-06
Publication Date
2025-05-13
Estimated Expiration
2041-08-06

AI Technical Summary

Technical Problem

The time information of the smart terminal is inaccurate, which causes the alarm clock or QR code payment service to be unable to be used normally.

Method used

By receiving the network device time information sent by the network device, the first time offset between the network device time information and the terminal's current time information is obtained. If the offset is within a preset range, the anchor time information of the terminal is updated.

Benefits of technology

Improve the accuracy of terminal time, ensure that the related functions that rely on terminal time can be used normally, and avoid the problem of terminal time errors caused by network equipment time errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115706610B_ABST
    Figure CN115706610B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a time updating method, device, storage medium and electronic device. The method includes: obtaining a first time offset between the network device time information and the current time information of the terminal by receiving network device time information sent by the network device, the current time information is based on the anchor time information of the terminal, and the anchor time information is time information obtained according to candidate time information of multiple time sources; when the first time offset is within a preset first offset range, updating the anchor time information of the terminal according to the network device time information. In this way, the reliability of the network device time information is verified by the anchor time information obtained by multiple time sources, and when it is determined that the received network device time information is reliable, the network device time information is used again, which can avoid the problem of terminal time error caused by network device time error and improve the accuracy of terminal time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of communications, and in particular, to a time updating method, device, storage medium and electronic device. Background Art

[0002] In recent years, with the development of communication technology, the continuous construction and improvement of mobile communication network environments such as 4G and 5G, smart terminals have been widely used in people's lives, and the time module of smart terminals has also played an important role in people's lives. For example, the smart terminal has a clock display function, which can provide users with alarm functions and time viewing functions based on the terminal time; for another example, in the QR code payment service of the smart terminal, time information can be used as an important judgment condition for the validity of the QR code. However, in the relevant technology, the terminal time may be inaccurate, resulting in the user's alarm clock or QR code payment service being unable to be used normally. Summary of the invention

[0003] In order to overcome the problems existing in the related art, the present disclosure provides a time updating method, device, storage medium and electronic device.

[0004] According to a first aspect of an embodiment of the present disclosure, a time updating method is provided, which is applied to a terminal, and the method includes:

[0005] Receiving network device time information sent by the network device;

[0006] Acquire a first time offset between the network device time information and the current time information of the terminal, wherein the current time information is the current time obtained based on the anchor time information of the terminal, and the anchor time information is the time information obtained based on the candidate time information of multiple time sources;

[0007] When the first time offset is within a preset first offset range, the anchor point time information of the terminal is updated according to the network device time information.

[0008] Optionally, the network device time information includes the network device time and the network device time zone, and the current time information includes the current time and the current time zone; and obtaining the first time offset between the network device time information and the current time information includes:

[0009] Determining whether the network device time zone is the same as the current time zone of the terminal;

[0010] In the case that the network device time zone is the same as the current time zone of the terminal, the difference between the network device time and the current time is used as the first time offset.

[0011] Optionally, the method further comprises:

[0012] When the network device time zone is different from the current time zone of the terminal, reacquire candidate time information of multiple time sources; obtain new anchor time information based on the candidate time information of multiple time sources; and update the current time information of the terminal based on the new anchor time information.

[0013] Optionally, the method further comprises:

[0014] When the first time offset exceeds the preset first offset range, the anchor point time information of the terminal is kept unchanged.

[0015] Optionally, the anchor point time information is obtained in the following manner:

[0016] Determine two candidate time sources from the multiple time sources, and obtain candidate time information corresponding to the candidate time sources;

[0017] Acquire a second time offset of two candidate time information;

[0018] When the second time offset is within a preset second offset range, the anchor point time information is acquired according to the two candidate time information.

[0019] Optionally, the candidate time information includes server time information and network device time information, the server time information includes a first server time corresponding to a preset time zone, and the network device time information includes a network device time and a network device time zone; and obtaining a second time offset of the two candidate time information includes:

[0020] Calculate the second server time corresponding to the network device time zone according to the first server time, the preset time zone and the network device time zone;

[0021] The difference between the network device time and the second server time is used as the second time offset.

[0022] Optionally, the anchor time information includes an anchor time and an anchor time zone; and acquiring the anchor time information according to the two candidate time information includes:

[0023] Using the second server time as the anchor time;

[0024] The network device time zone is used as the anchor point time zone.

[0025] According to a second aspect of an embodiment of the present disclosure, a time updating device is provided, which is applied to a terminal, and the device includes:

[0026] A time information receiving module is configured to receive network device time information sent by the network device;

[0027] a time offset acquisition module, configured to acquire a first time offset between the network device time information and the current time information of the terminal, wherein the current time information is the current time obtained based on the anchor time information of the terminal, and the anchor time information is the time information obtained based on the candidate time information of multiple time sources;

[0028] The time updating module is configured to update the anchor point time information of the terminal according to the network device time information when the first time offset is within a preset first offset range.

[0029] Optionally, the network device time information includes the network device time and the network device time zone, and the current time information includes the current time and the current time zone; and the time offset acquisition module is configured to:

[0030] Determining whether the network device time zone is the same as the current time zone of the terminal;

[0031] In the case that the network device time zone is the same as the current time zone of the terminal, the difference between the network device time and the current time is used as the first time offset.

[0032] Optionally, the time update module is also configured to, when the time zone of the network device is different from the current time zone of the terminal, re-acquire candidate time information of multiple time sources; obtain new anchor point time information based on the candidate time information of multiple time sources; and update the current time information of the terminal based on the new anchor point time information.

[0033] Optionally, the time updating module is further configured to keep the anchor point time information of the terminal unchanged when the first time offset exceeds the preset first offset range.

[0034] Optionally, the device further comprises:

[0035] The anchor point time information acquisition module is configured to determine two candidate time sources from the multiple time sources and obtain candidate time information corresponding to the candidate time sources; obtain the second time offset of the two candidate time information; and when the second time offset is within a preset second offset range, obtain the anchor point time information based on the two candidate time information.

[0036] Optionally, the candidate time information includes server time information and network device time information, the server time information includes a first server time corresponding to a preset time zone, and the network device time information includes a network device time and a network device time zone; the anchor point time information acquisition module is configured to calculate a second server time corresponding to the network device time zone based on the first server time, the preset time zone and the network device time zone; and use the difference between the network device time and the second server time as the second time offset.

[0037] Optionally, the anchor time information includes an anchor time and an anchor time zone; the anchor time information acquisition module is configured to use the second server time as the anchor time; and use the network device time zone as the anchor time zone.

[0038] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0039] processor;

[0040] a memory for storing processor-executable instructions;

[0041] The processor is configured to execute the steps of the time updating method provided in the first aspect of the present disclosure.

[0042] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the steps of the time update method provided in the first aspect of the present disclosure are implemented.

[0043] The technical solution provided by the embodiment of the present disclosure may include the following beneficial effects: by receiving the network device time information sent by the network device, obtaining the first time offset between the network device time information and the current time information of the terminal, the current time information is based on the anchor time information of the terminal, and the anchor time information is the time information obtained according to the candidate time information of multiple time sources; when the first time offset is within the preset first offset range, updating the anchor time information of the terminal according to the network device time information. In this way, the reliability of the network device time information is verified by the anchor time information obtained by multiple time sources, and when it is determined that the received network device time information is reliable, the network device time information is used again, which can avoid the terminal time error problem caused by the network device time error, improve the accuracy of the terminal time, and ensure that the related functions that rely on the terminal time can be used normally.

[0044] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0046] Figure 1 The figure is a flow chart showing a time updating method according to an exemplary embodiment.

[0047] Figure 2 The invention is a block diagram showing a time updating device according to an exemplary embodiment.

[0048] Figure 3 is a block diagram of another time updating device according to an exemplary embodiment.

[0049] Figure 4 is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0050] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0051] First, the application scenario of the present disclosure is described. The present disclosure can be applied to the time update scenario of the terminal. The time module of the terminal is a very important function. In practical applications, if the time information of the terminal is inaccurate, the user's alarm clock or QR code payment service will not be able to be used normally. Among them, the QR code payment service of the smart terminal is widely used in urban public transportation such as subways, buses, ferries and daily consumption in urban life. QR code payment is a new type of mobile payment technology that generates consumption QR codes through smart terminals, scans and identifies the codes through fixed or mobile smart terminals, and performs QR code consumption. In order to improve security, some application servers that scan QR codes will verify the time when the terminal generates the QR code. For example, some applications require that the QR code is valid within one minute after generation. The validity of the QR code is judged by comparing the generation time of the QR code with the current time of the application server, which also puts higher requirements on the accuracy of the terminal time. If the time information of the terminal is inaccurate, the QR code verification will fail, resulting in the user's QR code payment service being unable to be used normally.

[0052] It should be noted that the terminal in the present disclosure may be an electronic device such as a smart phone, a tablet computer, a smart watch, a smart bracelet, a PDA (Personal Digital Assistant), a CPE (Customer Premise Equipment), etc., and the present disclosure does not limit this.

[0053] The sources of terminal time information can include the following:

[0054] 1. Network device time information from network devices, also known as NITZ (Network Identity and Time Zone), is a mechanism that provides local date and time, time zone, daylight saving time, and network provider identity information to terminals through wireless networks, which is usually used for mobile terminals to automatically update system time. For example, the network device time information may be time information sent to the terminal by a base station or core network, and the network device time information may have information such as time zone and daylight saving time, but the time accuracy is low, for example, generally minute-level accuracy.

[0055] Second, the server time information from the time server can also be called NTP (Network Time Protocol) time. NTP is a protocol used to synchronize computer time. First, the time source of NTP is the international standard time UTC. The time server can obtain the international standard time through atomic clocks, observatories or satellites. The time server can send the server time information to the terminal. The time accuracy of the server time information is high, for example, it can reach millisecond-level accuracy, but the server time information does not contain information such as time zone and daylight saving time.

[0056] 3. Real-time clock time information from the terminal's real-time clock (RTC). The terminal's real-time clock requires hardware support, relies on the terminal's high-precision crystal oscillator, and requires the user to manually set the initial time when the terminal is first run.

[0057] In the related art, the terminal uses the above network device time information as the highest priority time source. When receiving the network device time information, the terminal can directly use the network device time information as the current time information of the terminal. However, due to the development of communication technology, such as the gradual promotion and testing of 5G and 6G, network equipment is updated or adjusted more frequently, and network device time errors may occur due to network equipment adjustments or human misoperation. At this time, if the terminal still uses the wrong network device time information as the current time information of the terminal, it will cause terminal time errors, which will also affect the normal use of users.

[0058] In order to solve the above problems, the present disclosure provides a time update method, device, storage medium and electronic device, which generate anchor time information through candidate time information of multiple time sources, and continuously update the current time information of the terminal according to the anchor time information. When receiving the network time information sent by the network device, it can determine whether the network device time information is reliable according to the first time offset between the network device time information and the current time information of the terminal. When the network device time information is reliable (that is, the first time offset is within the preset first offset range), the anchor time information of the terminal is updated according to the network device time information. In this way, the problem of terminal time error caused by network device time error can be avoided, thereby improving the accuracy of terminal time.

[0059] The present disclosure is described below in conjunction with specific embodiments.

[0060] Figure 1 is a time updating method provided by an embodiment of the present disclosure, such as Figure 1 As shown, the execution subject of the method may be a terminal, and the method may include:

[0061] S101. Receive network device time information sent by a network device.

[0062] By way of example, the network device may be a base station or a core network in a wireless communication network; the network device time information may be time information obtained by the network device through satellite systems such as GPS and Beidou; it may also be time information obtained by the network device through a time server (such as an NTP server); of course, it may also be time information obtained based on the network device's own crystal oscillator and configuration.

[0063] It should be noted that the network device can send the network device time information to the terminal when the terminal initiates network registration at the network device. In this way, the terminal can initiate network registration periodically or when it moves to the boundary between two network devices, thereby triggering the network device to send the network device time information.

[0064] Furthermore, in order to obtain network device time information more quickly, the terminal can also actively send a time request message or a registration request message to the network device in addition to normal network registration, when determining that the network device time needs to be obtained, so that the network device sends the network device time information to the terminal according to the time request message or the registration request message. For example, the terminal can periodically send a time request message to the network device, thereby triggering the network device to periodically send the network device time information to the terminal. The period for sending the time request message can be any time period pre-set between 1 minute and 10080 minutes, for example, 60 minutes or 1440 minutes. In this way, the terminal can obtain the network device time information in a timely manner, so as to update the anchor time information of the terminal according to the network device time.

[0065] S102: Obtain a first time offset between the network device time information and the current time information of the terminal.

[0066] The current time information is the current time obtained based on the anchor time information of the terminal, and the anchor time information is the time information obtained based on candidate time information of multiple time sources.

[0067] It should be noted that the anchor time information can be obtained by mutual calibration of the candidate time information of the above-mentioned multiple time sources of the terminal. The accuracy of the anchor time information can be improved by mutual calibration of the candidate time information of multiple time sources. The mutual calibration method can be to calibrate according to the time difference of multiple time sources. For example, when the absolute value of the time difference between multiple candidate time information is less than or equal to the preset time difference, it can be considered that the multiple candidate time information meet the time accuracy. At this time, the candidate time information of the time source with the highest priority can be selected as the anchor time information; or, according to the preset first time weighting coefficient of each time source, the candidate time information corresponding to multiple time sources can be calculated by weighted averaging to obtain the anchor time information.

[0068] Further, in the case of acquiring the anchor point time information, the anchor point time information can be used as the current time information of the terminal, and the current time information of the terminal can be updated according to the anchor point time information and the crystal oscillator time of the terminal. For example, at the moment of acquiring the anchor point time information, a time timer can be started according to the crystal oscillator time of the terminal, and the first duration from acquiring the anchor point time information to the current time can be obtained through the time timer, and the current time information of the terminal can be acquired according to the anchor point time information and the first duration.

[0069] In this step, the difference between the network device time information and the current time information of the terminal can be used as the first time offset; or the absolute value of the difference between the network device time information and the current time information of the terminal can be used as the first time offset.

[0070] S103: When the first time offset is within a preset first offset range, update the anchor point time information of the terminal according to the network device time information.

[0071] In the case where the difference between the network device time information and the current time information of the terminal is used as the first time offset, the preset first offset range may be a range between a preset first minimum value and a preset first maximum value, the preset first minimum value may be a negative value, and the preset first maximum value may be a positive value. For example, the preset first offset range may be a range greater than or equal to -60 seconds and less than or equal to +60 seconds.

[0072] When the absolute value of the difference between the network device time information and the current time information of the terminal is used as the first time offset, the preset first offset range may be a range from 0 to a preset first maximum value. For example, the preset first offset range is a range greater than or equal to 0 and less than or equal to 60 seconds.

[0073] It should be noted that if the first time deviation is within the preset first offset range, it can be determined that the above network device time information is reliable time information. Therefore, the anchor point time information of the terminal can be updated according to the network device time information in any of the following ways:

[0074] Method 1: The network device time information can be used as the updated anchor point time information.

[0075] Method 2: The updated anchor point time information can be calculated based on the network device time information and the current time information of the terminal by weighted averaging.

[0076] For example, the updated anchor point time information can be calculated by the following formula:

[0077] Tm=T1*W1+T2*W2,

[0078] Among them, Tm represents the updated anchor point time information, T1 represents the network device time information, W1 represents the first preset weight corresponding to the network device time information, T2 represents the current time information of the terminal, and W2 represents the second preset weight corresponding to the current time information.

[0079] The above method is adopted to obtain the first time offset between the network device time information and the current time information of the terminal by receiving the network device time information sent by the network device, the current time information is based on the anchor time information of the terminal, and the anchor time information is the time information obtained according to the candidate time information of multiple time sources; when the first time offset is within the preset first offset range, the anchor time information of the terminal is updated according to the network device time information. In this way, the reliability of the network device time information is verified by the anchor time information obtained by multiple time sources, and when it is determined that the received network device time information is reliable, the network device time information is used again, which can avoid the terminal time error problem caused by the network device time error, improve the accuracy of the terminal time, and ensure that the related functions that rely on the terminal time can be used normally.

[0080] Further, in a case where the first time offset exceeds the preset first offset range, the anchor point time information of the terminal may be kept unchanged.

[0081] It should be noted that if the first time deviation exceeds the preset first offset range, it can be determined that the above network device time information is unreliable. At this time, the network device time information can be ignored and the anchor time information of the terminal can be kept unchanged. And the current time information of the terminal can continue to be obtained based on the anchor time information and the crystal oscillator time of the terminal. Since the crystal oscillator of the terminal can maintain a certain accuracy rate for a long time, for example, the time deviation rate of the active crystal oscillator used by the terminal can be less than or equal to 10ppm, that is, the time deviation of the crystal oscillator running 24 hours a day is less than or equal to 0.864 seconds. Therefore, when it is judged that the above network device time is unreliable, the anchor time information and the crystal oscillator time of the terminal can be used to obtain more accurate current time information.

[0082] In this way, the problem of terminal time error caused by the terminal using unreliable network device time information can be avoided, thereby ensuring that related functions that rely on terminal time can be used normally.

[0083] In another embodiment of the present disclosure, the network device time information includes the network device time and the network device time zone, and the current time information includes the current time and the current time zone; the step S102 of acquiring the first time offset between the network device time information and the current time information may include the following steps:

[0084] First, determine whether the time zone of the network device is the same as the current time zone of the terminal.

[0085] It should be noted that the network device time zone may be the time zone corresponding to the region where the network device is located, such as the time zone obtained by the network device through a time server in the region; or, the network device time zone may be the time zone corresponding to the time zone parameters configured on the network device, and the time zone parameters may be parameters manually configured by the user.

[0086] The current time zone of the terminal may be a time zone acquired according to the anchor point time information.

[0087] Then, when the network device time zone is the same as the current time zone of the terminal, the difference between the network device time and the current time is used as the first time offset; or, the absolute value of the difference between the network device time and the current time is used as the first time offset.

[0088] In this way, by comparing the network device time zone with the current time zone of the terminal, that is, the time zone of the terminal has not changed, the first time offset between the network device time and the current time can be obtained, and based on the first time offset, it can be determined whether the anchor point time information of the terminal can be updated according to the network device time information.

[0089] Furthermore, when the network device time zone is different from the current time zone of the terminal, candidate time information of multiple time sources is reacquired; new anchor time information is obtained based on the candidate time information of multiple time sources; and the current time information of the terminal is updated based on the new anchor time information.

[0090] It should be noted that the time zone of the network device is different from the current time zone of the terminal, which means that the terminal has moved across time zones. At this time, the original anchor point time information is no longer reliable and new anchor point time information needs to be re-acquired to avoid the problem of terminal time errors caused by continuing to use the original anchor point time information.

[0091] In another embodiment of the present disclosure, the anchor point time information may be obtained in the following manner:

[0092] First, two candidate time sources are determined from multiple time sources, and candidate time information corresponding to the candidate time sources is obtained.

[0093] In this step, two candidate time sources can be randomly determined from multiple time sources; or the two time sources that first receive time information can be determined as candidate time sources based on the order in which the time information of the time sources is received; or two candidate time sources can be determined from multiple time sources based on a pre-set time source priority and the current status of the time source, and the current status of the time source can indicate whether the terminal has received the time information sent by the time source.

[0094] For example: if the above-mentioned multiple time sources include: a network device time source, a time server time source, and a terminal real-time clock time source, the time source priorities corresponding to the multiple time sources can be pre-set as: network device time source priority>time server time source>terminal real-time clock time source. In this way, when the current status of the above-mentioned multiple time sources is the time information received from the time source, according to the above-mentioned time source priority, the network device time source and the time server time source can be used as candidate time sources, and the network device time information received from the network device and the server time information received from the time server can be used as candidate time information.

[0095] Furthermore, if the current status of the time server time source is that the time information of the time source has not been received, and the current status of the network device time source and the terminal real-time clock time source are both that the time information of the time source has been received, then the network device time source and the terminal real-time clock time source can be used as candidate time sources, and the network device time information received from the network device and the real-time clock time information obtained from the terminal real-time clock can be used as candidate time information.

[0096] Secondly, obtain the second time offsets of the two candidate time information.

[0097] Finally, when the second time offset is within the preset second offset range, the anchor point time information is acquired according to the two candidate time information.

[0098] Similarly, in this embodiment, the difference between the two candidate time information can be used as the second time offset; the preset second offset range is preset to a range between a preset second minimum value and a preset second maximum value, the preset second minimum value can be a negative value, and the preset second maximum value can be a positive value. For example, the preset first offset range can be a range greater than or equal to -120 seconds and less than or equal to +120 seconds.

[0099] In addition, the absolute value of the difference between the two candidate time information may be used as the second time offset; the preset first offset range is preset to a range from 0 to a preset second maximum value. For example, the preset first offset range is a range greater than or equal to 0 and less than or equal to 120 seconds.

[0100] In this way, by mutually verifying the candidate time information obtained from multiple time sources, accurate anchor point time information can be obtained, and further accurate terminal current time information can be obtained based on the anchor point time information, which can avoid errors in terminal time and improve the accuracy of terminal time.

[0101] In another embodiment of the present disclosure, the candidate time information may include server time information and network device time information, the server time information includes a first server time corresponding to a preset time zone, and the network device time information includes a network device time and a network device time zone; thus, the second time offset of the two candidate time information may be obtained in the following manner:

[0102] According to the first server time, the preset time zone and the network device time zone, the second server time corresponding to the network device time zone is calculated; the difference between the network device time and the second server time is used as the second time offset, or the absolute value of the difference between the network device time and the second server time is used as the second time offset.

[0103] For example, the above-mentioned preset time zone can be the zero time zone, that is, the Greenwich time zone of the United Kingdom, and the network device time zone can be set according to the region where the network device is located. For example, the network device time zone of a network device located in China can be East 8 Zone. In this way, the first server time can be increased by 8 hours to obtain the second server time.

[0104] In this way, the first server time corresponding to the preset time zone can be converted into the second server time corresponding to the network device time zone, so that the accurate time offset between the server time and the network device time can be obtained.

[0105] Furthermore, the above-mentioned anchor point time information includes anchor point time and anchor point time zone. Thus, when the second time offset is within a preset second offset range, the step of obtaining the anchor point time information based on the two candidate time information may include: using the second server time as the anchor point time; and using the network device time zone as the anchor point time zone.

[0106] It should be noted that the server time has a high accuracy, which can reach millisecond level, but the server time information does not contain time zone information. Therefore, through this method, the server time and the network device time zone are combined to obtain accurate anchor point time information, thereby improving the accuracy of terminal time.

[0107] It should also be noted that some regions also use the daylight saving time function, and the above-mentioned network device time information, the current time information of the terminal, and the anchor time information can all include the daylight saving time information. The daylight saving time information in the network device time information can be determined based on the daylight saving time information of the region where the network device is located, or can be determined based on the daylight saving time configuration parameters of the network device. The terminal can use the daylight saving time information in the received network device information as the daylight saving time information in the current time information and the anchor time information.

[0108] In this way, the accuracy of terminal time can be ensured even when daylight saving time is in effect.

[0109] Figure 2 is a block diagram of a time updating device 200 according to an exemplary embodiment. The device 200 can be applied to a terminal, such as Figure 2 As shown, the device 200 may include:

[0110] The time information receiving module 201 is configured to receive network device time information sent by the network device;

[0111] The time offset acquisition module 202 is configured to acquire a first time offset between the network device time information and the current time information of the terminal, where the current time information is the current time obtained based on the anchor time information of the terminal, where the anchor time information is the time information obtained based on the candidate time information of multiple time sources;

[0112] The time updating module 203 is configured to update the anchor time information of the terminal according to the network device time information when the first time offset is within a preset first offset range.

[0113] Optionally, the network device time information includes the network device time and the network device time zone, and the current time information includes the current time and the current time zone; the time offset acquisition module 202 is configured to:

[0114] Determining whether the time zone of the network device is the same as the current time zone of the terminal;

[0115] When the network device time zone is the same as the current time zone of the terminal, the difference between the network device time and the current time is used as the first time offset.

[0116] Optionally, the time update module 203 is also configured to, when the time zone of the network device is different from the current time zone of the terminal, re-acquire candidate time information of multiple time sources; obtain new anchor point time information based on the candidate time information of multiple time sources; and update the current time information of the terminal based on the new anchor point time information.

[0117] Optionally, the time updating module 203 is further configured to keep the anchor time information of the terminal unchanged when the first time offset exceeds the preset first offset range.

[0118] Figure 3 is a block diagram of another time updating device according to an exemplary embodiment. Figure 3 As shown, the device may also include:

[0119] The anchor point time information acquisition module 301 is configured to determine two candidate time sources from the multiple time sources and obtain candidate time information corresponding to the candidate time sources; obtain the second time offset of the two candidate time information; and when the second time offset is within a preset second offset range, obtain the anchor point time information based on the two candidate time information.

[0120] Optionally, the candidate time information includes server time information and network device time information, the server time information includes a first server time corresponding to a preset time zone, and the network device time information includes a network device time and a network device time zone; the anchor point time information acquisition module 301 is configured to calculate a second server time corresponding to the network device time zone based on the first server time, the preset time zone and the network device time zone; and use the difference between the network device time and the second server time as the second time offset.

[0121] Optionally, the anchor time information includes an anchor time and an anchor time zone; the anchor time information acquisition module 301 is configured to use the second server time as the anchor time; and use the network device time zone as the anchor time zone.

[0122] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0123] In summary, the present disclosure receives network device time information sent by a network device, obtains the first time offset between the network device time information and the current time information of the terminal, the current time information is based on the anchor time information of the terminal, and the anchor time information is time information obtained based on candidate time information of multiple time sources; when the first time offset is within the preset first offset range, the anchor time information of the terminal is updated according to the network device time information. In this way, the reliability of the network device time information is verified through the anchor time information obtained from multiple time sources, and when it is determined that the received network device time information is reliable, the network device time information is used again, which can avoid the problem of terminal time error caused by network device time error, improve the accuracy of terminal time, and ensure that related functions that rely on terminal time can be used normally.

[0124] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, and when the program instructions are executed by a processor, the steps of any one of the above-mentioned time updating methods provided by the present disclosure are implemented.

[0125] Figure 44 is a block diagram of an electronic device 400 according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, a router, etc.

[0126] Reference Figure 4 , the electronic device 400 may include one or more of the following components: a processing component 402 , a memory 404 , a power component 406 , a multimedia component 408 , an audio component 410 , an input / output (I / O) interface 412 , a sensor component 414 , and a communication component 416 .

[0127] The processing component 402 generally controls the overall operation of the electronic device 400, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to complete all or part of the steps of the above-mentioned time update method. In addition, the processing component 402 may include one or more modules to facilitate the interaction between the processing component 402 and other components. For example, the processing component 402 may include a multimedia module to facilitate the interaction between the multimedia component 408 and the processing component 402.

[0128] The memory 404 is configured to store various types of data to support operations on the electronic device 400. Examples of such data include instructions for any application or method operating on the electronic device 400, contact data, phone book data, messages, pictures, videos, etc. The memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0129] The power component 406 provides power to the various components of the electronic device 400. The power component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 400.

[0130] The multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front camera and / or a rear camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0131] The audio component 410 is configured to output and / or input audio signals. For example, the audio component 410 includes a microphone (MIC), and when the electronic device 400 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 404 or sent via the communication component 416. In some embodiments, the audio component 410 also includes a speaker for outputting audio signals.

[0132] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0133] The sensor assembly 414 includes one or more sensors for providing various aspects of status assessment for the electronic device 400. For example, the sensor assembly 414 can detect the open / closed state of the electronic device 400, the relative positioning of the components, such as the display and keypad of the electronic device 400, and the sensor assembly 414 can also detect the position change of the electronic device 400 or a component of the electronic device 400, the presence or absence of contact between the user and the electronic device 400, the orientation or acceleration / deceleration of the electronic device 400, and the temperature change of the electronic device 400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 414 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0134] The communication component 416 is configured to facilitate wired or wireless communication between the electronic device 400 and other devices. The electronic device 400 can access a wireless network based on a communication standard, such as Wi-Fi, 2G, 3G, 4G, 5G, NB-IOT, eMTC, or other 6G, etc., or a combination thereof. In an exemplary embodiment, the communication component 416 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0135] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above-mentioned time update method.

[0136] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, and the instructions can be executed by a processor 420 of an electronic device 400 to complete the above-mentioned time update method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0137] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program executable by a programmable device, and the computer program has a code portion for executing the above time updating method when executed by the programmable device.

[0138] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the present disclosure. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0139] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A time updating method, characterized in that: Applied to a terminal, the method comprises: Receiving network device time information sent by the network device; Acquire a first time offset between the network device time information and the current time information of the terminal, wherein the current time information is the current time obtained based on the anchor time information of the terminal, and the anchor time information is the time information obtained after mutual calibration based on candidate time information of multiple time sources; When the first time offset is within a preset first offset range, updating the anchor point time information of the terminal according to the network device time information; The anchor point time information is obtained in the following way: Determine two candidate time sources from the multiple time sources, and obtain candidate time information corresponding to the candidate time sources; Acquire a second time offset of two candidate time information; When the second time offset is within a preset second offset range, the anchor point time information is acquired according to the two candidate time information.

2. The method according to claim 1, characterized in that The network device time information includes the network device time and the network device time zone, and the current time information includes the current time and the current time zone; and obtaining the first time offset between the network device time information and the current time information includes: Determining whether the network device time zone is the same as the current time zone of the terminal; In the case that the network device time zone is the same as the current time zone of the terminal, the difference between the network device time and the current time is used as the first time offset.

3. The method according to claim 2, characterized in that The method further comprises: When the network device time zone is different from the current time zone of the terminal, reacquire candidate time information of multiple time sources; obtain new anchor time information based on the candidate time information of multiple time sources; and update the current time information of the terminal based on the new anchor time information.

4. The method according to claim 1, characterized in that: The method further comprises: When the first time offset exceeds the preset first offset range, the anchor point time information of the terminal is kept unchanged.

5. The method according to claim 1, characterized in that The candidate time information includes server time information and network device time information, the server time information includes a first server time corresponding to a preset time zone, and the network device time information includes a network device time and a network device time zone; The obtaining of the second time offset of the two candidate time information comprises: Calculate the second server time corresponding to the network device time zone according to the first server time, the preset time zone and the network device time zone; The difference between the network device time and the second server time is used as the second time offset.

6. The method according to claim 5, characterized in that The anchor point time information includes the anchor point time and the anchor point time zone; and obtaining the anchor point time information according to the two candidate time information includes: Using the second server time as the anchor time; The network device time zone is used as the anchor point time zone.

7. A time updating device, characterized in that: Applied to a terminal, the device comprises: A time information receiving module is configured to receive network device time information sent by the network device; a time offset acquisition module, configured to acquire a first time offset between the network device time information and the current time information of the terminal, wherein the current time information is the current time obtained based on the anchor time information of the terminal, and the anchor time information is the time information obtained after mutual calibration based on the candidate time information of multiple time sources; a time updating module, configured to update the anchor time information of the terminal according to the network device time information when the first time offset is within a preset first offset range; The anchor point time information is obtained in the following way: Determine two candidate time sources from the multiple time sources, and obtain candidate time information corresponding to the candidate time sources; Acquire a second time offset of two candidate time information; When the second time offset is within a preset second offset range, the anchor point time information is acquired according to the two candidate time information.

8. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Time updating method, device and terminal equipment

    CN106027191A