CN114415492B - Method, terminal and storage medium for acquiring time in offline state - Google Patents

Method, terminal and storage medium for acquiring time in offline state Download PDF

Info

Publication number
CN114415492B
CN114415492B CN202111497297.3A CN202111497297A CN114415492B CN 114415492 B CN114415492 B CN 114415492B CN 202111497297 A CN202111497297 A CN 202111497297A CN 114415492 B CN114415492 B CN 114415492B
Authority
CN
China
Prior art keywords
target
time
time zone
acquiring
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111497297.3A
Other languages
Chinese (zh)
Other versions
CN114415492A (en
Inventor
吕浩
郭佳
江滔
邵国光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Umeox Innovations Co ltd
Original Assignee
Umeox Innovations 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 Umeox Innovations Co ltd filed Critical Umeox Innovations Co ltd
Priority to CN202111497297.3A priority Critical patent/CN114415492B/en
Publication of CN114415492A publication Critical patent/CN114415492A/en
Application granted granted Critical
Publication of CN114415492B publication Critical patent/CN114415492B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G04HOROLOGY
    • G04RRADIO-CONTROLLED TIME-PIECES
    • G04R20/00Setting the time according to the time information carried or implied by the radio signal
    • G04R20/02Setting the time according to the time information carried or implied by the radio signal the radio signal being sent by a satellite, e.g. GPS
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Electric Clocks (AREA)

Abstract

The application discloses a method for acquiring time in an offline state, a terminal and a storage medium, wherein the method comprises the following steps: acquiring current position information of a terminal and universal coordinated time (UTC) time corresponding to the current position information according to GPS data; determining at least one geographic block with the distance from the current position information smaller than or equal to the preset distance according to the preset electronic map; determining a target geographic block corresponding to the current position information according to at least one geographic block; determining a target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographic block; and determining the target time corresponding to the terminal according to the target time zone and the UTC time. According to the application, the preset electronic map comprising a plurality of geographic blocks and time zone information corresponding to each geographic block is arranged, and after the current position information and UTC time of the terminal are acquired, the target time corresponding to the terminal can be determined according to the preset electronic map, so that the problem that the time cannot be acquired in an off-line state is solved.

Description

Method, terminal and storage medium for acquiring time in offline state
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method, a terminal, and a storage medium for acquiring time in an offline state.
Background
Currently, on a terminal device (such as a bluetooth watch, etc.), the current time of the terminal device is obtained, and usually, the UTC time is obtained by manually setting a time zone and requesting a time server, and then the current time is obtained by calculating the time zone and the UTC time, or the current time is obtained by relying on a base station network.
In the conception and implementation of the present application, the inventors have found that at least the following problems exist: the success of the current time acquisition is greatly dependent on the success of networking because the current time acquisition needs to be completed through a server side or a base station, and failure of networking or network congestion can cause failure of acquiring the current time.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present application and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The application mainly aims to provide a method for acquiring time in an offline state, a terminal and a storage medium, and aims to solve the problem that the terminal cannot acquire time in the offline state.
In order to achieve the above object, the present application provides a method for acquiring time in an offline state, where the method is applied to a terminal, and the steps of the method for acquiring time in an offline state include:
acquiring current position information of a terminal and universal coordinated time (UTC) time corresponding to the current position information according to GPS data;
determining at least one geographical block with the distance smaller than or equal to the preset distance from the current position information according to a preset electronic map, wherein the preset electronic map comprises a plurality of geographical blocks and time zone information corresponding to each geographical block;
determining a target geographic block corresponding to the current position information according to at least one geographic block;
determining a target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographic block;
and determining the target time corresponding to the terminal according to the target time zone and the UTC time.
Optionally, the step of determining at least one geographical area with a distance from the current location information less than or equal to a preset distance according to a preset electronic map includes:
calculating a target adjacent point corresponding to the current position information according to a k-d tree algorithm;
and determining the geographic block corresponding to the target adjacent point as at least one geographic block with the distance from the current position information smaller than or equal to a preset distance.
Optionally, the step of calculating the target adjacent point corresponding to the current position information according to a preset algorithm includes:
acquiring a k-d tree model and a data set corresponding to the preset electronic map;
acquiring a search path according to the current position information and the k-d tree model, and tracing back a subspace corresponding to the search path based on a leaf node corresponding to the search path so as to acquire a data point with the minimum distance with the current position information from the data set;
determining the position of the data point with the minimum distance as a first adjacent point, adopting other data points except the data point corresponding to the first adjacent point to update the data set, and returning to execute the steps of acquiring a search path according to the current position information and the k-d tree model and tracing back a subspace corresponding to the search path based on a leaf node corresponding to the search path so as to acquire a second adjacent point from the updated data set;
sequentially updating the data set and acquiring adjacent points to acquire an Nth adjacent point;
and determining the first adjacent point, the second adjacent point and the Nth adjacent point as the target adjacent point.
Optionally, the step of acquiring a target geographic region of at least one geographic region comprises:
acquiring a geographic block identifier corresponding to the geographic block, and acquiring polygon data corresponding to the geographic block according to the geographic block identifier;
determining target polygon data containing the current position information according to the polygon data;
and determining the geographic block corresponding to the target polygon data as the target geographic block.
Optionally, the step of determining the target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographic area block includes:
acquiring a time zone corresponding to the target time zone information;
and determining the time zone as a target time zone corresponding to the terminal.
Optionally, the terminal includes a GPS data receiving module, and the step of acquiring current location information of the terminal and universal coordinated time (UTC) time corresponding to the current location information according to GPS data includes:
acquiring GPS data acquired by the GPS data receiving module;
and analyzing the GPS data to acquire the current position information and the UTC time.
Optionally, the step of determining the target time corresponding to the mobile terminal according to the target time zone and the UTC time includes:
acquiring a reference time zone corresponding to the UTC time;
obtaining a time zone difference according to the target time zone and the reference time zone;
and determining the target time according to the time zone difference and the UTC time.
In addition, to achieve the above object, the present application also provides a terminal including: the time zone acquisition method comprises the steps of a memory, a processor and an offline time acquisition program which is stored in the memory and can be operated on the processor, wherein the offline time zone acquisition program is executed by the processor.
Optionally, the terminal further comprises a GPS data receiving module.
In addition, in order to achieve the above object, the present application also provides a storage medium having stored thereon a program for acquiring time in an offline state, which when executed by a processor, implements the steps of the method for acquiring time in an offline state as described above.
Alternatively, the storage medium may be a computer-readable storage medium.
According to the method, the terminal and the storage medium for acquiring the time in the off-line state, the electronic map is preset, the electronic map comprises a plurality of geographic blocks and time zone information corresponding to each geographic block, after GPS data are acquired through the terminal in the off-line state, the current position information and UTC time of the terminal are acquired according to the GPS data, at least one geographic block with the distance smaller than or equal to the preset distance from the current position information is further determined according to the current position information, the target geographic block corresponding to the current position information is further determined from the at least one geographic block, the target time zone corresponding to the terminal is further determined according to the target geographic block, and the target time corresponding to the terminal is further determined according to the target time zone and the UTC time, so that the problem that the terminal cannot acquire the time in the off-line state is solved.
Drawings
FIG. 1 is a schematic diagram of a terminal structure of a hardware operating environment according to an embodiment of the present application;
FIG. 2 is a flowchart of a first embodiment of a method for obtaining time in an offline state according to the present application;
fig. 3 is a schematic diagram of a refinement flow of step S20 of the first embodiment of the method for obtaining time in an offline state according to the present application;
fig. 4 is a schematic diagram of a refinement flow of step S21 of the first embodiment of the method for obtaining time in an offline state according to the present application;
FIG. 5 is a diagram illustrating a first example of a k-d tree model for a time zone acquisition method in an offline state according to the present application;
FIG. 6 is a detailed flowchart of step S30 of the first embodiment of the method for obtaining a time zone in an offline state according to the present application;
FIG. 7 is a flowchart illustrating a method for obtaining a time zone in an offline state according to the present application.
The achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The main solutions of the embodiments of the present application are: acquiring current position information of a terminal according to GPS data and UTC time corresponding to the current position information; determining at least one geographical block with the distance smaller than or equal to the preset distance from the current position information according to a preset electronic map, wherein the preset electronic map comprises a plurality of geographical blocks and time zone information corresponding to each geographical block; determining a target geographic block corresponding to the current position information according to at least one geographic block; determining a target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographic block; and determining the target time corresponding to the terminal according to the target time zone and the UTC time.
As shown in fig. 1, fig. 1 is a schematic diagram of a terminal structure of a hardware running environment according to an embodiment of the present application.
The terminal of the embodiment of the application can be a PC, or can be a mobile terminal device with a display function, such as a smart phone, a tablet personal computer, an electronic book reader, an MP3 (Moving Picture Experts Group Audio Layer III, dynamic image expert compression standard audio layer 3) player, an MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert compression standard audio layer 3) player, a portable computer and the like.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Optionally, the terminal may further include a GPS data receiving module, for collecting GPS data of the terminal, where the GPS receiving module may be a GPS chip.
Optionally, the terminal may further include a GPS data parsing module, configured to parse the GPS data collected by the GPS data receiving module, so as to obtain current location information corresponding to the GPS data and UTC time, where the current location information includes longitude and latitude coordinate values of the terminal, and the UTC time includes time, minutes, seconds, optionally, the UTC time includes year, month, and day.
Optionally, the terminal may also include a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and so on. Among other sensors, such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display screen according to the brightness of ambient light, and a proximity sensor that may turn off the display screen and/or the backlight when the mobile terminal moves to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and the direction when the mobile terminal is stationary, and the mobile terminal can be used for recognizing the gesture of the mobile terminal (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; of course, the mobile terminal may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, which are not described herein.
It will be appreciated by those skilled in the art that the terminal structure shown in fig. 1 is not limiting of the terminal and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a time acquisition program in an offline state may be included in a memory 1005 as one type of computer storage medium.
In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a background server and performing data communication with the background server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call the acquisition program of the time in the offline state stored in the memory 1005, and perform the following operations:
acquiring current position information of a terminal and universal coordinated time (UTC) time corresponding to the current position information according to GPS data;
determining at least one geographical block with the distance smaller than or equal to the preset distance from the current position information according to a preset electronic map, wherein the preset electronic map comprises a plurality of geographical blocks and time zone information corresponding to each geographical block;
determining a target geographic block corresponding to the current position information according to at least one geographic block;
determining a target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographic block;
and determining the target time corresponding to the terminal according to the target time zone and the UTC time.
Further, the processor 1001 may call the acquisition program of the time in the offline state stored in the memory 1005, and further perform the following operations:
calculating a target adjacent point corresponding to the current position information according to a k-d tree algorithm;
and determining the geographic block corresponding to the target adjacent point as at least one geographic block with the distance from the current position information smaller than or equal to a preset distance.
Further, the processor 1001 may call the acquisition program of the time in the offline state stored in the memory 1005, and further perform the following operations:
acquiring a k-d tree model and a data set corresponding to the preset electronic map;
acquiring a search path according to the current position information and the k-d tree model, and tracing back a subspace corresponding to the search path based on a leaf node corresponding to the search path so as to acquire a data point with the minimum distance with the current position information from the data set;
determining the position of the data point with the minimum distance as a first adjacent point, adopting other data points except the data point corresponding to the first adjacent point to update the data set, and returning to execute the steps of acquiring a search path according to the current position information and the k-d tree model and tracing back a subspace corresponding to the search path based on a leaf node corresponding to the search path so as to acquire a second adjacent point from the updated data set;
sequentially updating the data set and acquiring adjacent points to acquire an Nth adjacent point;
and determining the first adjacent point, the second adjacent point and the Nth adjacent point as the target adjacent point.
Further, the processor 1001 may call the acquisition program of the time in the offline state stored in the memory 1005, and further perform the following operations:
acquiring a geographic block identifier corresponding to the geographic block, and acquiring polygon data corresponding to the geographic block according to the geographic block identifier;
determining target polygon data containing the current position information according to the polygon data;
and determining the geographic block corresponding to the target polygon data as the target geographic block.
Further, the processor 1001 may call the acquisition program of the time in the offline state stored in the memory 1005, and further perform the following operations:
acquiring a time zone corresponding to the target time zone information;
and determining the time zone as a target time zone corresponding to the terminal.
Further, the processor 1001 may call the acquisition program of the time in the offline state stored in the memory 1005, and further perform the following operations:
acquiring GPS data acquired by the GPS data receiving module;
and analyzing the GPS data to acquire the current position information and the UTC time.
Further, the processor 1001 may call the acquisition program of the time in the offline state stored in the memory 1005, and further perform the following operations:
acquiring a reference time zone corresponding to the UTC time;
obtaining a time zone difference according to the target time zone and the reference time zone;
and determining the target time according to the time zone difference and the UTC time.
Referring to fig. 2, a first embodiment of a method for acquiring time in an offline state according to the present application provides a method for acquiring time in an offline state, where the method for acquiring time in an offline state includes:
step S10, acquiring current position information of a terminal and universal coordinated time (UTC) time corresponding to the current position information according to GPS data;
step S20, determining at least one geographical area block with the distance smaller than or equal to the preset distance from the current position information according to a preset electronic map, wherein the preset electronic map comprises a plurality of geographical area blocks and time zone information corresponding to each geographical area block;
step S30, determining a target geographic block corresponding to the current position information according to at least one geographic block;
step S40, determining a target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographic block;
and S50, determining the target time corresponding to the terminal according to the target time zone and the UTC time.
In this embodiment, the method is applied to a terminal, where the terminal includes a GPS data receiving module and a GPS data parsing module, and the step S10 includes:
acquiring GPS data acquired by the GPS data receiving module;
and analyzing the GPS data to acquire the current position information and the UTC time.
Optionally, the GPS receiving module includes a GPS chip, and when the terminal is in an offline state, the GPS chip is triggered to acquire GPS data, and the GPS data is sent to the GPS data analyzing module, so that the GPS data analyzing module analyzes the GPS data after receiving the GPS data, so as to acquire current location information of the terminal and the UTC time.
Optionally, the current location information includes longitude and latitude representing a location where the terminal is located, and the UTC time includes year, month, day, hour, minute and second corresponding to the current location information.
Optionally, the preset electronic map includes a plurality of geographic blocks and time zone information corresponding to each geographic block, where the geographic blocks include corresponding geographic block identifiers, and the time zone information includes time zones and time zone codes, for example: the geographic area mark corresponding to the geographic area A is as follows: the time zone information corresponding to the geographic area A is the east-eighth area, the time zone code is +8, it can be understood that the geographic area corresponds to one time zone information one by one, the time zone information corresponding to different geographic areas can be the same or different, and the geographic areas correspond to one geographic area identifier one by one.
Optionally, after the current position information is acquired, the preset electronic map is called, the target geographic area block corresponding to the current position information is determined according to the preset electronic map, then the time zone information corresponding to the target geographic area block is determined to be the target time zone corresponding to the current position information, and then the target time zone corresponding to the terminal is determined according to the target time zone, and optionally, the target geographic area block comprises the current position information.
It may be appreciated that, if the preset map includes a plurality of geographic blocks, the current location information is matched with the geographic blocks one by one to obtain a target geographic block, and the step is too complicated, and the time for obtaining a time zone is too long.
Optionally, referring to fig. 3, the step S20 includes:
s21, calculating a target adjacent point corresponding to the current position information according to a k-d tree algorithm;
step S22, determining the geographic area corresponding to the target neighboring point as at least one geographic area with a distance from the current position information smaller than or equal to a preset distance.
Alternatively, a k-d tree (i.e., an abbreviation of a k-dimension 1 tree) is a tree data structure that stores example points in k-dimensional space to facilitate quick retrieval thereof, and may be used for searching of multi-dimensional space key data, such as a range search and a nearest neighbor search.
Optionally, referring to fig. 4, an embodiment of the present application proposes a method for calculating a target neighboring point corresponding to the current location information according to a k-d tree algorithm, where the S21 includes:
step S211, a k-d tree model and a data set corresponding to the preset electronic map are obtained;
step S212, acquiring a search path according to the current position information and the k-d tree model, and backtracking a subspace corresponding to the search path based on a leaf node corresponding to the search path, so as to acquire a data point with the minimum distance from the current position information from the data set;
step S213, determining the position of the data point with the minimum distance as a first adjacent point, updating the data set by adopting other data points except the data point corresponding to the first adjacent point, and returning to execute the steps of acquiring a search path according to the current position information and the k-d tree model and tracing back a subspace corresponding to the search path based on a leaf node corresponding to the search path so as to acquire a second adjacent point from the updated data set;
step S214, updating the data set and acquiring the neighboring points in order to acquire the nth neighboring point.
And step S215, determining the first adjacent point, the second adjacent point and the Nth adjacent point as the target adjacent point.
Optionally, the data set includes a plurality of data points, the data points may be configured in a self-defining manner, the data points may be cities corresponding to each geographic area, one data point represents one city, the data points may also be a plurality of data points marked with a preset interval in an area corresponding to each geographic area, the data points may also be block centers corresponding to each geographic area, each block center is determined as the data point, the data points are bound with each geographic area, such as data point a, and the bound geographic area is geographic area 1.
It is understood that the data points include corresponding longitudes and latitudes, and that different data points correspond to different longitudes and latitudes.
Optionally, after each data point in the data set is acquired, establishing a k-d tree model corresponding to the data set according to the data point, and establishing a corresponding k-d tree model based on the data set by the following steps: calculating variance values of the data points in each dimension by using a variance value calculation formula, sorting the variance values in a descending order, determining a dimension corresponding to the maximum variance value in the variance values as a segmentation dimension, sorting the data sets according to attribute values of the segmentation dimension, determining data points in intermediate positions after sorting as root nodes, further determining a hyper-rectangular plane passing through the root nodes and perpendicular to the segmentation dimension as a segmentation plane for currently dividing the data set, dividing the data set into a left subspace and a right subspace according to the segmentation plane, further obtaining data points in the left subspace and the right subspace, further determining the root nodes corresponding to the left subspace and the root nodes corresponding to the right subspace according to the mode, further, the root node corresponding to the left subspace is determined as a first left sub-node, the root node corresponding to the right sub-space is determined as a first right sub-node, the first left sub-node and the first right sub-node are determined as a first sub-node, further, the segmentation is continued, a second sub-node and a third sub-node are obtained until an N sub-node is obtained, the N sub-node is determined as a leaf node, further, the root node, the first sub-node and the second sub-node are obtained, the third sub-node and the leaf node generate the k-d tree model, as shown in fig. 5, fig. 5 shows an example diagram of the k-d tree model, it can be understood that the root node is obtained by first partitioning, the root node is taken as a current node by second partitioning, the first sub-node is obtained based on the root node, the third sub-node is taken as a current node by third partitioning, the third sub-node is obtained based on the first sub-node, the last division takes the N-1 sub-node as the current node, the leaf node is obtained based on the N-1 sub-node, the dividing dimension of each division of the data set can be different, the data set can be determined according to the data point of the data set, the dividing plane of each division corresponds to the dividing dimension one by one, and the dividing plane is a hyper-rectangular plane passing through the current node and perpendicular to the dividing dimension.
Optionally, in actual operation, after the current position information is acquired, the k-d tree model is invoked, and then a search path is acquired according to the current position information and the k-d tree model, specifically, the current position information is accessed downwards from the root node, the comparison result of the current position information and each node is accessed along the k-d tree model until a leaf node is reached, wherein the comparison result of the current position information and each node is acquired, the value of the current position information corresponding to the segmentation dimension in the current node is compared with the value of the current node, if the value of the current position information corresponding to the segmentation dimension in the current node is smaller than the value of the current node, the node corresponding to the left subspace is accessed, and if the value of the current position information corresponding to the segmentation dimension in the current node is greater than the value of the current node, the node corresponding to the right subspace is accessed. And after the leaf nodes are reached, determining the root node and each node accessed by the current position information as a search path. For example, the search path may be "root node-first left child node-second left child node-leaf node a.
Optionally, after the search path is acquired, determining the distance between the leaf node and the current position information as a minimum distance, and tracing back the subspace corresponding to the search path based on the leaf node corresponding to the search path, so as to determine whether a data point with a distance smaller than the minimum distance from the current position information exists in the data points of the subspace which is not accessed by the current position information, thereby acquiring the data point with the minimum distance between the data set and the current position information.
It will be appreciated that if the current location information is at the edge of a geographic area, the data point with the smallest distance may not be in the geographic area, but in other geographic areas close to the geographic area, and based on this, the present application, when acquiring the data point with the smallest distance, loops to acquire data points with the smallest distance except for the data point with the smallest distance, so as to acquire a plurality of data points. It will be appreciated that the distance of the acquired data point from the current location information is much smaller than the distance of the data point other than the acquired data point from the current location information.
Optionally, when the data point with the minimum distance is acquired, determining the position of the data point with the minimum distance as a first adjacent point, updating the data set by adopting other data points except the data point corresponding to the first adjacent point, and further returning to execute the steps of acquiring a search path according to the current position information and the k-d tree model and backtracking a subspace corresponding to the search path based on a leaf node corresponding to the search path, so as to acquire the data point with the minimum distance from the updated data set, and further determining the position of the data point with the minimum distance as a second adjacent point.
Optionally, and by analogy, the third neighbor is acquired in the following manner: and updating the data set again by adopting other data points except the data point corresponding to the second neighbor point, wherein it can be understood that the data point after updating again does not comprise the data point corresponding to the first neighbor point nor the data point corresponding to the second neighbor point, further, the step of acquiring a search path according to the current position information and the k-d tree model according to the data set after updating again is performed, and the subspace corresponding to the search path is traced back forward based on the leaf node corresponding to the search path, so that the data point with the minimum distance from the current position information is determined from the data set which does not comprise the data points corresponding to the first neighbor point and the second neighbor point, and the position where the data point with the minimum distance is located is determined as the third neighbor point.
Optionally, and the like, the data set is updated and the adjacent point is acquired in sequence, so as to acquire the nth adjacent point, wherein N can be 4, and also can be 5,N, and the numerical value can be configured in a self-defining way.
Optionally, after the first adjacent point, the second adjacent point and the nth adjacent point are acquired, determining the first adjacent point, the second adjacent point and the nth adjacent point as the target adjacent point.
Optionally, after the target adjacent points are obtained, determining a geographic block corresponding to each target adjacent point according to the data point corresponding to the target adjacent point, where the geographic block corresponding to the target adjacent point is a geographic block containing the position where the target adjacent point is located, and it is understood that the target adjacent points corresponding to each target adjacent point may be the same or different, for example, the position where the first adjacent point is located is in the geographic block a, the position where the second adjacent point is located is in the geographic block B, and the positions where the third adjacent point to the nth adjacent point are all located in the geographic block C.
Optionally, after the geographic block corresponding to the target adjacent point is obtained, based on the fact that the distance between the target adjacent point and the current position information is smaller than the data points except the target adjacent point, the distance between the geographic block corresponding to the target adjacent point and the current position information is further determined to be smaller than or equal to a preset distance, and the geographic block corresponding to the target adjacent point is further determined to be at least one geographic block with the distance between the geographic block corresponding to the target adjacent point and the current position information being smaller than or equal to the preset distance.
Optionally, in another embodiment, the method of obtaining at least one geographical area with a distance from the current location information being less than or equal to a preset distance may further be that a block center corresponding to each geographical area is obtained, and then a distance between each block center and the current location information is obtained, and then a block center with a distance from the current location information being less than or equal to a preset distance is selected according to the distance, and then a geographical area corresponding to the selected block center is determined as the at least one geographical area with a distance from the current location information being less than or equal to a preset distance, and optionally, the preset distance may be set by a user.
Optionally, at least one geographical area with a distance smaller than or equal to a preset distance from the current position information is obtained, and the target geographical area corresponding to the current position information is determined according to at least one geographical area. Optionally, the geographic blocks are in one-to-one correspondence with polygon data, the polygon data are used for representing latitude and longitude ranges included in the geographic blocks, after each geographic block is obtained, the polygon data corresponding to the geographic block can be obtained, and further a target geographic block is determined according to the polygon data, and the current position information is included in a polygon area surrounded by the polygon data corresponding to the target geographic block, based on this, referring to fig. 6, the step S30 includes:
step S31, obtaining a geographic block identifier corresponding to the geographic block, and obtaining polygon data corresponding to the geographic block according to the geographic block identifier;
step S32, determining target polygon data containing the current position information according to the polygon data;
and step S33, determining the geographic block corresponding to the target polygon data as the target geographic block.
Optionally, the preset map further includes each geographic block and a geographic block identifier corresponding to each geographic block, where one geographic block corresponds to one geographic block identifier.
Optionally, the preset map further includes polygon data corresponding to each geographic block identifier, the geographic block identifiers are in one-to-one correspondence with the polygon data, and the polygon data includes longitude and latitude ranges corresponding to the geographic blocks.
Optionally, after at least one geographical block is acquired, acquiring geographical block identifiers corresponding to the geographical blocks, acquiring polygon data corresponding to the geographical blocks, and determining the polygon data as polygon data corresponding to the geographical blocks.
Optionally, after the polygon data are acquired, acquiring latitude and longitude ranges corresponding to the polygon data, further judging a comparison between the latitude and longitude corresponding to the current position information and the latitude and longitude ranges corresponding to the polygon data, and further acquiring target polygon data containing the current position information in the polygon data.
Optionally, after the target polygon data is acquired, determining a geographic block corresponding to the target polygon data as the target geographic block.
Optionally, after the target geographic area is acquired, the step S40 includes:
acquiring a time zone corresponding to the target time zone information;
and determining the time zone as a target time zone corresponding to the terminal.
Optionally, after the target geographic area is obtained, determining target time zone information corresponding to the target geographic area according to the preset electronic map, where the target time zone information includes a time zone corresponding to the target geographic area and a time zone identifier, and determining the time zone as a target time zone corresponding to the terminal.
Optionally, referring to fig. 7, after the target time zone corresponding to the terminal is acquired, step S50 includes:
step S51, obtaining a reference time zone corresponding to the UTC time;
step S52, obtaining a time zone difference according to the target time zone and the reference time zone;
step S53, determining the target time according to the time zone difference and the UTC time.
Optionally, the reference time zone corresponding to UTC is time zone 0, and the time zone difference is the difference value of the target time zone and the time zone 0.
Optionally, after the time zone difference is obtained, adding the UTC time to the time zone difference to obtain the target time, where the target time is a local time in a time zone where the terminal is located.
In the embodiment of the application, when a terminal in an offline state needs to acquire time zone information, a GPS data receiving module is triggered to acquire GPS data and a GPS data analyzing module is triggered to analyze the GPS data so as to acquire current position information and UTC time of the terminal, a target adjacent point of the current position information in the preset electronic map is determined through a k-d tree algorithm, at least one geographical block with the distance smaller than or equal to a preset distance is determined according to a geographical block corresponding to the target adjacent point, a target geographical block comprising the current position information is screened from the at least one geographical block, a target time zone corresponding to the target geographical block is determined, and a target time zone corresponding to the terminal is determined.
In addition, the embodiment of the present application also proposes a computer-readable storage medium, on which a time acquisition program in an offline state is stored, which when executed by a processor, implements the steps of the embodiments described above.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the application, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (7)

1. The method for acquiring the time in the off-line state is characterized by being applied to a terminal, and comprises the following steps:
acquiring current position information of a terminal according to GPS data and UTC time of world coordination corresponding to the current position information;
the preset electronic map comprises a plurality of geographic blocks and time zone information corresponding to each geographic block, and a k-d tree model and a data set corresponding to the preset electronic map are obtained;
acquiring a search path according to the current position information and the k-d tree model, and tracing back a subspace corresponding to the search path based on a leaf node corresponding to the search path so as to acquire a data point with the minimum distance with the current position information from the data set, wherein the data point is a block center corresponding to each geographic block;
determining the position of the data point with the minimum distance as a first adjacent point, adopting other data points except the data point corresponding to the first adjacent point to update the data set, returning to execute the steps of acquiring a search path according to the current position information and the k-d tree model, and backtracking a subspace corresponding to the search path based on a leaf node corresponding to the search path to acquire a second adjacent point from the updated data set;
sequentially updating the data set and acquiring adjacent points to acquire an Nth adjacent point;
determining the first adjacent point, the second adjacent point and the Nth adjacent point as target adjacent points;
determining a geographic block corresponding to the target adjacent point as at least one geographic block with the distance from the current position information smaller than or equal to a preset distance;
determining a target geographic block corresponding to the current position information according to at least one geographic block;
determining a target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographic block;
and determining the target time corresponding to the terminal according to the target time zone and the UTC time.
2. The method of claim 1, wherein the step of determining the target geographic area corresponding to the current location information according to at least one geographic area comprises:
acquiring a geographic block identifier corresponding to the geographic block, and acquiring polygon data corresponding to the geographic block according to the geographic block identifier;
determining target polygon data containing the current position information according to the polygon data;
and determining the geographic block corresponding to the target polygon data as the target geographic block.
3. The method of claim 1, wherein the step of determining the target time zone corresponding to the terminal according to the target time zone information corresponding to the target geographical area comprises:
acquiring a time zone corresponding to the target time zone information;
and determining the time zone as a target time zone corresponding to the terminal.
4. The method for acquiring time in an offline state according to claim 1, wherein the terminal includes a GPS data receiving module, and the step of acquiring current location information of the terminal and universal coordinated time (UTC) time corresponding to the current location information according to the GPS data includes:
acquiring GPS data acquired by the GPS data receiving module;
and analyzing the GPS data to acquire the current position information and the UTC time.
5. The method for obtaining time in an offline state as claimed in claim 1, wherein the step of determining the target time corresponding to the mobile terminal according to the target time zone and the UTC time comprises:
acquiring a reference time zone corresponding to the UTC time;
obtaining a time zone difference according to the target time zone and the reference time zone;
and determining the target time according to the time zone difference and the UTC time.
6. A terminal, the terminal comprising: memory, a processor and an off-line time acquisition program stored on the memory and executable on the processor, which off-line time zone acquisition program, when executed by the processor, implements the steps of the off-line time acquisition method of any one of claims 1 to 5.
7. A storage medium, wherein the storage medium has stored thereon a program for acquiring time in an offline state, the program for acquiring time in an offline state, when executed by a processor, implementing the steps of the method for acquiring time in an offline state according to any one of claims 1 to 5.
CN202111497297.3A 2021-12-08 2021-12-08 Method, terminal and storage medium for acquiring time in offline state Active CN114415492B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111497297.3A CN114415492B (en) 2021-12-08 2021-12-08 Method, terminal and storage medium for acquiring time in offline state

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111497297.3A CN114415492B (en) 2021-12-08 2021-12-08 Method, terminal and storage medium for acquiring time in offline state

Publications (2)

Publication Number Publication Date
CN114415492A CN114415492A (en) 2022-04-29
CN114415492B true CN114415492B (en) 2023-12-08

Family

ID=81266383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111497297.3A Active CN114415492B (en) 2021-12-08 2021-12-08 Method, terminal and storage medium for acquiring time in offline state

Country Status (1)

Country Link
CN (1) CN114415492B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5968109A (en) * 1996-10-25 1999-10-19 Navigation Technologies Corporation System and method for use and storage of geographic data on physical media
CN102340567A (en) * 2010-07-20 2012-02-01 上海闻泰电子科技有限公司 Mobile phone and method for automatically setting time according to positioning of global positioning system (GPS)
CN103140739A (en) * 2010-12-20 2013-06-05 三菱电机株式会社 Map display device and navigation device
US8983494B1 (en) * 2013-02-08 2015-03-17 Urban Airship, Inc. Processing location information
CN104714405A (en) * 2013-12-13 2015-06-17 上海晨兴希姆通电子科技有限公司 GSM module, mobile terminal comprising GSM module and automatic time calibration method
CN106446102A (en) * 2016-09-13 2017-02-22 腾讯征信有限公司 Method and device for terminal positioning based on map fences
WO2018126867A1 (en) * 2017-01-03 2018-07-12 中兴通讯股份有限公司 Method and device for determining serving satellite, terminal, and storage medium
CN108351618A (en) * 2015-10-31 2018-07-31 微软技术许可有限责任公司 Automatic time zone detection in equipment
CN109104261A (en) * 2018-09-28 2018-12-28 深圳高新兴物联科技有限公司 Local zone time acquisition methods, terminal and storage medium based on LBS
CN110943796A (en) * 2019-11-19 2020-03-31 深圳市道通智能航空技术有限公司 Timestamp alignment method, timestamp alignment device, storage medium and equipment
CN113009816A (en) * 2021-03-08 2021-06-22 北京信息科技大学 Method and device for determining time synchronization error, storage medium and electronic device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9645247B2 (en) * 2014-07-25 2017-05-09 General Motors Llc Fast estimation of UTC time in a mobile device using GNSS
US10587704B2 (en) * 2015-04-14 2020-03-10 International Business Machines Corporation Location accurate mobile events and social content
CN105911860A (en) * 2016-04-25 2016-08-31 惠州Tcl移动通信有限公司 Time zone automatic updating method of bluetooth watch and time zone automatic updating system thereof

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5968109A (en) * 1996-10-25 1999-10-19 Navigation Technologies Corporation System and method for use and storage of geographic data on physical media
CN102340567A (en) * 2010-07-20 2012-02-01 上海闻泰电子科技有限公司 Mobile phone and method for automatically setting time according to positioning of global positioning system (GPS)
CN103140739A (en) * 2010-12-20 2013-06-05 三菱电机株式会社 Map display device and navigation device
US8983494B1 (en) * 2013-02-08 2015-03-17 Urban Airship, Inc. Processing location information
CN104714405A (en) * 2013-12-13 2015-06-17 上海晨兴希姆通电子科技有限公司 GSM module, mobile terminal comprising GSM module and automatic time calibration method
CN108351618A (en) * 2015-10-31 2018-07-31 微软技术许可有限责任公司 Automatic time zone detection in equipment
CN106446102A (en) * 2016-09-13 2017-02-22 腾讯征信有限公司 Method and device for terminal positioning based on map fences
WO2018126867A1 (en) * 2017-01-03 2018-07-12 中兴通讯股份有限公司 Method and device for determining serving satellite, terminal, and storage medium
CN109104261A (en) * 2018-09-28 2018-12-28 深圳高新兴物联科技有限公司 Local zone time acquisition methods, terminal and storage medium based on LBS
CN110943796A (en) * 2019-11-19 2020-03-31 深圳市道通智能航空技术有限公司 Timestamp alignment method, timestamp alignment device, storage medium and equipment
CN113009816A (en) * 2021-03-08 2021-06-22 北京信息科技大学 Method and device for determining time synchronization error, storage medium and electronic device

Also Published As

Publication number Publication date
CN114415492A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
CN108960785B (en) Information prompting method and device
CN111259840A (en) Land occupation early warning method, device, equipment and storage medium
CN110399445B (en) Method, device and equipment for processing interest points
KR20100068468A (en) Method, apparatus and computer program product for performing a visual search using grid-based feature organization
CN105635956B (en) One kind is based on indoor virtually target localization method and device
CA2751729C (en) Method and apparatus for generating and using location information
CN113822460A (en) Traffic flow prediction method and device, electronic equipment and storage medium
CN109688535B (en) Method, device, electronic equipment and medium for determining geographic position of wireless hotspot
CN111757464A (en) Region contour extraction method and device
CA3154877A1 (en) System and method for identifying a disease affected area
CN111209487A (en) User data analysis method, server, and computer-readable storage medium
CN112381078B (en) Elevated-based road identification method, elevated-based road identification device, computer equipment and storage medium
CN109996178B (en) Positioning method, apparatus, device and medium
CN107295105B (en) Child behavior analysis method, terminal device and computer-readable storage medium
CN114415492B (en) Method, terminal and storage medium for acquiring time in offline state
CN115841575A (en) Key point detection method, device, electronic apparatus, storage medium, and program product
CN110392115B (en) Block chain node management method, device and readable storage medium
CN109640272B (en) Positioning method and mobile terminal
CN116668580B (en) Scene recognition method, electronic device and readable storage medium
KR20140134430A (en) Device and method for recommending location
CN112235723B (en) Positioning method, positioning device, electronic equipment and computer readable storage medium
CN112798005B (en) Road data processing method and related device
CN110672086A (en) Scene recognition method, device, equipment and computer readable medium
CN114328774A (en) Method for acquiring time zone in offline state, terminal and computer readable storage medium
KR20140134431A (en) Device and method for recommending location using poi

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant