CN102497665B - Mobile terminal time correction method and apparatus thereof - Google Patents
Mobile terminal time correction method and apparatus thereof Download PDFInfo
- Publication number
- CN102497665B CN102497665B CN201110448342.6A CN201110448342A CN102497665B CN 102497665 B CN102497665 B CN 102497665B CN 201110448342 A CN201110448342 A CN 201110448342A CN 102497665 B CN102497665 B CN 102497665B
- Authority
- CN
- China
- Prior art keywords
- time
- data
- standard time
- standard
- error
- 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.)
- Expired - Fee Related
Links
Landscapes
- Electric Clocks (AREA)
Abstract
The invention belongs to a mobile terminal technology field and especially relates to a mobile terminal time correction method and an apparatus thereof. The mobile terminal time correction method comprises the following steps: step a. acquiring a certain amount of standard time data in fixed interval time in a certain period; step b. acquiring system time data corresponding to the each standard time data and calculating current standard time according to an error value of the standard time data and the system time data; step c. updating system time according to the standard time and storing the current standard time data. According to the invention, mobile phone real time clock (RTC) time can be corrected according to an error offset size in the certain time so that the mobile phone RTC time can be guaranteed to be in an error range. In the prior art, single message time is not accurate. By using the method and the apparatus of the invention, the above problem can be avoided. Implementation of the invention does not need to be performed by manually inputting and the time data with high accuracy can be automatically obtained. The method and the apparatus can be used without the network so that usage experience can be substantially increased.
Description
Technical field
The invention belongs to technical field of mobile terminals, relate in particular to a kind of method and device of mobile terminal time adjustment.
Background technology
Along with development and the arrival in mobile Internet epoch of wireless communication technology, the mobile terminal taking mobile phone as representative is also more and more intelligent, and by abundant application software, smart mobile phone is exactly a microcomputer.No matter be operation system of smart phone or the types of applications program of moving under the support of operating system, the date format that can provide by system or application, time format are directly quoted processing and the record that date, time that mobile phone timer produces realizes related data or file.In general, there is a button cell mobile phone the inside, when mobile phone shutdown or while taking off battery, thereby it is mobile phone power supply lock in time by button cell, in the time that button cell electric power reduces or exhausts, just there will be date, time parameter value make zero or set chaotic situation, cause the mobile phone time not synchronize with the standard time; The time of mobile phone source is to pass through RTC(realtimeclock in addition, real-time clock) chip provides, due to the reason of Costco Wholesale aspect, RTC chip in general mobile phone can not use clock pulse generator the most accurately, after a period of time, will show too fast or excessively slow situation by time of occurrence, produce error with the standard time, along with the prolongation of time, this error also can constantly accumulate and become large.
Along with the intelligent development of mobile phone, the function of mobile phone from strength to strength, time fail safe to mobile phone and accuracy require also more and more higher, for example, mobile payment may need to use mobile terminal to operate bank capital, if mobile terminal has extracted wrong date time parameter when contact login, may have influence on user's rights and interests; For another example, user has formulated alarm clock by mobile phone, if the mobile phone time is not accurate enough, can stop over user time, reduces user's experience.In order to address this problem, in the patent application that is 201010519952.6 at application number, receive answer short message by sending note to network side, is set correction time time of described mobile terminal by intercepting the current time of the sms center timestamp carrying in answer short message, but this method need to manually send note in the situation that having network carrys out correction time, and be subject to that network environment is unsettled to be affected, may there is larger error in the time of accepting note, therefore, the mode of this mobile terminal correction time operates inconvenience, and accuracy is not high.
Summary of the invention
The invention provides a kind of method and device of mobile terminal time adjustment, be intended to solve in prior art because the mode of mobile terminal correction time operates inconvenience and the not high problem of accuracy.
The present invention is achieved in that a kind of method of mobile terminal time adjustment, comprising:
Step a: the fixed interval in some cycles obtains a certain amount of standard time data;
Step b: obtain the system time data corresponding with each standard time data, and calculate the current standard time according to the error amount of standard time data and system time data, wherein, the circular that calculates the current standard time described in is: in the Fixed Time Interval of the system time t of real-time timepiece chip, obtain n(n>=10) individual standard time data T; Deduct corresponding RTC system time t with standard time data T and obtain error time D, calculate the adjacent poor Δ D of adjacent two error time D, judge adjacent poor Δ D12, D23 ... in D (n-1) n, whether there is particular value, if there is particular value, delete the previous error time D of particular value; If there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, the system time t of real-time timepiece chip is added to this error time D is as the current standard time; If error time D exceedes permissible value, using standard time data T directly as the current standard time, the rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value;
Step c: according to current standard time renewal RTC system time, and preserve current standard time data.
Technical scheme of the present invention also comprises: described step a also comprises: judge whether to need data correction time, if do not need data correction time, finish this correction; If need data correction time, set up network and connect, and judge whether network connects successful, if standard time data are obtained in network successful connection; If network connects not success, judge whether to continue data correction time.
Technical scheme of the present invention also comprises: in described step a, described in obtain standard time data mode comprise by page data and obtain the standard time and obtain the standard time by the short message time of carrying; Describedly obtain the standard time by page data and be specially: pull page data to client from page server or time server, and obtain standard time data by resolving the server time carrying in page data; Describedly obtain the standard time by the short message time of carrying and be specially: obtaining the time that a certain amount of short message carries obtains standard time data.
Technical scheme of the present invention also comprises: between described step a and described step b, also comprise: judge in RTC, whether there is system time data, if there is not system time data in RTC, described step b also comprises: directly using standard time data as the system standard time; If there is system time data in RTC, execution step b.
Technical scheme of the present invention also comprises: in described step b, described in calculate the circular of current standard time and be: in the Fixed Time Interval of RTC system time t, obtain n(n>=10) individual standard time data T; Deduct corresponding RTC system time t with standard time data T and obtain error time D, calculate the adjacent poor Δ D of adjacent two error time D, judge adjacent poor Δ D12, D23 ... in D (n-1) n, whether there is particular value, if there is particular value, delete the previous error time D of particular value; If there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, RTC system time t is added to this error time D is as the current standard time; If error time D exceedes permissible value, using standard time data T directly as the current standard time.
Technical scheme of the present invention also comprises: in described step a, also comprise: connect and do not have to judge whether to continue data correction time when successful at network, if continue data correction time, in described step b, also comprise: the standard time data prediction when having network goes out the current standard time; If finish data correction time, finish this correction; Wherein, predict that the current standard time is specially: computing network interrupts in data, deleting the mean value Δ D of the adjacent poor Δ D after particular value the last period; Calculate the poor Δ t of corresponding adjacent R TC system time t; Every the Δ t time, just on this RTC system time, add mean value
proofread and correct once.
Another technical scheme of the present invention, a kind of device of mobile terminal time adjustment, comprise mobile terminal, described mobile terminal also comprises standard time acquisition module, system time acquisition module, very first time computing module and time update module, and described standard time acquisition module obtains a certain amount of standard time data for the fixed interval in some cycles, described system time acquisition module is for obtaining the system time data of the RTC corresponding with each standard time data, described very first time computing module is for calculating the current standard time according to the error amount of standard time data and system time data, the method that described very first time computing module calculates the current standard time is specially: in the Fixed Time Interval of the system time t of real-time timepiece chip, obtain n(n>=10) individual standard time data T, the system time t that deducts corresponding real-time timepiece chip with standard time data T obtains error time D, calculate the adjacent poor Δ D of adjacent two error time D, judge in adjacent poor Δ D and whether have particular value, if there is particular value, delete the previous error time D of particular value, if there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, the system time t of real-time timepiece chip is added to this error time D is as the current standard time, if error time D exceedes permissible value, using standard time data T directly as the current standard time, the rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value, described time update module is used for upgrading RTC system time according to the current standard time, and preserves current standard time data.
Technical scheme of the present invention also comprises: also comprise and proofread and correct judge module, mixed-media network modules mixed-media, end judge module and the second Time Calculation module, described correction judge module is used for judging whether to need data correction time, if need data correction time, by mixed-media network modules mixed-media interconnection network; If do not need data correction time, finish to proofread and correct; Described mixed-media network modules mixed-media is used for setting up network and connects, and judges whether network connects successful, if network successful connection is obtained standard time data by standard time acquisition module; If network connects not success, judge whether to continue data correction time by finishing judge module; Described end judge module, for judge whether to continue data correction time in the time there is no network, if continue data correction time, is predicted the current standard time by the second Time Calculation module; If finish data correction time, finish this correction; Standard time data prediction when described the second Time Calculation module has network for basis goes out the current standard time.
Technical scheme of the present invention also comprises: also comprise system time judge module, described standard time acquisition module also comprises page data acquiring unit and note acquiring unit, described system time judge module is used for judging whether RTC exists system time data, if there is system time data in RTC, obtain system time data corresponding to standard time data by system time acquisition module; If there is not system time data in RTC, by very first time computing module using standard time data as the system standard time; Described page data acquiring unit is used for pulling page data to client from page server or time server, and obtains standard time data by resolving the server time carrying in page data; Described note acquiring unit is for obtaining standard time data by obtaining the time that a certain amount of short message carries.
Technical scheme of the present invention also comprises: described the second Time Calculation module is calculated the method for current standard time and is specially: computing network interrupts in data, deleting the mean value of particular value adjacent poor Δ D afterwards the last period
calculate the poor Δ t of corresponding adjacent R TC system time t; Every the Δ t time, just on this RTC system time, add mean value
proofread and correct once.
Technical scheme tool of the present invention has the following advantages or beneficial effect: the method for mobile terminal time adjustment of the present invention and device obtain multiple standard time data by the fixed interval in some cycles, and calculate the current standard time according to the error of multiple standard time data and system time datas, according to error deviation size, the mobile phone RTC time is proofreaied and correct within a certain period of time, the mobile phone RTC time is ensured within the scope of certain error, thereby avoid error amount because accumulation becomes large; The present invention can also add up by storing multiple note time datas the variable quantity of the frequency that obtains standard time and mobile phone RTC time, has avoided the inaccurate problem of standard time data that in prior art, single short message arrives not in time or unstable networks causes; Standard time data when the present invention still can utilize network in the situation that there is no network make a prediction to carry out time adjustment, problem that cannot update time while having avoided there is no network in prior art; Enforcement of the present invention need not manually be inputted, and can automatically obtain the time data that accuracy is higher, and still can use when without network, greatly promotes user's experience.
Brief description of the drawings
Accompanying drawing 1 is the flow chart of the method for the mobile terminal time adjustment of first embodiment of the invention;
Accompanying drawing 2 is flow charts of the method for the mobile terminal time adjustment of second embodiment of the invention;
Accompanying drawing 3 is fundamental diagrams that the present invention obtains the method for standard time data;
The flow chart of the computational methods of current standard time that accompanying drawing 4 is the present invention while having network;
The flow chart of the computational methods of current standard time that accompanying drawing 5 is the present invention while thering is no network;
Accompanying drawing 6 is structural representations of the device of the mobile terminal time adjustment of first embodiment of the invention;
Accompanying drawing 7 is structural representations of the device of the mobile terminal time adjustment of second embodiment of the invention.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Referring to Fig. 1, is the flow chart of the method for the mobile terminal time adjustment of first embodiment of the invention.The method of the mobile terminal time adjustment of first embodiment of the invention comprises the following steps:
Step 100: the fixed interval in some cycles obtains a certain amount of standard time data;
In step 100, the present invention can pull page data to client from page server or time server by use application software, and (resolving form is: yyyy-MM-ddHH:mm:ss) to obtain standard time data by the server time carrying in parsing page data; Wherein, owing to being the standard time data of obtaining in some cycles, therefore need to select to obtain the opportunity of standard time at every turn, because RTC(is real-time clock, effect is that the clock signal that provides stable uses to subsequent conditioning circuit, major function has: clock, calendar, alarm clock, periodic interruptions output) although seem " slowly " or " soon " with respect to the standard time, but the time that RTC provides is stable, the time in RTC of therefore can obtaining is used as obtaining the opportunity of standard time at every turn, specifically can be arranged by User Defined; In embodiment of the present invention, when a just standard time of automatic acquisition of cell phone system time interval 1h, the amount to obtain of standard time data also can be set according to different situations by user, and the amount to obtain of standard time data of the present invention is 10.
In addition, the acquisition methods of standard time data is a lot, be not limited to obtain from the time server of server, in another embodiment of the present invention, can obtain standard time data by obtaining the time that a certain amount of short message carries, the time that the time data carrying due to short message is carrier server, therefore also can in the time detecting that short message arrives, obtain time data that short message carries as the standard time at every turn, simultaneously, for fear of in prior art due to single short message arrives not in time or unstable networks causes the inaccurate problem of standard time data, the present invention be different from by intercept the single note time standard time is set, but add up the variable quantity of the frequency that obtains standard time and mobile phone RTC time by storing multiple note time datas, this is inaccurate but frequency is stable because of the mobile phone RTC time, and the time obtaining by network is accurate but unstable, may occur that some " standard time " that obtain exceedes certain amplitude because network delay changes, or network failure does not obtain standard time data, now just can give up the standard time data of this delay to avoid that the RTC time of system is updated to wrong " standard time ", specifically see also Fig. 3, it is the fundamental diagram that the present invention obtains the method for standard time data.
Step 110: obtain the system time data corresponding with each standard time data, and calculate the current standard time according to the error amount of standard time data and system time data;
In step 110, the present invention adopts ARI algorithm to calculate the current standard time, wherein, wherein, the present invention adopts ARI algorithm to calculate the current standard time, and the computational methods of current standard time are specially: in the Fixed Time Interval of RTC system time t, obtain n(n>=10) individual standard time data T, wherein, suppose that RTC system time t is respectively t1, t2 ... tn, the standard time data of obtaining be respectively T1, T2 ... Tn; Deduct corresponding RTC system time t with standard time data T and obtain error time D, that is, and D1=T1-t1, D2=T2-t2 ... Dn=Tn-tn; Calculate the adjacent poor Δ D of adjacent two error time D, suppose that Δ D is respectively D12(D12=D2-D1), D23(D23=D3-D2) ... D (n-1) n(D (n-1) n=Dn-Dn-1); Judge adjacent poor Δ D12, D23 ... in D (n-1) n, whether have particular value, if there is particular value, delete the previous error time D of particular value, if for example D56(D56=D6-D5) be particular value, delete error time D5; If there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, RTC system time t is added to this error time D is as the current standard time; If error time D exceedes permissible value, using standard time data T directly as the current standard time; Wherein, if there is particular value to illustrate that the previous error time D of this particular value is abnormal time in adjacent poor Δ D, the standard time data T that produces this error time D is wrong time data; The rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value, if for example D78-D56>=D56, D78 is particular value; Permissible value refers to that this error time is within the scope of acceptable, and in embodiment of the present invention, permissible value is set to two minutes, specifically can be arranged by User Defined.
Step 120: according to current standard time renewal RTC system time, and preserve current standard time data.
Referring to Fig. 2, is the flow chart of the method for the mobile terminal time adjustment of second embodiment of the invention.The method of the mobile terminal time adjustment of second embodiment of the invention comprises the following steps:
Step 200: judge whether to need data correction time, if need data correction time, execution step 210; If do not need data correction time, execution step 300;
In step 200, the present invention adopts a time adjustment application software, because this application software is application software independently, therefore after initial launch, can offer the flow process that user selects, if this software of user's choice for use carries out time adjustment to mobile phone, software is logined me and is taken charge of server and pull time data, if user selects, the end time proofreaies and correct.This application software also provides other services except time adjustment, the Push Service such as for example consulting, weather, therefore user also can select whether to load other services, if user selects no not influence time calibration function, if user to select be to pull more multi-page data to client, cause for fear of pull too much data simultaneously the time delays that arrives client, standard time data can have precedence over other data and independently obtain.
Step 210: set up network and connect, and judge whether network connects successful, if network successful connection, execution step 220; If network connects not success, execution step 270;
Step 220: the fixed interval in some cycles obtains several standard time data;
In step 220, the present invention can pull page data to client from page server or time server by use application software, and (resolving form is: yyyy-MM-ddHH:mm:ss) to obtain standard time data by the server time carrying in parsing page data; Wherein, owing to being the standard time data of obtaining in some cycles, therefore need to select to obtain the opportunity of standard time at every turn, because RTC(is real-time clock, effect is that the clock signal that provides stable uses to subsequent conditioning circuit, major function has: clock, calendar, alarm clock, periodic interruptions output, 32KHz clock output) although seem " slowly " or " soon " with respect to the standard time, the time that RTC provides is stable, therefore the time in RTC of can obtaining is used as obtaining the opportunity of standard time at every turn, specifically can be arranged by User Defined; In embodiment of the present invention, when a just standard time of automatic acquisition of cell phone system time interval 1h, the amount to obtain of standard time data also can be set according to different situations by user, and the amount to obtain of standard time data of the present invention is 10.
In addition, the acquisition methods of standard time data is a lot, be not limited to obtain from the time server of server, in another embodiment of the present invention, can obtain standard time data by obtaining the time that a certain amount of short message carries, the time that the time data carrying due to short message is carrier server, therefore also can in the time detecting that short message arrives, obtain time data that short message carries as the standard time at every turn, simultaneously, for fear of in prior art due to single short message arrives not in time or unstable networks causes the inaccurate problem of standard time data, the present invention be different from by intercept the single note time standard time is set, but add up the variable quantity of the frequency that obtains standard time and mobile phone RTC time by storing multiple note time datas, this is inaccurate but frequency is stable because of the mobile phone RTC time, and the time obtaining by network is accurate but unstable, may occur that some " standard time " that obtain exceedes certain amplitude because network delay changes, or network failure does not obtain standard time data, now just can give up the standard time data of this delay to avoid that the RTC time of system is updated to wrong " standard time ", specifically see also Fig. 3, it is the fundamental diagram that the present invention obtains the method for standard time data.
Step 230: storage standards time data;
Step 240: judge in RTC whether have system time data, if there is not system time data in RTC, execution step 250; If there is system time data in RTC, execution step 260;
In step 240, do not exist system time data specifically to refer to: in the time carrying out the button cell electric power reduction of lock in time for mobile terminal charging or exhaust, the system time parameter value in RTC makes zero.
Step 250: using standard time data as the system standard time, and perform step 290;
Step 260: obtain the system time data in the RTC corresponding with each standard time data, and calculate the current standard time according to the error amount of standard time data and system time data, and perform step 290;
In step 260, the present invention adopts ARI algorithm to calculate the current standard time, in order to clearly demonstrate step 260, sees also Fig. 4, the flow chart of the computational methods of current standard time that are the present invention while having network.When the present invention has network, the computational methods of current standard time comprise step:
Step 261: obtain n(n>=10 in the Fixed Time Interval of RTC system time t) individual standard time data T; Wherein, suppose that RTC system time t is respectively t1, t2 ... tn, the standard time data of obtaining be respectively T1, T2 ... Tn.
Step 262: deduct corresponding RTC system time t with standard time data T and obtain error time D, that is, and D1=T1-t1, D2=T2-t2 ... Dn=Tn-tn;
Step 263: calculate the adjacent poor Δ D of adjacent two error time D, wherein, suppose that Δ D is respectively D12(D12=D2-D1), D23(D23=D3-D2) ... D (n-1) n(D (n-1) n=Dn-Dn-1);
Step 264: judge adjacent poor Δ D12, D23 ... in D (n-1) n, whether there is particular value, if there is particular value, execution step 265; If there is no particular value, execution step 266;
In step 264, if there is particular value to illustrate that the previous error time D of this particular value is abnormal time in adjacent poor Δ D, the standard time data T that produces this error time D is wrong time data; The rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value, if for example D78-D56>=D56, D78 is particular value.
Step 265: delete the previous error time D of particular value, wherein, and if for example D56(D56=D6-D5) be particular value, delete error time D5;
Step 266: whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, execution step 267; If error time D exceedes permissible value, execution step 268;
In step 266, permissible value refers to that this error time D is in acceptable error range, and in embodiment of the present invention, permissible value is set to two minutes, specifically can be arranged by User Defined.
Step 267: RTC system time t is added to this error time D is as the current standard time;
Step 268: using standard time data T directly as the current standard time.
Step 270: judge whether to continue data correction time, if continue data correction time, execution step 280; If finish data correction time, execution step 300;
Step 280: the standard time data prediction when having network goes out the current standard time;
In step 280, standard time data when the present invention still can utilize network in the situation that there is no network make a prediction to carry out time adjustment, problem that cannot update time while having avoided there is no network in prior art, in order to clearly demonstrate step 280, see also Fig. 5, the flow chart of the computational methods of current standard time that are the present invention while thering is no network.When the present invention does not have network, the computational methods of current standard time comprise step:
Step 281: computing network interrupts deleting in data the mean value of particular value adjacent poor Δ D afterwards the last period
Step 282: the poor Δ t that calculates corresponding adjacent R TC system time t;
Step 283: every the Δ t time, just add mean value on this RTC system time
proofread and correct once;
Wherein, because the standard time data of obtaining can not be complete precise time data, the in the situation that of long-time suspension, predicated error may become and makes greatly correction time accurate relatively not, is therefore recovering after network, can solve this problem by upgrading standard time data.
Step 290: according to current standard time renewal RTC system time, and preserve current standard time data;
Step 300: finish this correction.
Referring to Fig. 6, is the structural representation of the device of the mobile terminal time adjustment of first embodiment of the invention.The device of the mobile terminal time adjustment of first embodiment of the invention comprises mobile terminal, and mobile terminal also comprises standard time acquisition module, system time acquisition module, very first time computing module and time update module, wherein,
Standard time acquisition module obtains a certain amount of standard time data for the fixed interval in some cycles; Standard time acquisition module specifically also comprises page data acquiring unit and note acquiring unit, wherein,
Page data acquiring unit is for pulling page data to client by use application software from page server or time server, and (resolving form is: yyyy-MM-ddHH:mm:ss) to obtain standard time data by the server time carrying in parsing page data; Wherein, owing to being the standard time data of obtaining in some cycles, therefore need to select to obtain the opportunity of standard time at every turn, because RTC(is real-time clock, effect is that the clock signal that provides stable uses to subsequent conditioning circuit, major function has: clock, calendar, alarm clock, periodic interruptions output, 32KHz clock output) although seem " slowly " or " soon " with respect to the standard time, the time that RTC provides is stable, therefore the time in RTC of can obtaining is used as obtaining the opportunity of standard time at every turn, specifically can be arranged by User Defined; In embodiment of the present invention, when a just standard time of automatic acquisition of cell phone system time interval 1h, the amount to obtain of standard time data also can be set according to different situations by user, and the amount to obtain of standard time data of the present invention is 10.
Note acquiring unit is for obtaining standard time data by obtaining the time that a certain amount of short message carries, wherein, the time that the time data carrying due to short message is carrier server, therefore also can in the time detecting that short message arrives, obtain time data that short message carries as the standard time at every turn, simultaneously, for fear of in prior art due to short message arrives not in time or unstable networks causes the inaccurate problem of standard time data, the present invention be different from by intercept the single note time standard time is set, but add up the variable quantity of the frequency that obtains standard time and mobile phone RTC time by storing multiple note time datas, this is inaccurate but frequency is stable because of the mobile phone RTC time, and the time obtaining by network is accurate but unstable, may occur that some " standard time " that obtain exceedes certain amplitude because network delay changes, or network failure does not obtain standard time data, now just can give up the standard time data of this delay to avoid that the RTC time of system is updated to wrong " standard time ".
System time acquisition module is for obtaining the system time data of the RTC corresponding with each standard time data;
Very first time computing module is for calculating the current standard time according to the error amount of standard time data and system time data; Wherein, the present invention adopts ARI algorithm to calculate the current standard time, the computational methods of current standard time are specially: in the Fixed Time Interval of RTC system time t, obtain n(n>=10) individual standard time data T, wherein, suppose that RTC system time t is respectively t1, t2 ... tn, the standard time data of obtaining be respectively T1, T2 ... Tn; Deduct corresponding RTC system time t with standard time data T and obtain error time D, that is, and D1=T1-t1, D2=T2-t2 ... Dn=Tn-tn; Calculate the adjacent poor Δ D of adjacent two error time D, suppose that Δ D is respectively D12(D12=D2-D1), D23(D23=D3-D2) ... D (n-1) n(D (n-1) n=Dn-Dn-1); Judge adjacent poor Δ D12, D23 ... in D (n-1) n, whether have particular value, if there is particular value, delete the previous error time D of particular value, if for example D56(D56=D6-D5) be particular value, delete error time D5; If there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, RTC system time t is added to this error time D is as the current standard time; If error time D exceedes permissible value, using standard time data T directly as the current standard time; Wherein, if there is particular value to illustrate that the previous error time D of this particular value is abnormal time in adjacent poor Δ D, the standard time data T that produces this error time D is wrong time data; The rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value, if for example D78-D56>=D56, D78 is particular value; Permissible value refers to that this error time is within the scope of acceptable, and in embodiment of the present invention, permissible value is set to two minutes, specifically can be arranged by User Defined.
Time update module is used for upgrading RTC system time according to the current standard time, and preserves current standard time data.
Referring to Fig. 7, is the structural representation of the device of the mobile terminal time adjustment of second embodiment of the invention.The device of the mobile terminal time adjustment of second embodiment of the invention comprises mobile terminal, mobile terminal comprises proofreaies and correct judge module, mixed-media network modules mixed-media, standard time acquisition module, system time judge module, system time acquisition module, very first time computing module, end judge module, the second Time Calculation module and time update module, wherein
Proofread and correct judge module and be used for judging whether to need data correction time, if need data correction time, by mixed-media network modules mixed-media interconnection network; If do not need data correction time, finish to proofread and correct; Wherein, the present invention adopts a time adjustment application software, because this application software is application software independently, therefore after initial launch, can offer the flow process that user selects, if this software of user's choice for use carries out time adjustment to mobile phone, software is logined me and is taken charge of server and pull time data, if user selects, the end time proofreaies and correct.This application software also provides other services except time adjustment, the Push Service such as for example consulting, weather, therefore user also can select whether to load other services, if user selects no not influence time calibration function, if user to select be to pull more multi-page data to client, cause for fear of pull too much data simultaneously the time delays that arrives client, standard time data can have precedence over other data and independently obtain.
Mixed-media network modules mixed-media is used for setting up network and connects, and judges whether network connects successful, if network successful connection is obtained standard time data by standard time acquisition module; If network connects not success, judge whether to continue data correction time by finishing judge module;
Standard time acquisition module obtains several standard time data for the fixed interval in some cycles, and storage standards time data; Standard time acquisition module specifically also comprises page data acquiring unit and note acquiring unit, wherein,
Page data acquiring unit is for pulling page data to client by use application software from page server or time server, and (resolving form is: yyyy-MM-ddHH:mm:ss) to obtain standard time data by the server time carrying in parsing page data; Wherein, owing to being the standard time data of obtaining in some cycles, therefore need to select to obtain the opportunity of standard time at every turn, because RTC(is real-time clock, effect is that the clock signal that provides stable uses to subsequent conditioning circuit, major function has: clock, calendar, alarm clock, periodic interruptions output, 32KHz clock output) although seem " slowly " or " soon " with respect to the standard time, the time that RTC provides is stable, therefore the time in RTC of can obtaining is used as obtaining the opportunity of standard time at every turn, specifically can be arranged by User Defined; In embodiment of the present invention, when a just standard time of automatic acquisition of cell phone system time interval 1h, the amount to obtain of standard time data also can be set according to different situations by user, and the amount to obtain of standard time data of the present invention is 10.
Note acquiring unit is for obtaining standard time data by obtaining the time that a certain amount of short message carries, wherein, the time that the time data carrying due to short message is carrier server, therefore also can in the time detecting that short message arrives, obtain time data that short message carries as the standard time at every turn, simultaneously, for fear of in prior art due to short message arrives not in time or unstable networks causes the inaccurate problem of standard time data, the present invention be different from by intercept the single note time standard time is set, but add up the variable quantity of the frequency that obtains standard time and mobile phone RTC time by storing multiple note time datas, this is inaccurate but frequency is stable because of the mobile phone RTC time, and the time obtaining by network is accurate but unstable, may occur that some " standard time " that obtain exceedes certain amplitude because network delay changes, or network failure does not obtain standard time data, now just can give up the standard time data of this delay to avoid that the RTC time of system is updated to wrong " standard time ", specifically see also Fig. 2, it is the fundamental diagram that the present invention obtains the method for standard time data.
System time judge module is used for judging whether RTC exists system time data, if there is system time data in RTC, obtains system time data corresponding to standard time data by system time acquisition module; If there is not system time data in RTC, by very first time computing module using standard time data as the system standard time; Wherein, do not exist system time data specifically to refer to: in the time carrying out the button cell electric power reduction of lock in time for mobile terminal charging or exhaust, the system time parameter value in RTC makes zero.
System time acquisition module is for obtaining the system time data of the RTC corresponding with each standard time data;
Very first time computing module is used for calculating the current standard time according to the error amount of standard time data and system time data, and upgrades system time by time update module; Wherein, the present invention adopts ARI algorithm to calculate the current standard time, the computational methods of current standard time are specially: in the Fixed Time Interval of RTC system time t, obtain n(n>=10) individual standard time data T, wherein, suppose that RTC system time t is respectively t1, t2 ... tn, the standard time data of obtaining be respectively T1, T2 ... Tn; Deduct corresponding RTC system time t with standard time data T and obtain error time D, that is, and D1=T1-t1, D2=T2-t2 ... Dn=Tn-tn; Calculate the adjacent poor Δ D of adjacent two error time D, suppose that Δ D is respectively D12(D12=D2-D1), D23(D23=D3-D2) ... D (n-1) n(D (n-1) n=Dn-Dn-1); Judge adjacent poor Δ D12, D23 ... in D (n-1) n, whether have particular value, if there is particular value, delete the previous error time D of particular value, if for example D56(D56=D6-D5) be particular value, delete error time D5; If there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, RTC system time t is added to this error time D is as the current standard time; If error time D exceedes permissible value, using standard time data T directly as the current standard time; Wherein, if there is particular value to illustrate that the previous error time D of this particular value is abnormal time in adjacent poor Δ D, the standard time data T that produces this error time D is wrong time data; The rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value, if for example D78-D56>=D56, D78 is particular value; Permissible value refers to that this error time is within the scope of acceptable, and in embodiment of the present invention, permissible value is set to two minutes, specifically can be arranged by User Defined.
Finish judge module for judge whether to continue data correction time in the time there is no network, if continue data correction time, predict the current standard time by the second Time Calculation module; If finish data correction time, finish this correction;
Standard time data prediction when the second Time Calculation module has network for basis goes out the current standard time; Wherein, standard time data when the present invention still can utilize network in the situation that there is no network make a prediction to carry out time adjustment, problem that cannot update time while having avoided there is no network in prior art; When the present invention does not have network, the computational methods of current standard time are specially: computing network interrupts in data, deleting the mean value of particular value adjacent poor Δ D afterwards the last period
calculate the poor Δ t of corresponding adjacent R TC system time t; Every the Δ t time, just on this RTC system time, add mean value
proofread and correct once; Because the standard time data of obtaining can not be complete precise time data, the in the situation that of long-time suspension, predicated error may become and makes greatly correction time accurate relatively not, therefore recovering after network, can solve this problem by upgrading standard time data.
Time update module is used for upgrading RTC system time according to the current standard time, and preserves current standard time data.
The method of mobile terminal time adjustment of the present invention and device obtain multiple standard time data by the fixed interval in some cycles, and calculate the current standard time according to the error of multiple standard time data and system time datas, according to error deviation size, the mobile phone RTC time is proofreaied and correct within a certain period of time, the mobile phone RTC time is ensured within the scope of certain error, thereby avoid error amount because accumulation becomes large; The present invention can also add up by storing multiple note time datas the variable quantity of the frequency that obtains standard time and mobile phone RTC time, has avoided the inaccurate problem of standard time data that in prior art, single short message arrives not in time or unstable networks causes; Standard time data when the present invention still can utilize network in the situation that there is no network make a prediction to carry out time adjustment, problem that cannot update time while having avoided there is no network in prior art; Enforcement of the present invention need not manually be inputted, and can automatically obtain the time data that accuracy is higher, and still can use when without network, greatly promotes user's experience.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any amendments of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.
Claims (9)
1. a method for mobile terminal time adjustment, comprising:
Step a: the fixed interval in some cycles obtains a certain amount of standard time data;
Step b: obtain the system time data corresponding with each standard time data, and calculate the current standard time according to the error amount of standard time data and system time data, wherein, the circular that calculates the current standard time described in is: in the Fixed Time Interval of the system time t of real-time timepiece chip, obtain n (n>=10) data T of individual standard time; Deduct corresponding RTC system time t with standard time data T and obtain error time D, calculate the adjacent poor Δ D of adjacent two error time D, judge adjacent poor Δ D12, D23 ... in D (n-1) n, whether there is particular value, if there is particular value, delete the previous error time D of particular value, wherein, described adjacent poor Δ D=D (n-1) n=Dn-Dn-1; If there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, the system time t of real-time timepiece chip is added to this error time D is as the current standard time; If error time D exceedes permissible value, using standard time data T directly as the current standard time, the rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value;
Step c: according to current standard time renewal system time, and preserve current standard time data.
2. the method for mobile terminal time adjustment according to claim 1, is characterized in that, described step a also comprises: judge whether to need data correction time, if do not need data correction time, finish this correction; If need data correction time, set up network and connect, and judge whether network connects successful, if standard time data are obtained in network successful connection; If network connects not success, judge whether to continue data correction time.
3. the method for mobile terminal time adjustment according to claim 2, is characterized in that, in described step a, described in obtain standard time data mode comprise by page data and obtain the standard time and obtain the standard time by the short message time of carrying; Describedly obtain the standard time by page data and be specially: pull page data to client from page server or time server, and obtain standard time data by resolving the server time carrying in page data; Describedly obtain the standard time by the short message time of carrying and be specially: obtaining the time that a certain amount of short message carries obtains standard time data.
4. the method for mobile terminal time adjustment according to claim 1, it is characterized in that, between described step a and described step b, also comprise: judge in real-time timepiece chip, whether there is system time data, if there is not system time data in real-time timepiece chip, described step b also comprises: directly using standard time data as the system standard time; If there is system time data in real-time timepiece chip, execution step b.
5. according to the method for the mobile terminal time adjustment described in claim 2 or 4, it is characterized in that, in described step a, also comprise: connect and do not have to judge whether to continue data correction time when successful at network, if continue data correction time, in described step b, also comprise: the standard time data prediction when having network goes out the current standard time; If finish data correction time, finish this correction; Wherein, predict that the current standard time is specially: computing network interrupts in data, deleting the mean value of the adjacent poor Δ D after particular value the last period
calculate the poor Δ t of the system time t of corresponding adjacent real-time timepiece chip; Every the Δ t time, just on this RTC system time, add mean value
proofread and correct once.
6. the device of a mobile terminal time adjustment, comprise mobile terminal, it is characterized in that, described mobile terminal also comprises standard time acquisition module, system time acquisition module, very first time computing module and time update module, and described standard time acquisition module obtains a certain amount of standard time data for the fixed interval in some cycles, described system time acquisition module is for obtaining the system time data corresponding with each standard time data, described very first time computing module is for calculating the current standard time according to the error amount of standard time data and system time data, the method that described very first time computing module calculates the current standard time is specially: in the Fixed Time Interval of the system time t of real-time timepiece chip, obtain n (n>=10) data T of individual standard time, the system time t that deducts corresponding real-time timepiece chip with standard time data T obtains error time D, calculate the adjacent poor Δ D of adjacent two error time D, judge in adjacent poor Δ D and whether have particular value, if there is particular value, delete the previous error time D of particular value, wherein, described adjacent poor Δ D=D (n-1) n=Dn-Dn-1, if there is no particular value, whether error in judgement time D exceedes permissible value, if error time D does not exceed permissible value, the system time t of real-time timepiece chip is added to this error time D is as the current standard time, if error time D exceedes permissible value, using standard time data T directly as the current standard time, the rule of choosing particular value is: get adjacent poor D12, D23 ... D (n-1) n consecutive value poor, if the absolute value of this difference is more than or equal to by depreciation, this subtrahend is particular value, described time update module is used for upgrading system time according to the current standard time, and preserves current standard time data.
7. the device of mobile terminal time adjustment according to claim 6, it is characterized in that, also comprise and proofread and correct judge module, mixed-media network modules mixed-media, end judge module and the second Time Calculation module, described correction judge module is used for judging whether to need data correction time, if need data correction time, by mixed-media network modules mixed-media interconnection network; If do not need data correction time, finish to proofread and correct; Described mixed-media network modules mixed-media is used for setting up network and connects, and judges whether network connects successful, if network successful connection is obtained standard time data by standard time acquisition module; If network connects not success, judge whether to continue data correction time by finishing judge module; Described end judge module, for judge whether to continue data correction time in the time there is no network, if continue data correction time, is predicted the current standard time by the second Time Calculation module; If finish data correction time, finish this correction; Standard time data prediction when described the second Time Calculation module has network for basis goes out the current standard time.
8. the device of mobile terminal time adjustment according to claim 6, it is characterized in that, also comprise system time judge module, described standard time acquisition module also comprises page data acquiring unit and note acquiring unit, described system time judge module is used for judging whether real-time timepiece chip exists system time data, if there is system time data in real-time timepiece chip, obtain system time data corresponding to standard time data by system time acquisition module; If there is not system time data in real-time timepiece chip, by very first time computing module using standard time data as the system standard time; Described page data acquiring unit is used for pulling page data to client from page server or time server, and obtains standard time data by resolving the server time carrying in page data; Described note acquiring unit is for obtaining standard time data by obtaining the time that a certain amount of short message carries.
9. the device of mobile terminal time adjustment according to claim 7, it is characterized in that, described the second Time Calculation module is calculated the method for current standard time and is specially: computing network interrupts in data, deleting the mean value of particular value adjacent poor Δ D afterwards the last period
calculate the poor Δ t of the system time t of corresponding adjacent real-time timepiece chip; Every the Δ t time, just on the system time of this real-time timepiece chip, add mean value
proofread and correct once.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110448342.6A CN102497665B (en) | 2011-12-28 | 2011-12-28 | Mobile terminal time correction method and apparatus thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110448342.6A CN102497665B (en) | 2011-12-28 | 2011-12-28 | Mobile terminal time correction method and apparatus thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102497665A CN102497665A (en) | 2012-06-13 |
CN102497665B true CN102497665B (en) | 2014-12-03 |
Family
ID=46189442
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110448342.6A Expired - Fee Related CN102497665B (en) | 2011-12-28 | 2011-12-28 | Mobile terminal time correction method and apparatus thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102497665B (en) |
Families Citing this family (17)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103716759B (en) * | 2013-12-16 | 2016-12-07 | 西安理工大学 | Time difference assay method based on Short Message Service |
CN103973804B (en) * | 2014-05-19 | 2017-05-03 | 广东欧珀移动通信有限公司 | Method and device for setting terminal time |
CN104142840B (en) * | 2014-07-23 | 2017-12-29 | 深圳市金立通信设备有限公司 | A kind of mobile terminal |
CN104239069A (en) * | 2014-10-10 | 2014-12-24 | 南车株洲电力机车有限公司 | Engineering van time synchronization method and system |
CN104821820B (en) * | 2015-03-27 | 2017-11-17 | 深圳市振邦智能科技有限公司 | A kind of compensation method of timing |
CN105242974A (en) * | 2015-10-27 | 2016-01-13 | 广州视睿电子科技有限公司 | Time acquisition method and device |
EP3236383A1 (en) * | 2016-04-20 | 2017-10-25 | Gemalto Sa | Method for managing a real-time clock in a portable tamper-resistant device |
TWI644187B (en) * | 2016-05-06 | 2018-12-11 | 泰博科技股份有限公司 | Method, system, non-transitory computer-readable medium and computer program product for calibrating time of physiological data by communication process |
CN106712884B (en) * | 2016-11-21 | 2019-03-19 | 广州视源电子科技股份有限公司 | Time synchronization correction method and device for wearable equipment |
CN106802836A (en) * | 2017-01-17 | 2017-06-06 | 郑州云海信息技术有限公司 | A kind of method and device of detection BMC timing accuracies |
CN108075852A (en) * | 2017-11-16 | 2018-05-25 | 北京三快在线科技有限公司 | Acquisition methods, device, electronic equipment and the storage medium of network standard time |
CN108255232A (en) * | 2017-12-06 | 2018-07-06 | 中国航空工业集团公司西安航空计算技术研究所 | A kind of precision improvement method of IEEE1588 time-codes timer |
CN109743127B (en) * | 2019-01-04 | 2021-01-26 | 四川金互通科技股份有限公司 | Information code processing method, electronic equipment and storage medium |
CN111007916B (en) * | 2019-11-29 | 2021-07-06 | Tcl移动通信科技(宁波)有限公司 | Terminal device time setting method and system, storage medium and terminal device |
CN111781987B (en) * | 2020-07-08 | 2022-03-22 | Oppo广东移动通信有限公司 | Real-time clock calibration method and related device |
CN113271171A (en) * | 2021-05-14 | 2021-08-17 | 四川虹美智能科技有限公司 | Time calibration method, device and computer readable medium |
CN115499083B (en) * | 2022-11-14 | 2023-03-24 | 南京控维通信科技有限公司 | High-precision time synchronization method and system in satellite communication network |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1277683A (en) * | 1998-08-31 | 2000-12-20 | 索尼电脑娱乐公司 | Time output apparatus and time correction method |
CN1355455A (en) * | 2000-12-01 | 2002-06-26 | 神基科技股份有限公司 | Method for correcting time of computer system |
CN1622045A (en) * | 2003-11-24 | 2005-06-01 | 顺德市顺达电脑厂有限公司 | Method for calibrating real time timer |
CN1801008A (en) * | 2004-12-30 | 2006-07-12 | 昆达电脑科技(昆山)有限公司 | Automatic time correction method for electronic device |
CN1829146A (en) * | 2005-02-28 | 2006-09-06 | 富士通株式会社 | Method and apparatus for time calibration |
CN101364978A (en) * | 2007-08-10 | 2009-02-11 | 鸿富锦精密工业(深圳)有限公司 | Instant time clock precise verification system and method |
-
2011
- 2011-12-28 CN CN201110448342.6A patent/CN102497665B/en not_active Expired - Fee Related
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1277683A (en) * | 1998-08-31 | 2000-12-20 | 索尼电脑娱乐公司 | Time output apparatus and time correction method |
CN1355455A (en) * | 2000-12-01 | 2002-06-26 | 神基科技股份有限公司 | Method for correcting time of computer system |
CN1622045A (en) * | 2003-11-24 | 2005-06-01 | 顺德市顺达电脑厂有限公司 | Method for calibrating real time timer |
CN1801008A (en) * | 2004-12-30 | 2006-07-12 | 昆达电脑科技(昆山)有限公司 | Automatic time correction method for electronic device |
CN1829146A (en) * | 2005-02-28 | 2006-09-06 | 富士通株式会社 | Method and apparatus for time calibration |
CN101364978A (en) * | 2007-08-10 | 2009-02-11 | 鸿富锦精密工业(深圳)有限公司 | Instant time clock precise verification system and method |
Also Published As
Publication number | Publication date |
---|---|
CN102497665A (en) | 2012-06-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102497665B (en) | Mobile terminal time correction method and apparatus thereof | |
CN108351760B (en) | Feed service engine | |
CN105301951A (en) | Multi-source decision realization method of time synchronization system based on analytic hierarchy method | |
CN115081960B (en) | Regional hollow rate information generation method and device, electronic equipment and computer medium | |
CN109239640B (en) | Electric meter clock correction method based on average difference value | |
CN109379158A (en) | Time synchronization method, device and equipment for newly added nodes in storage cluster | |
CN112866098A (en) | Gateway time service method, device, electronic equipment and computer readable medium | |
CN108988975B (en) | Correction method and device for ammeter clock | |
CN101656753B (en) | Content synchronization method, equipment and system for dynamic content delivery | |
CN107404404B (en) | Terminal routing method based on Internet of things and Internet of things terminal | |
CN117319312B (en) | Data flow control method and device | |
CN109308219B (en) | Task processing method and device and distributed computer system | |
CN103546269A (en) | Lock-in time message screening method and device | |
CN113204516B (en) | Method and device for time synchronization of processors | |
CN115347968A (en) | BD3 high-precision time service method, system, computer equipment and medium | |
CN104218677A (en) | Method for synchronizing clocks of power distribution master stations and power distribution terminals | |
CN110391861A (en) | A kind of method and apparatus of check timer | |
US9930627B2 (en) | Metered interface | |
CN103945237A (en) | Clock synchronization method and system, digital television equipment and EPG server | |
CN113393046A (en) | Photovoltaic power prediction method and application device thereof | |
CN114003252A (en) | Method, system, terminal and storage medium for automatically updating configuration file | |
CN116782291B (en) | Method and system for extracting data | |
CN110309164B (en) | Information updating method, device, equipment and computer readable storage medium | |
ZHANG et al. | Joint optimization algorithm for task offloading and resource allocation in heterogeneous networks | |
CN117201364A (en) | Network link delay reporting method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20141203 Termination date: 20151228 |
|
EXPY | Termination of patent right or utility model |