CN106020332A - Timing processing method and system - Google Patents

Timing processing method and system Download PDF

Info

Publication number
CN106020332A
CN106020332A CN201610379465.1A CN201610379465A CN106020332A CN 106020332 A CN106020332 A CN 106020332A CN 201610379465 A CN201610379465 A CN 201610379465A CN 106020332 A CN106020332 A CN 106020332A
Authority
CN
China
Prior art keywords
timing
thread
main thread
clocking value
timed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610379465.1A
Other languages
Chinese (zh)
Inventor
李奇奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
LeTV Holding Beijing Co Ltd
LeTV Information Technology Beijing Co Ltd
Original Assignee
LeTV Holding Beijing Co Ltd
LeTV Information Technology Beijing 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 LeTV Holding Beijing Co Ltd, LeTV Information Technology Beijing Co Ltd filed Critical LeTV Holding Beijing Co Ltd
Priority to CN201610379465.1A priority Critical patent/CN106020332A/en
Publication of CN106020332A publication Critical patent/CN106020332A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/08Clock generators with changeable or programmable clock frequency

Abstract

The invention relates to the technical field of data processing and provides a timing processing method and system. According to the method, the system repeatedly starts a timing thread according to timing repetition rules of a timing main thread, wherein the restarting interval in the timing repetition rules is shorter than a clock period of the system; a timing program is executed according to a timing value transmitted back from the timing main thread according to the timing thread. According to the timing processing method and system, excessive occupation of system resources during a monitoring system period of the timing main thread is effectively lowered, and the problem that the system occupation rate of the timing application program in an intelligent terminal is excessively high is solved.

Description

Timing processing method and system
Technical field
The present invention relates to data processing technique, particularly to timing processing method and system.
Background technology
The history of existing thousand of years applied by timer by the mankind, from the corona in time immemorial and water clock till now Clock and stopwatch, timer there occurs huge change from weight, function, outward appearance, range of application.
Along with the development of science and technology, people's applying electronic timer especially instead of traditional timing of entity Device, so that the function of timer, application etc. there occurs huge change.
Along with mobile phone has been increasingly becoming requisite article in people's life, the application of timer is loaded In mobile phone, also become a kind of trend.But existing technology Timer is owing to obtaining system frequently Time can take the resource of mobile phone, causes the waste of unnecessary resource.
Accordingly, it would be desirable to prior art is improved.
Summary of the invention
It is an object of the invention to provide a kind of timing processing method and system, be used for solving in intelligent terminal The problem that the system occupancy of timing application program is too high.
For solving above-mentioned technical problem, embodiments of the present invention provide a kind of timing processing method, bag Contain: according to the timing recurring rule of timing main thread, repeated priming timed thread, wherein, described timing Interval of restarting in recurring rule is less than system clock cycle;By described timing main thread according to described timing The clocking value that thread is returned performs timing program.
It addition, embodiments of the present invention additionally provide a kind of timing processing system, comprise: time block, For the timing recurring rule according to timing main thread, repeated priming timed thread, wherein, described timing Interval of restarting in recurring rule is less than system clock cycle;Timing performs module, for by described timing The clocking value that main thread is returned according to described timed thread performs timing program.
Embodiment of the present invention in terms of existing technologies, reads timing by timed thread with low frequency The mode of value, effectively reduces timing main thread too much accounting for system resource during monitoring system time With, solve the problem that the system occupancy of timing application program in intelligent terminal is too high.
It addition, adjust the timing of corresponding timing main thread according to timing information produced by described timed thread Value, determines number of repetition, utilize number of repetition and default restart interval can low-frequency collection current System time, effectively reduce timer and system resource taken.
It addition, in order to manage multiple timing main thread, the present invention mates correspondence always according to timing information Timing main thread, is achieved in many timing main thread acquisition demand to system time, reduces each timing Competition to system resource between main thread.
Accompanying drawing explanation
Fig. 1 is the flow chart of timing processing method according to the first embodiment of the invention;
Fig. 2 is the flow chart of timing processing method second embodiment of the invention;
Fig. 3 is the structural representation of the timing processing system according to third embodiment of the present invention;
Fig. 4 is the structural representation of the timing processing system of the 4th embodiment according to the present invention;
Fig. 5 is the structural representation of the timing processing system of the 5th embodiment according to the present invention.
Detailed description of the invention
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to this Bright each embodiment is explained in detail.But, it will be understood by those skilled in the art that In each embodiment of the present invention, propose many technology to make reader be more fully understood that the application thin Joint.But, even if there is no these ins and outs and many variations based on following embodiment and amendment, The application each claim technical scheme required for protection can also be realized.
Embodiment one
As it is shown in figure 1, first embodiment of the present invention relates to a kind of timing processing method.Described timing Processing method is applicable to user terminal and obtains clocking value when performing timing program.Wherein, described user is eventually End includes but not limited to: PC, intelligent terminal etc..Described intelligent terminal refers in particular to system resource to be had The terminal of limit, such as, mobile phone, panel computer etc..Described timing processing method specifically comprises: step S110, S120。
Step S110, timing recurring rule according to timing main thread, repeated priming timed thread, wherein, Interval of restarting in described timing recurring rule is less than system clock cycle.
Here, described timing main thread refers to based on enabled instruction operation, for referring to according to described startup Initial time indicated by order starts the thread of recording time information.Here, described timing main thread is in fortune Not by directly reading the mode of system time to obtain current time information during row, but according to presetting Timing recurring rule, repeated priming timed thread.Wherein, described timed thread is independent of timing master The thread of thread, described timed thread operationally can read current system time, and by obtained System time returns to described timing main thread as clocking value.
Wherein, described timing main thread pre-sets timing recurring rule, at timing recurring rule In contain timed thread restart interval.Described restart interval less than system clock cycle.Described system Clock cycle is for based on the clock cycle produced by crystal oscillator in intelligent terminal, being exemplified as 10ms.Described timing Recurring rule include following any one: set according to acquired enabled instruction restart interval, according to Preset initial time and set restart interval and start according to the default time delay of default initial time And arrange restart interval.Such as, described timing recurring rule is: from the beginning of in time receiving enabled instruction Per second restart a timed thread.And for example, described timing recurring rule is: from set by enabled instruction Initial time start, per second restart a timed thread.
Step S120, the clocking value returned according to described timed thread by described timing main thread perform meter Shi Chengxu.
Here, the mode of asynchronous communication can be used between described timing main thread and timed thread to transmit meter Duration.
A kind of alternative is, after timed thread performs, and can be by obtained meter by the way of handle Duration passes to timing main thread;Timing program is performed according to described clocking value again by timing main thread.
Such as, for Android system, when described timed thread obtains clocking value, pass through handle Handle, passes to timing main thread by described clocking value.Whether described timing main thread mates this clocking value Arrive or exceed the time of default reminder events, the most then perform the reminder events in timing program, If it is not, then update current clocking value, and hang up, with etc. the clocking value of next time to be received.
The present invention, by the way of timed thread reads clocking value with low frequency, effectively reduces timing main line Journey is too much taking system resource during monitoring system time, solves timing application in intelligent terminal The problem that the system occupancy of program is too high.
Embodiment two
It is not both with foregoing embodiments, as in figure 2 it is shown, step S120 includes step S121, S122.
Step S121, adjust corresponding timing main thread according to timing information produced by described timed thread Clocking value.
Described timing main thread can obtain the initial time of timing, described timing master according to timing recurring rule Thread needs timed thread to provide the timing cycle (i.e. clocking value) started from initial time, the most described meter Time main thread can deduce current system time according to this clocking value.
And in order to reduce the operation time of timed thread, the exportable default timing information of timed thread.Should Timing information can be only numeral, character etc., it is also possible to comprises the label information of labelling timing main thread.
After timed thread performs once, according to produced timing information, clocking value is added 1, and Perform step S122.
In a kind of alternative, timing main thread can be multiple, and each timing main thread is controlled by one Device manages.The timing that each timing main thread obtains corresponding timed thread by this controller and provided is believed Breath.When controller receives timing information, by acquired for coupling in each timing main thread managed Timing information.Such as, timing information is mated according to the thread name of each timing main thread.According still further to The timing information matched updates the clocking value of corresponding timing main thread.Clocking value after adjusting is passed back Described timing main thread.
Here, the mode updating clocking value can add 1 according to produced timing information to clocking value.
Here, the clocking value after adjusting passes the mode of described timing main thread back may utilize the mode of handle Clocking value is passed to timing main thread.
Step S122, by described timing main thread according to adjust after clocking value perform timing program.
Here, described timing main thread according to known initial time and obtained clocking value, restart between Every, it is possible to deduce current system time, and judge whether accordingly to perform reminder events.
Embodiment three
As it is shown on figure 3, third embodiment of the present invention relates to a kind of timing processing system.Described timing Processing system is applicable to user terminal and obtains clocking value when performing timing program.Wherein, described user is eventually End includes but not limited to: PC, intelligent terminal etc..Described intelligent terminal refers in particular to system resource to be had The terminal of limit, such as, mobile phone, panel computer etc..Described timing processing system 1 specifically comprises: regularly Module 11, timing perform module 12.Wherein, described time block 11 and timing execution module 12 can be total to With a CPU and internal memory.In addition, described time block 11 can also comprise intervalometer and peripheral electricity Road.
Described time block 11 is for the timing recurring rule according to timing main thread, repeated priming timing Thread, wherein, the interval of restarting in described timing recurring rule is less than system clock cycle.
Here, described timing main thread refers to based on enabled instruction operation, for referring to according to described startup Initial time indicated by order starts the thread of recording time information.Here, described timing main thread is in fortune Not by directly reading the mode of system time to obtain current time information during row, but according to presetting Timing recurring rule, repeated priming timed thread.Wherein, described timed thread is independent of timing master The thread of thread, described timed thread operationally can read current system time, and by obtained System time returns to described timing main thread as clocking value.
Wherein, described time block 11 pre-sets timing recurring rule in timing main thread, Regularly contain timed thread in recurring rule restarts interval.Described restart interval less than system clock week Phase.Described system clock cycle is for based on the clock cycle produced by crystal oscillator in intelligent terminal, being exemplified as 10ms.Described timing recurring rule include following any one: set according to acquired enabled instruction Restart interval, set according to default initial time restart interval and according to default initial time Default time delay start and arrange restart interval.Such as, described timing recurring rule is: from receiving Start during enabled instruction per second restarts a timed thread.And for example, described timing recurring rule is: from Initial time set by enabled instruction starts, and per second restarts a timed thread.
Described timing performs module 12 for being returned according to described timed thread by described timing main thread Clocking value perform timing program.
Here, the mode of asynchronous communication can be used between described timing main thread and timed thread to transmit meter Duration.
A kind of alternative is, after timed thread performs, described timing performs module 12 can pass through sentence Obtained clocking value is passed to timing main thread by the mode of handle;Again by timing main thread according to described meter Duration performs timing program.
Such as, for Android system, monitor timed thread when described timing execution module 12 and obtain During clocking value, by handle handle, described clocking value is passed to timing main thread.Described timing performs Module 12 utilize timing main thread mate this clocking value whether arrive or exceed default reminder events time Between, the most then perform the reminder events in timing program, if it is not, then update current clocking value, and Hang up, with etc. the clocking value of next time to be received.
The present invention, by the way of timed thread reads clocking value with low frequency, effectively reduces timing main line Journey is too much taking system resource during monitoring system time, solves timing application in intelligent terminal The problem that the system occupancy of program is too high.
Embodiment four
Not being both with foregoing embodiments, as shown in Figure 4, described timing performs module 12 and includes: adjust Whole submodule 121 and timing implementation sub-module 122.
Described adjustment submodule 121 is for adjusting correspondence according to timing information produced by described timed thread The clocking value of timing main thread.
Described adjustment submodule 121, when performing timing main thread, can be counted according to timing recurring rule Time initial time, and provide, according to timed thread, the timing cycle (i.e. clocking value) that starts from initial time, The most described timing main thread can deduce current system time according to this clocking value.
And in order to reduce the operation time of timed thread, the exportable default timing information of timed thread.Should Timing information can be only numeral, character etc., it is also possible to comprises the label information of labelling timing main thread.
Whenever timed thread perform once after, described adjustment submodule 121 according to produced timing information, Clocking value is added 1, and performs timing implementation sub-module 122.
In a kind of alternative, timing main thread can be multiple, and each timing main thread is by described tune Whole submodule 121 manages.Each timing main thread obtains the timing line of correspondence by adjusting submodule 121 The timing information that journey is provided.When adjusting submodule 121 and receiving timing information, will managed Each timing main thread mates acquired timing information.Such as, described adjustment submodule 121 is according to respectively The thread name of timing main thread mates timing information.Described adjustment submodule 121 is according still further to matching Timing information update the clocking value of corresponding timing main thread, and the clocking value after adjusting is passed back described Timing main thread.
Here, described adjustment submodule 121 update clocking value mode can according to produced timing information, Clocking value is added 1.
Here, the clocking value after described adjustment submodule 121 will adjust passes the side of described timing main thread back Formula may utilize the mode of handle and clocking value pass to timing main thread.
Described timing implementation sub-module 122 is performed timing journey by timing main thread according to the clocking value after adjusting Sequence.
Here, described timing implementation sub-module 122 is according to initial time and gained known to timing main thread To clocking value, restart interval, it is possible to deduce current system time, and judge whether accordingly to hold Row reminder events.
Embodiment five
As it is shown in figure 5, the work process citing of the timing processing system obtained by utilizing the various embodiments described above As follows:
CPU performs timing main thread according to enabled instruction, the term of execution, repeat according to default timing Rule, set intervalometer restarts interval, and when intervalometer arrives and restarts interval, notice CPU repeats to open Dynamic timed thread.Parameter used in timing main thread is existed in internal memory by CPU, and hangs up timing main line Journey also performs timed thread, and the clocking value returned by timed thread by handle mode transfers to timing master Thread.CPU continues executing with timing main thread according to described clocking value, and determines current system according to clocking value The system time, when determined by present system time meet reminder time of default reminder events, then CPU Export to the alarm set of buzzer, vibrator and the circuit etc. comprising loudspeaker and remind instruction, otherwise, Then it is again started up intervalometer.
It is noted that each module involved in present embodiment and unit be logic module and Logical block, in actual applications, a logical block can be a physical location, it is also possible to be one A part for individual physical location, it is also possible to realize with the combination of multiple physical locations.Additionally, in order to prominent The innovative part of the present invention, not by the technical problem proposed by the invention with solution in present embodiment The unit introducing that relation is the closest, but this is not intended that in present embodiment the unit that there is not other.
It will be understood by those skilled in the art that the respective embodiments described above are realize the present invention concrete Embodiment, and in actual applications, can to it, various changes can be made in the form and details, and the most inclined From the spirit and scope of the present invention.

Claims (10)

1. a timing processing method, it is characterised in that comprise:
According to the timing recurring rule of timing main thread, repeated priming timed thread, wherein, described timing Interval of restarting in recurring rule is less than system clock cycle;
The clocking value returned according to described timed thread by described timing main thread performs timing program.
Timing processing method the most according to claim 1, it is characterised in that described timing repeats Rule include following any one: set according to acquired enabled instruction restart interval, according to preset Initial time and set restart interval and start according to the default time delay of default initial time and set That puts restarts interval.
Timing processing method the most according to claim 1, it is characterised in that described by timing master The clocking value that thread is returned according to described timed thread performs timing program, including:
The clocking value of corresponding timing main thread is adjusted according to timing information produced by described timed thread;
Timing program is performed according to the clocking value after adjusting by described timing main thread.
Timing processing method the most according to claim 3, it is characterised in that described according to timing Timing information produced by thread adjusts the clocking value of corresponding timing main thread, including:
Obtain the timing information that timed thread is exported;
Acquired timing information is mated in each timing main thread managed;
The clocking value of corresponding timing main thread is updated according to the timing information matched;
Clocking value after adjusting passes described timing main thread back.
Timing processing method the most according to claim 1, it is characterised in that described by timing master The clocking value that thread is returned according to described timed thread performs timing program, including:
Utilize the handle comprising clocking value that described clocking value is passed back described timing main thread;
Timing program is performed according to described clocking value by timing main thread.
6. a timing processing system, it is characterised in that comprise:
Time block, for according to the timing recurring rule of timing main thread, repeated priming timed thread, Wherein, the interval of restarting in described timing recurring rule is less than system clock cycle;
Timing performs module, for the timing returned according to described timed thread by described timing main thread Value performs timing program.
Timing processing system the most according to claim 6, it is characterised in that described timing repeats Rule include following any one: set according to acquired enabled instruction restart interval, according to preset Initial time and set restart interval and start according to the default time delay of default initial time and set That puts restarts interval.
Timing processing system the most according to claim 6, it is characterised in that described timing performs Module includes:
Adjust submodule, for adjusting corresponding timing master according to timing information produced by described timed thread The clocking value of thread;
Timing implementation sub-module, for being performed timing by described timing main thread according to the clocking value after adjusting Program.
Timing processing system the most according to claim 8, it is characterised in that described adjustment submodule Block is for obtaining the timing information that timed thread is exported;Institute is mated in each timing main thread managed The timing information obtained;The clocking value of corresponding timing main thread is updated according to the timing information matched; And will adjust after clocking value pass described timing main thread back.
Timing processing system the most according to claim 6, it is characterised in that described adjustment submodule Described clocking value is passed back described timing main thread for utilizing the handle comprising clocking value by block.
CN201610379465.1A 2016-05-31 2016-05-31 Timing processing method and system Pending CN106020332A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610379465.1A CN106020332A (en) 2016-05-31 2016-05-31 Timing processing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610379465.1A CN106020332A (en) 2016-05-31 2016-05-31 Timing processing method and system

Publications (1)

Publication Number Publication Date
CN106020332A true CN106020332A (en) 2016-10-12

Family

ID=57092050

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610379465.1A Pending CN106020332A (en) 2016-05-31 2016-05-31 Timing processing method and system

Country Status (1)

Country Link
CN (1) CN106020332A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681715A (en) * 2016-12-09 2017-05-17 北京五八信息技术有限公司 Timing function implementation method and system
CN110444055A (en) * 2019-08-13 2019-11-12 杭州学两手网络科技有限公司 A kind of tutoring system for making timing based on Internet of Things

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490688A (en) * 2002-10-17 2004-04-21 深圳市中兴通讯股份有限公司上海第二 Timing system and method thereof
CN1710543A (en) * 2005-06-13 2005-12-21 浙江大学 Two-stage timing method for inlaid real-time operation system timer
CN1952901A (en) * 2005-10-22 2007-04-25 康佳集团股份有限公司 A software timing method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490688A (en) * 2002-10-17 2004-04-21 深圳市中兴通讯股份有限公司上海第二 Timing system and method thereof
CN1710543A (en) * 2005-06-13 2005-12-21 浙江大学 Two-stage timing method for inlaid real-time operation system timer
CN1952901A (en) * 2005-10-22 2007-04-25 康佳集团股份有限公司 A software timing method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681715A (en) * 2016-12-09 2017-05-17 北京五八信息技术有限公司 Timing function implementation method and system
CN106681715B (en) * 2016-12-09 2021-05-14 北京五八信息技术有限公司 Method and system for realizing timing function
CN110444055A (en) * 2019-08-13 2019-11-12 杭州学两手网络科技有限公司 A kind of tutoring system for making timing based on Internet of Things

Similar Documents

Publication Publication Date Title
CN100517215C (en) Method and apparatus for timing and event processing in wireless systems
CN106648025A (en) Always on display method and terminal
CN112530056B (en) Method for reducing power consumption of intelligent door lock, intelligent door lock and storage medium
CN101089838A (en) Method for implementing 12C read-write sequence
CN106227293A (en) A kind of system clock
US8659563B2 (en) Electronic device with a page turning function during a sleep mode of the electronic device
CN101464658A (en) Method and apparatus for time-differential comparison of an analog signal
CN105159722B (en) RTC wakes up the method and computer of system
CN106020332A (en) Timing processing method and system
CN103327587A (en) Method and device for controlling sleep cycle of terminal
CN106776425A (en) A kind of working frequency method to set up, main control card, service card and communication equipment
WO2016184149A1 (en) Display method and device, display control method and device, and equipment
CN112230711B (en) Calibration device, method and computer readable storage medium
CN104427133A (en) Communication-terminal standby electricity-saving control method and control device
CN104965759B (en) A kind of method and terminal of control terminal
CN107121920A (en) A kind of clock display method and intelligent watch
US7536580B2 (en) System and method for generating timer output corresponding to timer request from plurality of processes
CN104412221B (en) Data transmission between clock domain
CN104518785B (en) Cross-domain startup method and electronic installation
CN106775750B (en) The method and device that terminal device wakes up
CN106814840A (en) Low power state for processor keeps pattern
CN214480603U (en) Bluetooth clock circuit structure
CN109799872A (en) Improve the method, apparatus and electronic equipment of low-res real-time clock waking-up precision
CN107608723A (en) One kind application alignment awakening method, terminal and computer-readable recording medium
CN111338425B (en) Method and system for realizing countdown of wireless low-power-consumption 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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20161012

WD01 Invention patent application deemed withdrawn after publication