CN112788100A - Time synchronization method and device, storage medium and electronic device - Google Patents

Time synchronization method and device, storage medium and electronic device Download PDF

Info

Publication number
CN112788100A
CN112788100A CN202011419109.0A CN202011419109A CN112788100A CN 112788100 A CN112788100 A CN 112788100A CN 202011419109 A CN202011419109 A CN 202011419109A CN 112788100 A CN112788100 A CN 112788100A
Authority
CN
China
Prior art keywords
time
network
target
internet
module
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
CN202011419109.0A
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.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home 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 Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202011419109.0A priority Critical patent/CN112788100A/en
Publication of CN112788100A publication Critical patent/CN112788100A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching
    • H04L67/5682Policies or rules for updating, deleting or replacing the stored data

Abstract

The invention provides a time synchronization method and device, a storage medium and an electronic device, wherein the method comprises the steps of acquiring target time under the condition that an Internet of things module is connected with a network; synchronizing local time in the internet of things module into standard time according to the target time, wherein the local time comprises: time acquired by a crystal oscillator module in the Internet of things module; and transmitting the standard time to the target equipment so as to synchronize the time in the target equipment into the standard time. According to the invention, the problem that the home equipment cannot acquire accurate network time due to no network or poor network quality during the operation of the Internet of things module is solved, and the effect of ensuring that the home equipment can acquire accurate network time is achieved.

Description

Time synchronization method and device, storage medium and electronic device
Technical Field
The invention relates to the field of network time service, in particular to a time synchronization method and device, a storage medium and an electronic device.
Background
Shared network time resources in the internet of things are continuously and deeply applied to each intelligent household device. Shared network time, that is, real time taken from the network, typically requires that the time taken be accurate to at least a millisecond of error. The Internet of things module can perform independent time maintenance after acquiring time, sends the time to the intelligent home equipment, and finally displays the time through a display screen on the intelligent home equipment.
However, the network time cannot be continuously obtained, and the network time cannot be maintained by a crystal oscillator in the module of the internet of things. The network time cannot be accurately acquired and corrected when necessary at any time, and the network time cannot be acquired for a long time. Although the crystal oscillator is maintained locally, the time of sending is greatly deviated. If the network time cannot be acquired for a long time, and the crystal oscillator cannot always ensure high accuracy and issue the network time after the network time is acquired immediately, the issue time and the time of the device are prone to overlarge time deviation, and user experience is poor.
Aiming at the problem that in the related art, due to the fact that no network exists or network quality is poor in the operation period of an internet of things module, accurate network time cannot be acquired by home equipment, an effective solution does not exist at present.
Disclosure of Invention
The embodiment of the invention provides a time synchronization method and a time synchronization device, which are used for at least solving the problem that in the related art, when no network exists or the network quality is poor during the operation of an Internet of things module, home equipment cannot acquire accurate network time.
According to an embodiment of the present invention, there is provided a time synchronization method including: under the condition that the Internet of things module is connected with a network, acquiring target time; synchronizing local time in the internet of things module into standard time according to the target time, wherein the local time comprises: time obtained by a crystal oscillator module in the Internet of things module; and issuing the standard time to target equipment so as to synchronize the time in the target equipment into the standard time.
Optionally, when the internet of things module is connected to a network, the obtaining the target time includes: the target time includes: cloud time, network time; under the condition that the Internet of things module is connected with a network and is connected with a cloud, acquiring the cloud time; or, the network time is acquired under the condition that the internet of things module is connected with the network.
Optionally, when the internet of things module is connected to a network, the obtaining the target time includes: the method comprises the steps that when the Internet of things module is connected with a network and is connected with a cloud end, and the cloud end time is not obtained, the network time is obtained from a gateway; and under the condition that the internet of things module is connected with the network and the network time is not acquired, acquiring the network time from a gateway.
Optionally, when the internet of things module is connected to a network, the obtaining the target time includes: under the condition that the IOT module is connected with a network, acquiring first target time, wherein the first target time is the time acquired by the IOT module for the first time when the IOT module is connected with the network; acquiring second target time according to a preset time interval, wherein the second target time is the time in the next interval period acquired after the internet of things module access network is firstly acquired; synchronizing the first target time to the second target time.
Optionally, when the internet of things module is connected to a network, the obtaining the target time includes: the Internet of things module initiates a synchronization request of the target time; taking the cloud time as the target time under the condition that the Internet of things module firstly acquires the cloud time through a connection network; and under the condition that the internet of things module firstly acquires the network time through a connection network, taking the network time as the target time.
Optionally, the issuing the standard time to the target device, so that the synchronizing in the target device as the standard time includes: issuing the standard time to a control panel of target equipment; stopping issuing the standard time to the control board of the target device under the condition of receiving an invalid frame or not receiving a response frame in the control board; and under the condition of receiving the confirmation frame in the control panel, transmitting the standard time to the control panel of the target equipment according to a preset synchronous time interval.
Optionally, the issuing the standard time to the target device, so that the synchronizing in the target device as the standard time includes: determining the time difference between the target time and the local time according to the target time; setting the target time to the standard time if the time difference is greater than or equal to a first threshold value; under the condition that the time difference is smaller than or equal to the first threshold value, the target time is adjusted according to a first adjustment strategy and then is synchronized to be the standard time; and under the condition that the absolute value of the time difference is smaller than the first threshold value, synchronizing the target time to the standard time after adjusting the target time according to a second adjustment strategy, wherein the adjustment speed of the second adjustment strategy is greater than that of the first adjustment strategy.
According to another embodiment of the present invention, there is provided a time synchronization apparatus including: the acquisition module is used for acquiring the target time under the condition that the Internet of things module is connected with the network; a synchronization module, configured to synchronize a local time in the internet of things module to a standard time according to the target time, where the local time includes: time obtained by a crystal oscillator module in the Internet of things module; and the issuing module is used for issuing the standard time to the target equipment so as to synchronize the time in the target equipment into the standard time.
According to a further embodiment of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the invention, under the condition that the IOT module is connected with the network, the target time is obtained, and the local time in the IOT module is synchronized into the standard time according to the target time, wherein the target time is the cloud time obtained from the cloud or the network time obtained from the network. Therefore, the problem that the home equipment cannot acquire accurate network time due to the fact that no network exists or network quality is poor in the operation period of the internet of things module can be solved, and the effect that the home equipment can acquire the accurate network time can be achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware structure of a home appliance terminal according to a time synchronization method in an embodiment of the present invention;
FIG. 2 is a flow chart of a method of time synchronization according to an embodiment of the present invention;
fig. 3 is a block diagram of a structure of a time synchronization apparatus according to an embodiment of the present invention;
FIG. 4 is a flow chart of time acquisition in a method of time synchronization according to an alternative embodiment of the present invention
FIG. 5 is a flow chart of time maintenance in a method of time synchronization according to an alternative embodiment of the present invention;
fig. 6 is a flowchart of time delivery in a time synchronization method according to an alternative embodiment of the present invention;
fig. 7 is a schematic diagram of a usage scenario of a time synchronization method according to an alternative embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Example 1
The method provided by the first embodiment of the present application may be executed in a home terminal or a similar home device. Taking the operation on the home appliance terminal as an example, fig. 1 is a hardware structure block diagram of the home appliance terminal of a time synchronization method according to an embodiment of the present invention. As shown in fig. 1, the home terminal may include one or more processors 102 (only one is shown in fig. 1) (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally, a transmission device 106 for communication function and an input/output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the home appliance terminal. For example, the home terminal 10 may include more or fewer components than those shown in fig. 1, or may have a different configuration than that shown in fig. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as computer programs corresponding to the time synchronization method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located from the processor 102, and the remote memory may be connected to the home terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the home appliance terminal 10. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The household appliance terminal is used for intelligent household equipment.
In this embodiment, a time synchronization method operating in the home appliance terminal is provided, and fig. 2 is a flowchart of the time synchronization method according to the embodiment of the present invention, as shown in fig. 1, the flow includes the following steps:
step S202, under the condition that the Internet of things module is connected with a network, target time is obtained;
step S204, synchronizing local time in the Internet of things module to standard time according to the target time, wherein the local time comprises: time obtained by a crystal oscillator module in the Internet of things module;
step S206, the standard time is sent to the target device, so that the time in the target device is synchronized to be the standard time.
Through the steps, under the condition that the Internet of things module is connected with the network, the target time is obtained, and the local time in the Internet of things module is synchronized into the standard time according to the target time, wherein the target time is the cloud time obtained from the cloud end or the network time obtained from the network. Therefore, the problem that the home equipment cannot acquire accurate network time due to the fact that no network exists or network quality is poor in the operation period of the internet of things module can be solved, and the effect that the home equipment can acquire the accurate network time can be achieved.
In the step S202, when the internet of things module is connected to the network, the target time may be obtained. The target time may be a network time based on a network grant, or may be a cloud time obtained from a cloud.
It should be noted that, generally, after the internet of things module is connected to the network, a request for obtaining the target time is sent out at the same time, and if the cloud time is received first, the cloud time is taken as the target time, and if the network time is received first, the network time is taken as the target time.
In the step S204, the local time in the internet of things module is synchronized to the standard time according to the obtained target time.
It should be noted that the local time refers to the time acquired by the crystal oscillator module in the internet of things module, and the crystal oscillator module acquires the time regardless of whether the internet of things module is connected to a network.
In step S206, the updated and adjusted standard time is sent to the target device, so that the time in the target device is synchronized to the standard time.
Because the time in the internet of things module must be acquired and corrected at intervals during network time service, the situation that a home with no network or poor network quality cannot be acquired can be avoided through the time maintenance strategy in the internet of things module, and long-time errors caused by the fact that only module crystal oscillators are used for maintenance can also be avoided.
If the network time can not be acquired by the Internet of things module, the time can be acquired from the cloud end, and the time of the cloud end can be used as accurate time for maintenance, so that overlarge errors caused by long-time maintenance only by the crystal oscillator module can be prevented.
In an optional embodiment of the present invention, in a case that the module of the internet of things is connected to a network, the obtaining of the target time includes: the target time includes: cloud time, network time; under the condition that the Internet of things module is connected with a network and is connected with a cloud, acquiring the cloud time; or, the network time is acquired under the condition that the internet of things module is connected with the network.
In specific implementation, if the internet of things module is connected with a network and is connected with a cloud, the cloud time is acquired, or the network time is acquired under the condition that the internet of things module is connected with the network. The obtained cloud time or network time can be used as the target time.
After the internet of things module cannot acquire the network time, if the cloud time can be acquired from the cloud, the network time can be updated according to the cloud time. If the network time is directly available, the network time is acquired and updated within the interval period.
In an optional embodiment of the present invention, in a case that the module of the internet of things is connected to a network, the obtaining of the target time includes: the method comprises the steps that when the Internet of things module is connected with a network and is connected with a cloud end, and the cloud end time is not obtained, the cloud end time is obtained from a gateway; and under the condition that the internet of things module is connected with the network and the network time is not acquired, acquiring the network time from a gateway.
In specific implementation, if the internet of things module is connected with a network and is connected to a cloud, but the cloud time is not acquired, the network time is acquired from a currently connected gateway.
And if the network time is not acquired when the IOT module is connected with the network, acquiring the network time from the currently accessed gateway.
It should be noted that the internet of things module may access the network through the gateway, or may not access the network through the gateway. In some cases, if the cloud time is not obtained, the network time may be obtained from the accessed gateway.
In an optional embodiment of the present invention, in a case that the module of the internet of things is connected to a network, the obtaining of the target time includes: under the condition that the IOT module is connected with a network, acquiring first target time, wherein the first target time is the time acquired by the IOT module for the first time when the IOT module is connected with the network; acquiring second target time according to a preset time interval, wherein the second target time is the time in the next interval period acquired after the internet of things module access network is firstly acquired; synchronizing the first target time to the second target time.
In specific implementation, the obtained first target time is updated according to a preset time interval to obtain a second target time. The first target time is the time obtained for the first time when the internet of things module is connected with the network, and may be network time or cloud time. The second target time is a time in a next interval period acquired after the internet of things module is accessed to the network for the first time, and may also be a network time or a cloud time.
In an optional embodiment of the present invention, in a case that the module of the internet of things is connected to a network, the obtaining of the target time includes: the Internet of things module initiates a synchronization request of the target time; taking the cloud time as the target time under the condition that the Internet of things module firstly acquires the cloud time through a connection network; and under the condition that the internet of things module firstly acquires the network time through a connection network, taking the network time as the target time.
In specific implementation, the synchronization request of the target time is initiated under the condition that the internet of things module is connected with the network, and if the internet of things module acquires the cloud time through the connection network, the cloud time is used as the target time. And if the internet of things module acquires the network time through a connection network, taking the network time as the target time.
As shown in fig. 4, the method specifically includes the following steps:
step S400, start to connect to the network.
Step S401, cloud time initialization.
Step S402, is it synchronously acquired (acquired every 2h after the initial acquisition)? If so, the process proceeds to step S405, otherwise, the process proceeds to step S403.
And acquiring the cloud time from the cloud after the cloud is connected, and if the write-in preset initial value is not acquired for the first time, acquiring the write-in preset initial value once every 2 hours.
Step S403 requests time from the master gateway.
In step S404, the time stamp is not acquired for the first time.
In step S405, the synchronization time is set.
In step S406, SNTP time is initialized.
Sntp (simple Network Time protocol), i.e., simple Network Time protocol.
In step S407, the time is acquired (once every 10min after the initial acquisition).
Step S408, is SNTP time acquired? If so, the process proceeds to step S410, otherwise, the process proceeds to step S409.
In step S409, the time stamp is not acquired for the first time.
Acquiring SNTP time, and acquiring time from a network after connecting the network. If the preset write initial value is not acquired for the first time, acquiring the network time every 1 hour later.
In step S410, a synchronization time is set.
Step S411, time maintenance is performed locally.
In an optional embodiment of the present invention, the issuing the standard time to the target device, so that the synchronizing in the target device as the standard time includes: issuing the standard time to a control panel of target equipment; stopping issuing the standard time to the control board of the target device under the condition of receiving an invalid frame or not receiving a response frame in the control board; and under the condition of receiving the confirmation frame in the control panel, transmitting the standard time to the control panel of the target equipment according to a preset synchronous time interval.
The process is a processing flow of the issuing process after the internet of things module obtains the standard time. For example, after the internet of things module is connected to the server, the internet of things module is issued every 10min, and if no response or response invalid frame is issued for three times continuously, the internet of things module is not issued any more. And the rest conditions are normally issued. If the module of the Internet of things is not connected with the server, time is not sent out for ensuring accuracy.
As shown in fig. 6, the above processing flow specifically includes the following steps:
step S601 starts.
Step S602, is there a connection to a server?
Step S603, if yes, the Internet of things module obtains the network time and updates the network time.
Step S604, the Internet of things module issues network time to the bottom plate.
In step S605, the backplane responds.
Step S606, response is made to the invalid frame or not to the response.
Step S607, does not answer three consecutive times? If not, the method is re-acquired, and if yes, the method goes to step S610. I.e. rpt _ time > 3.
Step S608, the acknowledgement frame is answered.
I.e., rpt _ times ═ 0.
In step S609, a timer is set.
And step S610, the Internet of things module stops sending time to the bottom plate.
Step S611, end.
In an optional embodiment of the present invention, the issuing the standard time to the target device, so that the synchronizing in the target device as the standard time includes: determining the time difference between the target time and the local time according to the target time; setting the target time to the standard time if the time difference is greater than or equal to a first threshold value; under the condition that the time difference is smaller than or equal to the first threshold value, the target time is adjusted according to a first adjustment strategy and then is synchronized to be the standard time; and under the condition that the absolute value of the time difference is smaller than the first threshold value, synchronizing the target time to the standard time after adjusting the target time according to a second adjustment strategy, wherein the adjustment speed of the second adjustment strategy is greater than that of the first adjustment strategy.
As shown in fig. 5, the method specifically includes the following steps:
step S501, maintain local time.
Step S502, time difference (New time-System time)
In step S503, the time difference is not less than 10S.
Step S504, directly setting the new time as the system time.
Step S505, the time difference is less than-10S and less than 10S
In step S506, the slow speed is gradually adjusted.
In step S507, 30ms is adjusted every 100 ms.
In step S508, the same time is the UTC time.
In step S509, the time difference is not greater than 10S.
Step S510, adjusting gradually and quickly.
In step S511, the adjustment is performed for 60ms every 100 ms.
When the standard time in the internet of things module is marked as UTC, i.e. coordinated world, after the cloud or network is updated, the UTC is synchronously updated, the adjustment strategy is as shown in fig. 5, fine adjustment is performed when the deviation is too small, and quick adjustment is performed when the deviation is too large, and finally the UTC time is synchronized. Through the steps, the Internet of things module can compare the acquired network time with the crystal oscillator time of the Internet of things module, and strategy adjustment is carried out on the time deviation, so that the user experience is improved.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
In this embodiment, a time synchronization apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and the description already made is omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
FIG. 3 is a block diagram of a time synchronizer according to an embodiment of the present invention, and as shown in FIG. 3, the time synchronizer includes
The obtaining module 30 is configured to obtain the target time when the internet of things module is connected to the network;
a synchronization module 32, configured to synchronize a local time in the internet of things module to a standard time according to the target time, where the local time includes: time obtained by a crystal oscillator module in the Internet of things module;
and the issuing module 34 is configured to issue the standard time to the target device, so that the time in the target device is synchronized to the standard time.
In the obtaining module 30, the target time may be obtained when the internet of things module is connected to the network. The target time may be a network time based on a network grant, or may be a cloud time obtained from a cloud.
It should be noted that, generally, after the internet of things module is connected to the network, a request for obtaining the target time is sent out at the same time, and if the cloud time is received first, the cloud time is taken as the target time, and if the network time is received first, the network time is taken as the target time.
And synchronizing the local time in the internet of things module to be standard time in the synchronization module 32 according to the obtained target time.
It should be noted that the local time refers to the time acquired by the crystal oscillator module in the internet of things module, and the crystal oscillator module acquires the time regardless of whether the internet of things module is connected to a network.
The updated and adjusted standard time is sent to the target device in the sending module 34, so that the time in the target device is synchronized to the standard time.
Because the time in the internet of things module must be acquired and corrected at intervals during network time service, the situation that a home with no network or poor network quality cannot be acquired can be avoided through the time maintenance strategy in the internet of things module, and long-time errors caused by the fact that only module crystal oscillators are used for maintenance can also be avoided.
If the network time can not be acquired by the Internet of things module, the time can be acquired from the cloud end, and the time of the cloud end can be used as accurate time for maintenance, so that overlarge errors caused by long-time maintenance only by the crystal oscillator module can be prevented.
Through the module, under the condition that the Internet of things module is connected with a network, the target time is obtained, and the local time in the Internet of things module is synchronized into the standard time according to the target time, wherein the target time is the cloud time obtained from a cloud end or the network time obtained from the network. Therefore, the problem that the home equipment cannot acquire accurate network time due to the fact that no network exists or network quality is poor in the operation period of the internet of things module can be solved, and the effect that the home equipment can acquire the accurate network time can be achieved.
The target time in the acquisition module 30 includes: cloud time, network time; the obtaining module 30 is configured to obtain the cloud time when the internet of things module is connected to a network and is connected to a cloud; or, the network time is acquired under the condition that the internet of things module is connected with the network.
The obtaining module 30 is configured to obtain the network time from a gateway when the internet of things module is connected to a network and is connected to a cloud, and the cloud time is not obtained; and under the condition that the internet of things module is connected with the network and the network time is not acquired, acquiring the network time from a gateway.
The obtaining module 30 is configured to obtain a first target time when the internet of things module is connected to a network, where the first target time is obtained when the internet of things module is connected to the network for the first time; acquiring second target time according to a preset time interval, wherein the second target time is the time in the next interval period acquired after the internet of things module access network is firstly acquired; synchronizing the first target time to the second target time.
The obtaining module 30 is configured to initiate a synchronization request of the target time through the internet of things module; taking the cloud time as the target time under the condition that the Internet of things module firstly acquires the cloud time through a connection network; and under the condition that the internet of things module firstly acquires the network time through a connection network, taking the network time as the target time.
The synchronization module 32 is configured to issue the standard time to a control board of a target device; stopping issuing the standard time to the control board of the target device under the condition of receiving an invalid frame or not receiving a response frame in the control board; and under the condition of receiving the confirmation frame in the control panel, transmitting the standard time to the control panel of the target equipment according to a preset synchronous time interval.
The issuing module 34 is configured to determine a time difference between the target time and the local time according to the target time; setting the target time to the standard time if the time difference is greater than or equal to a first threshold value; under the condition that the time difference is smaller than or equal to the first threshold value, the target time is adjusted according to a first adjustment strategy and then is synchronized to be the standard time; and under the condition that the absolute value of the time difference is smaller than the first threshold value, synchronizing the target time to the standard time after adjusting the target time according to a second adjustment strategy, wherein the adjustment speed of the second adjustment strategy is greater than that of the first adjustment strategy.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
In order to better understand the flow of the time synchronization method, the following explains the technical solutions with reference to the preferred embodiments, but the technical solutions of the embodiments of the present invention are not limited.
The preferred embodiment of the invention relates to a method for acquiring, maintaining and issuing network time, which is simple and convenient to realize, can update the local time in an Internet of things module according to the acquired network time or cloud time, fine-tunes and quickly adjusts the local time, and issues the local time to target household appliance equipment, thereby improving the user operation experience.
Fig. 7 is a schematic view of a usage scenario of the time synchronization method in the embodiment of the present application.
In the scene, a plurality of intelligent household devices are included, wherein one part of the intelligent household devices needs network time service, and the other part does not need network time service. For example, the intelligent refrigerator needs to perform network time service and displays a time synchronization result on a display screen.
The intelligent household appliance comprises an Internet of things module and a crystal oscillator module. The crystal oscillator module can maintain local time, and the internet of things module can acquire network time or cloud time after accessing a network and maintain the cloud time or the network time locally. The maintenance mode can be fine adjustment and quick adjustment, namely the internet of things module can compare the acquired network time with the crystal oscillator time of the internet of things module, and strategy adjustment is carried out on the time deviation. And then synchronizes the local time to the standard time. And finally, issuing the standard time to the target household equipment, wherein the issuing processing process mainly comprises issuing every 10min after the Internet of things module is connected with the network, and if no response exists or no response invalid frame is not issued any more after the Internet of things module is continuously issued for three times, the rest of the frames are normally issued. In addition, if the connection cannot be made to the network, the down sending is not performed to ensure the accuracy.
Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring target time under the condition that the Internet of things module is connected with the network;
s2, synchronizing the local time in the IOT module into standard time according to the target time, wherein the local time comprises: time obtained by a crystal oscillator module in the Internet of things module;
and S3, issuing the standard time to the target equipment so as to synchronize the time in the target equipment into the standard time.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring target time under the condition that the Internet of things module is connected with the network;
s2, synchronizing the local time in the IOT module into standard time according to the target time, wherein the local time comprises: time obtained by a crystal oscillator module in the Internet of things module;
and S3, issuing the standard time to the target equipment so as to synchronize the time in the target equipment into the standard time.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of time synchronization, comprising:
under the condition that the Internet of things module is connected with a network, acquiring target time;
synchronizing local time in the internet of things module into standard time according to the target time, wherein the local time comprises: time obtained by a crystal oscillator module in the Internet of things module;
and issuing the standard time to target equipment so as to synchronize the time in the target equipment into the standard time.
2. The method of claim 1, wherein obtaining the target time when the internet of things module is connected to the network comprises:
the target time includes: cloud time, network time;
under the condition that the Internet of things module is connected with a network and is connected with a cloud, acquiring the cloud time;
or, the network time is acquired under the condition that the internet of things module is connected with the network.
3. The method of claim 2, wherein obtaining the target time when the internet of things module is connected to the network comprises:
the method comprises the steps that when the Internet of things module is connected with a network and is connected with a cloud end, and the cloud end time is not obtained, the network time is obtained from a gateway;
and under the condition that the internet of things module is connected with the network and the network time is not acquired, acquiring the network time from a gateway.
4. The method of claim 2, wherein obtaining the target time when the internet of things module is connected to the network comprises:
under the condition that the IOT module is connected with a network, acquiring first target time, wherein the first target time is the time acquired by the IOT module for the first time when the IOT module is connected with the network;
acquiring second target time according to a preset time interval, wherein the second target time is the time in the next interval period acquired after the internet of things module access network is firstly acquired;
synchronizing the first target time to the second target time.
5. The method of claim 2, wherein obtaining the target time when the internet of things module is connected to the network comprises:
the Internet of things module initiates a synchronization request of the target time;
taking the cloud time as the target time under the condition that the Internet of things module firstly acquires the cloud time through a connection network;
and under the condition that the internet of things module firstly acquires the network time through a connection network, taking the network time as the target time.
6. The method of claim 1, wherein the sending the standard time to a target device so that synchronization in the target device is the standard time comprises:
issuing the standard time to a control panel of target equipment;
stopping issuing the standard time to the control board of the target device under the condition of receiving an invalid frame or not receiving a response frame in the control board;
and under the condition of receiving the confirmation frame in the control panel, transmitting the standard time to the control panel of the target equipment according to a preset synchronous time interval.
7. The method of claim 1, wherein the sending the standard time to a target device so that synchronization in the target device is the standard time comprises:
determining the time difference between the target time and the local time according to the target time;
setting the target time to the standard time if the time difference is greater than or equal to a first threshold value;
under the condition that the time difference is smaller than or equal to the first threshold value, the target time is adjusted according to a first adjustment strategy and then is synchronized to be the standard time;
and under the condition that the absolute value of the time difference is smaller than the first threshold value, synchronizing the target time to the standard time after adjusting the target time according to a second adjustment strategy, wherein the adjustment speed of the second adjustment strategy is greater than that of the first adjustment strategy.
8. A time synchronization apparatus, comprising:
the acquisition module is used for acquiring the target time under the condition that the Internet of things module is connected with the network;
a synchronization module, configured to synchronize a local time in the internet of things module to a standard time according to the target time, where the local time includes: time obtained by a crystal oscillator module in the Internet of things module;
and the issuing module is used for issuing the standard time to the target equipment so as to synchronize the time in the target equipment into the standard time.
9. A storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 5 when executed.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 5.
CN202011419109.0A 2020-12-07 2020-12-07 Time synchronization method and device, storage medium and electronic device Pending CN112788100A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011419109.0A CN112788100A (en) 2020-12-07 2020-12-07 Time synchronization method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011419109.0A CN112788100A (en) 2020-12-07 2020-12-07 Time synchronization method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN112788100A true CN112788100A (en) 2021-05-11

Family

ID=75750739

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011419109.0A Pending CN112788100A (en) 2020-12-07 2020-12-07 Time synchronization method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN112788100A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113848743A (en) * 2021-09-30 2021-12-28 珠海格力电器股份有限公司 Time sharing method, device and equipment in ad hoc network
CN114360086A (en) * 2021-12-09 2022-04-15 北京汽车研究总院有限公司 Data processing method, data processing device, in-vehicle device, and storage medium
CN114422560A (en) * 2022-01-12 2022-04-29 珠海格力电器股份有限公司 Method, module, electronic device and readable medium for stopping operation of target device
CN116669170A (en) * 2023-07-14 2023-08-29 深圳摩尔智联科技有限公司 Intelligent fire hydrant network time synchronization method and related device
CN114360086B (en) * 2021-12-09 2024-04-26 北京汽车研究总院有限公司 Data processing method, data processing device, vehicle device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110061797A (en) * 2019-05-29 2019-07-26 海尔优家智能科技(北京)有限公司 Method for synchronizing time, device, storage medium and computer equipment
CN110572229A (en) * 2019-09-09 2019-12-13 Oppo广东移动通信有限公司 Time calibration method, device, terminal and storage medium
CN111314004A (en) * 2018-12-12 2020-06-19 深圳市云海物联科技有限公司 Time service method and device for smart home, terminal equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111314004A (en) * 2018-12-12 2020-06-19 深圳市云海物联科技有限公司 Time service method and device for smart home, terminal equipment and storage medium
CN110061797A (en) * 2019-05-29 2019-07-26 海尔优家智能科技(北京)有限公司 Method for synchronizing time, device, storage medium and computer equipment
CN110572229A (en) * 2019-09-09 2019-12-13 Oppo广东移动通信有限公司 Time calibration method, device, terminal and storage medium

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113848743A (en) * 2021-09-30 2021-12-28 珠海格力电器股份有限公司 Time sharing method, device and equipment in ad hoc network
CN113848743B (en) * 2021-09-30 2023-09-26 珠海格力电器股份有限公司 Time sharing method, device and equipment in ad hoc network
CN114360086A (en) * 2021-12-09 2022-04-15 北京汽车研究总院有限公司 Data processing method, data processing device, in-vehicle device, and storage medium
CN114360086B (en) * 2021-12-09 2024-04-26 北京汽车研究总院有限公司 Data processing method, data processing device, vehicle device and storage medium
CN114422560A (en) * 2022-01-12 2022-04-29 珠海格力电器股份有限公司 Method, module, electronic device and readable medium for stopping operation of target device
CN116669170A (en) * 2023-07-14 2023-08-29 深圳摩尔智联科技有限公司 Intelligent fire hydrant network time synchronization method and related device
CN116669170B (en) * 2023-07-14 2024-03-15 深圳摩尔智联科技有限公司 Intelligent fire hydrant network time synchronization method and related device

Similar Documents

Publication Publication Date Title
CN112788100A (en) Time synchronization method and device, storage medium and electronic device
CN110399110A (en) Multi-screen synchronous display methods and system, display equipment and storage medium
US8638774B2 (en) Controlling timing of synchronization updates
CN109327899A (en) A kind of method, apparatus and system synchronization time of mobile unit synchronization time
US20190097746A1 (en) Systems and methods to synchronize wireless devices in the presence of a fmcw radio altimeter
WO2017054554A1 (en) Clock synchronization method, device, and communication apparatus
CN111954050B (en) Method and system for synchronizing videos among multiple devices
CN109714757B (en) Method and device for preparing eSIM card in shared mode
EP3893428A1 (en) Clock synchronization method and device, and storage medium
EP3893427A1 (en) Clock synchronization method and apparatus and storage medium
CN103999387A (en) Sync interval determination
CN112543502A (en) Communication synchronization method, device, apparatus and storage medium
US20210409149A1 (en) Method and device for transmitting data, system, and storage medium
CN111102689A (en) Method and device for adjusting clock synchronization
CN102571253B (en) Method and equipment for implementing precise time synchronization
KR102066977B1 (en) IoT SYSTEM USING NB-IoT NETWORK AND ITS TIME SYNCHRONIZATION METHOD
CN109067496B (en) Wireless clock synchronization method, system and medium for centerless base station
US20170117980A1 (en) Time synchronization for network device
KR101421523B1 (en) Network synchronization system and network synchronization method
US10554319B2 (en) Wireless communications with time synchronization processing
KR101593822B1 (en) Apparatus for providing communication service, control method thereof, recording medium for recording program for executing the control method, application saved in the recording medium for executing the control method being combined with hardware
CN114173166A (en) Image synchronous display system and method and display controller
CN113438328B (en) Low-delay terminal synchronization system and method
CN111107169B (en) Time management method based on WEB browser
CN112152744A (en) Clock synchronization method and device, FPGA chip and optical fiber communication network

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210511