CN112332939A - Time synchronization method and device of android system, terminal device and storage medium - Google Patents

Time synchronization method and device of android system, terminal device and storage medium Download PDF

Info

Publication number
CN112332939A
CN112332939A CN202011216790.9A CN202011216790A CN112332939A CN 112332939 A CN112332939 A CN 112332939A CN 202011216790 A CN202011216790 A CN 202011216790A CN 112332939 A CN112332939 A CN 112332939A
Authority
CN
China
Prior art keywords
ntp server
country
country code
default
time
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
CN202011216790.9A
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.)
Guangzhou Lango Electronic Science and Technology Co Ltd
Original Assignee
Guangzhou Lango Electronic Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Lango Electronic Science and Technology Co Ltd filed Critical Guangzhou Lango Electronic Science and Technology Co Ltd
Priority to CN202011216790.9A priority Critical patent/CN112332939A/en
Publication of CN112332939A publication Critical patent/CN112332939A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • 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/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Abstract

The invention provides a time synchronization method, a time synchronization device, terminal equipment and a storage medium of an android system, wherein the method comprises the following steps: setting a country or region name; inquiring whether a country code of the country exists in the configuration file according to the set country or region, if so, matching the country code to a corresponding NTP server according to the country code, and rapidly updating the system time of the terminal equipment from the corresponding NTP server; and if the network time does not exist, matching the default code, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server. The invention can dynamically set the fastest NTP server, quickly update the system time and improve the user experience.

Description

Time synchronization method and device of android system, terminal device and storage medium
Technical Field
The invention relates to the technical field of time synchronization control, in particular to a time synchronization method and device of an android system, terminal equipment and a storage medium.
Background
NTP is network time protocol, english name: network Time Protocol (NTP) is a Protocol used to synchronize the Time of a terminal device such as a computer, a mobile phone, an all-in-one machine, etc. with the local Time. When a terminal device is initially turned on or is transferred from one country or region to another country or region for use, it is necessary to set the system time of the terminal device or readjust the system time. NTP enables a terminal device to synchronize its server or clock source (e.g., quartz clock, GPS, etc.), it provides highly accurate time correction (less than 1 millisecond from standard on LAN and tens of milliseconds on WAN), and it prevents malicious protocol attacks via encrypted confirmation. The purpose of NTP is to provide accurate and robust time services in an out-of-order Internet environment.
At present, the modification of system time by using NTP on an android open source system is carried out through a Google server, the code of synchronous time is fixed to the Google server, only the update time of the Google server can be accessed, and the update time cannot be dynamically set according to countries and regions. However, some countries or regions cannot access google servers for various reasons, or even if the google servers can be accessed, the access is time-consuming due to too long network distance, the system time cannot be updated quickly, and the experience of users is not good.
Disclosure of Invention
The invention aims to provide a time synchronization method and device of an android system, terminal equipment and a storage medium. The problem of only can visit google server update time bring among the prior art is solved.
The purpose of the invention is realized by the following technical scheme:
in a first aspect, the present invention provides a time synchronization method for an android system, including the following steps:
step 1, setting a country or region name;
step 2, inquiring whether a country code of the country exists in the configuration file according to the set country or region, and if so, turning to step 3; if not, matching a default code, and turning to the step 4;
step 3, matching the corresponding NTP server according to the country code, and rapidly updating the system time of the terminal equipment from the corresponding NTP server;
and 4, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server.
Furthermore, the configuration file stores the corresponding relationship between the country code and the NTP server in advance.
Further, the storage format of the corresponding relationship between the country code and the NTP server is as follows: [ country code ] ═ NTP server ].
In a second aspect, the invention provides a time synchronization device of an android system, which comprises a matching module and a storage module;
the storage module is used for storing a configuration file, and the configuration file stores the corresponding relation between the country code and the NTP server;
the matching module selects a country code according to the country or region set by the user, matches an NTP server corresponding to the country code, and quickly updates the system time of the terminal equipment from the corresponding NTP server; and when the country or region set by the user does not have the corresponding country code in the configuration file, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server.
Further, the storage format of the corresponding relationship between the country code and the NTP server is as follows: [ country code ] ═ NTP server ].
In a third aspect, the present invention provides a terminal device, including the time synchronization apparatus of the android system.
In a fourth aspect, the present invention provides a storage medium, in which a computer program is stored, and the computer program is executed to perform the time synchronization method of the android system.
The time synchronization method, the time synchronization device, the terminal equipment and the storage medium of the android system can be dynamically set to the fastest NTP server, so that the system time can be updated rapidly, and the user experience is improved.
Drawings
FIG. 1 is a schematic flow chart of a time synchronization method of an android system of the present invention;
fig. 2 is a schematic structural diagram of the time synchronization device of the android system.
Detailed Description
The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
The embodiments of the present disclosure are described below with specific examples, and other advantages and effects of the present disclosure will be readily apparent to those skilled in the art from the disclosure in the specification. It is to be understood that the described embodiments are merely illustrative of some, and not restrictive, of the embodiments of the disclosure. The disclosure may be embodied or carried out in various other specific embodiments, and various modifications and changes may be made in the details within the description without departing from the spirit of the disclosure. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
The time synchronization method of the android system comprises the following steps:
step 1, setting the name of a country or a region.
When the terminal device is first powered on or moved from one country or region to another, the user sets the geographic location in the terminal device to the country or region to which it currently belongs. For example, if the terminal device is used in china, the geographical location is set to china. For example, when a device produced in china is exported abroad and is started for the first time, the system of the terminal device guides the user to set the region, and the user sets the region according to the country to which the user belongs. The user starts up for the first time and sets a country/region in the start-up guide or updates the country/region in the setting menu, and the attribute value of the adnroid (android system) of the terminal device is synchronously set.
Step 2, inquiring whether a country code of the country exists in the configuration file according to the set country or region, and if so, turning to step 3; if not, the default code is matched, and the step 4 is carried out.
The time synchronizer stores a configuration file of the corresponding relation between the country code and the server which are set in advance. Country. code. state is the corresponding country code.
The naming of the country code is specified according to the ISO 3661alpha-2code standard, such as China country code CN, Armenia country code AM, ZZ as default country code, for the bottom of the book. If the country or region where the user is located does not have the corresponding country code configured in the configuration file, the default code is matched. The configuration file has no number limit for the Chinese code.
And 3, matching the corresponding NTP server according to the country code, and quickly updating the system time of the terminal equipment from the corresponding NTP server.
Firstly, the NTP server with the highest speed in each country or region is collected and summarized, and then the NTP server is placed into a configuration file according to a format of [ country code ] ═ NTP server ]. As follows:
AE=ae.pool.ntp.org
AT=europe.pool.ntp.org
AU=au.pool.ntp.org
BE=europe.pool.ntp.org
BG=europe.pool.ntp.org
CA=time.android.com
CH=ch.pool.ntp.org
CN=cn.pool.ntp.org
ZZ=pool.ntp.org
the time synchronizer analyzes the configuration file, then acquires a corresponding NTP server address according to the country code of the persistence.
And 4, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server.
The default country code ZZ corresponds to a default NTP server, and if the country or region where the user is located does not configure the corresponding NTP server in the configuration file, the default NTP server is used to update the system time for the user. The system time of the terminal equipment of each country or region can be ensured to be synchronized with the local time.
According to the method, the NTP server of the area or the country where the terminal equipment is located can be dynamically set, and the Google server does not need to be fixedly passed through. The method solves the problems that some countries or regions cannot access the Google server due to other reasons, or even if the Google server can be accessed, the network distance is too far, the access is time-consuming, the system time cannot be updated quickly, and the user experience is not good.
The time synchronization device of the android system comprises a matching module and a storage module. The storage module is used for storing configuration files, and the configuration files store the corresponding relation between the country codes and the NTP server. The matching module selects a country code according to the country or region set by the user, matches the NTP server corresponding to the country code, and quickly updates the system time of the terminal equipment from the corresponding NTP server. And when the country or region set by the user does not have the corresponding country code in the configuration file, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server.
The storage format of the corresponding relation between the Chinese home code and the NTP server of the configuration file is as follows: [ country code ] ═ NTP server ].
The terminal equipment comprises the time synchronization device of the android system.
The invention also provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is run, the time synchronization method of the android system can be executed as follows:
step 1, setting the name of a country or a region.
Step 2, inquiring whether a country code of the country exists in the configuration file according to the set country or region, and if so, turning to step 3; if not, the default code is matched, and the step 4 is carried out.
And 3, matching the corresponding NTP server according to the country code, and quickly updating the system time of the terminal equipment from the corresponding NTP server.
And 4, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server.
Further, in a preferred embodiment of the present application, step 2 comprises:
inquiring whether a country code of the country exists in the configuration file according to the set country or region, and if so, turning to the step 3; if not, the default code is matched, and the step 4 is carried out.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; may be mechanically coupled, may be electrically coupled or may be in communication with each other; they may be directly connected or indirectly connected through intervening media, or they may be connected internally or in any other suitable relationship, unless expressly stated otherwise. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
The above description is for the purpose of illustrating embodiments of the invention and is not intended to limit the invention, and it will be apparent to those skilled in the art that any modification, equivalent replacement, or improvement made without departing from the spirit and principle of the invention shall fall within the protection scope of the invention.

Claims (7)

1. The time synchronization method of the android system is characterized by comprising the following steps of:
step 1, setting a country or region name;
step 2, inquiring whether a country code of the country exists in the configuration file according to the set country or region, and if so, turning to step 3; if not, matching a default code, and turning to the step 4;
step 3, matching the corresponding NTP server according to the country code, and rapidly updating the system time of the terminal equipment from the corresponding NTP server;
and 4, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server.
2. The time synchronization method of the android system according to claim 1, wherein a correspondence between a country code and an NTP server is stored in advance in the configuration file.
3. The android system time synchronization method of claim 2, wherein the storage format of the correspondence between the country code and the NTP server is: [ country code ] ═ NTP server ].
4. The time synchronization device of the android system is characterized by comprising a matching module and a storage module;
the storage module is used for storing a configuration file, and the configuration file stores the corresponding relation between the country code and the NTP server;
the matching module selects a country code according to the country or region set by the user, matches an NTP server corresponding to the country code, and quickly updates the system time of the terminal equipment from the corresponding NTP server; and when the country or region set by the user does not have the corresponding country code in the configuration file, matching the default NTP server, and quickly updating the system time of the terminal equipment from the default NTP server.
5. The android system time synchronizer of claim 4, wherein the storage format of the correspondence between the country code and the NTP server is: [ country code ] ═ NTP server ].
6. Terminal device, characterized in that it comprises the time synchronization apparatus of the android system of claim 4 or 5.
7. A storage medium having a computer program stored therein, wherein the computer program is executed to perform the time synchronization method of the android system according to any one of claims 1 to 3.
CN202011216790.9A 2020-11-04 2020-11-04 Time synchronization method and device of android system, terminal device and storage medium Pending CN112332939A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011216790.9A CN112332939A (en) 2020-11-04 2020-11-04 Time synchronization method and device of android system, terminal device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011216790.9A CN112332939A (en) 2020-11-04 2020-11-04 Time synchronization method and device of android system, terminal device and storage medium

Publications (1)

Publication Number Publication Date
CN112332939A true CN112332939A (en) 2021-02-05

Family

ID=74323738

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011216790.9A Pending CN112332939A (en) 2020-11-04 2020-11-04 Time synchronization method and device of android system, terminal device and storage medium

Country Status (1)

Country Link
CN (1) CN112332939A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040125822A1 (en) * 2002-12-24 2004-07-01 Sun-Mi Jun Network synchronization system and method using synchronous mobile terminal as external reference clock
US20110170423A1 (en) * 2008-04-04 2011-07-14 Telefonaktiebolaget Lm Ericsson (Publ) Method for Updating Information Regarding Network Nodes Serving a Tracking Area
CN105159728A (en) * 2015-09-25 2015-12-16 青岛海信宽带多媒体技术有限公司 Method and device for obtaining NTP time information based on android system
US9246762B1 (en) * 2014-06-19 2016-01-26 Amazon Technologies, Inc. NTP client-side automatic configuration
CN105517140A (en) * 2015-11-30 2016-04-20 努比亚技术有限公司 Time update method and device, mobile terminal and time update method for mobile terminal
CN106452648A (en) * 2014-06-26 2017-02-22 青岛海信移动通信技术股份有限公司 Time synchronization method and communication terminal
CN106453560A (en) * 2016-10-14 2017-02-22 北京小米移动软件有限公司 Time acquisition method and apparatus
CN106993028A (en) * 2017-03-20 2017-07-28 山东浪潮商用系统有限公司 Network time acquisition methods, apparatus and system, computer-readable recording medium and storage control
CN108605223A (en) * 2016-12-01 2018-09-28 华为技术有限公司 A kind of method and terminal obtaining time and time zone
CN110798278A (en) * 2019-10-22 2020-02-14 广东长虹电子有限公司 Method, storage medium and device for synchronizing network time by television

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040125822A1 (en) * 2002-12-24 2004-07-01 Sun-Mi Jun Network synchronization system and method using synchronous mobile terminal as external reference clock
US20110170423A1 (en) * 2008-04-04 2011-07-14 Telefonaktiebolaget Lm Ericsson (Publ) Method for Updating Information Regarding Network Nodes Serving a Tracking Area
US9246762B1 (en) * 2014-06-19 2016-01-26 Amazon Technologies, Inc. NTP client-side automatic configuration
CN106452648A (en) * 2014-06-26 2017-02-22 青岛海信移动通信技术股份有限公司 Time synchronization method and communication terminal
CN105159728A (en) * 2015-09-25 2015-12-16 青岛海信宽带多媒体技术有限公司 Method and device for obtaining NTP time information based on android system
CN105517140A (en) * 2015-11-30 2016-04-20 努比亚技术有限公司 Time update method and device, mobile terminal and time update method for mobile terminal
CN106453560A (en) * 2016-10-14 2017-02-22 北京小米移动软件有限公司 Time acquisition method and apparatus
CN108605223A (en) * 2016-12-01 2018-09-28 华为技术有限公司 A kind of method and terminal obtaining time and time zone
CN106993028A (en) * 2017-03-20 2017-07-28 山东浪潮商用系统有限公司 Network time acquisition methods, apparatus and system, computer-readable recording medium and storage control
CN110798278A (en) * 2019-10-22 2020-02-14 广东长虹电子有限公司 Method, storage medium and device for synchronizing network time by television

Similar Documents

Publication Publication Date Title
CN106612188A (en) Method and device for extending software function based on micro service architecture
KR100532288B1 (en) Karaoke Service Method By Using Wireless Connecting Means between Mobile Communication Terminals and Computer Readable Recoding Medium for Performing it
CN1270568C (en) Method for supporting multilanguage for mobile communication terminal and its communication system
EP3125509A1 (en) Application information sharing method and apparatus
EP2204964A1 (en) Method and device for realizing data synchronization
EP2157758A1 (en) Data soft deletion, recovery and synchronization method, terminal and system thereof
KR20020048896A (en) Information collection server, information collection method, and recording medium
EP1556785A1 (en) Data synchronization
JP5050846B2 (en) Mobile communication device and method for updating telephone directory of mobile communication device
CN102387482A (en) Method, system and mobile phone for acquiring mobile phone service information
CN102591693B (en) A kind of method and device that carries out file update based on CMMB
WO2017166773A1 (en) Terminal information synchronization method and apparatus, information synchronization system, and electronic device
US20120233262A1 (en) Message signature method and device
CN1997173A (en) Implementation system and method for data synchronization of the mobile terminal
US7840529B2 (en) Contents list providing apparatus and contents list providing method
CN105763461B (en) Router upgrade method and system
CN102594874B (en) Synchronization processing method and device
CN101588550B (en) Electronic business-card application system based on high-capacity SIM cards
CN111629018A (en) Resource synchronization method, device, equipment and storage medium
CN112332939A (en) Time synchronization method and device of android system, terminal device and storage medium
KR100650351B1 (en) Contents update system for potable device and method thereof
AU2012261393B2 (en) Method and system for inputting information to mobile terminal as well as mobile terminal
JP2000112764A (en) Software down-loading system
KR20030041027A (en) Method and Device for providing Resource Alone of Contents Application for Mobile Communication terminal
CN113613274A (en) Intelligent access configuration method based on Mesh networking

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510000 unit a and B, zone 02, 4th floor, No. 136, Gaopu Road, high tech Development Zone, Tianhe District, Guangzhou City, Guangdong Province

Applicant after: Guangzhou langguo Electronic Technology Co.,Ltd.

Address before: 510000 unit a and B, zone 02, 4th floor, No. 136, Gaopu Road, high tech Development Zone, Tianhe District, Guangzhou City, Guangdong Province

Applicant before: GUANGZHOU LANGO ELECTRONIC SCIENCE & TECHNOLOGY Co.,Ltd.