CN103139272A - Method of obtaining online time within selected time period and device using the same - Google Patents

Method of obtaining online time within selected time period and device using the same Download PDF

Info

Publication number
CN103139272A
CN103139272A CN2011103960517A CN201110396051A CN103139272A CN 103139272 A CN103139272 A CN 103139272A CN 2011103960517 A CN2011103960517 A CN 2011103960517A CN 201110396051 A CN201110396051 A CN 201110396051A CN 103139272 A CN103139272 A CN 103139272A
Authority
CN
China
Prior art keywords
time
section
seclected
variable condition
point
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
CN2011103960517A
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.)
China Digital Video Beijing Ltd
Original Assignee
Peking University Founder Group Co Ltd
Beijing Founder Electronics 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 Peking University Founder Group Co Ltd, Beijing Founder Electronics Co Ltd filed Critical Peking University Founder Group Co Ltd
Priority to CN2011103960517A priority Critical patent/CN103139272A/en
Publication of CN103139272A publication Critical patent/CN103139272A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention provides a method of obtaining online time within a selected time period and a device using the method of obtaining the online time within the selected time period, and relates to the field of network technology, and can obtain the online time within the selected time period fast and accurately. The method includes the following steps: browsing all the state record sheets within the selected time period to obtain record with changed state; when record with a changed state exists within the selected time period, obtaining a sum of a changing time point when the changing state is disconnection state and time interval of a scheduled reference time point, and obtaining a sum of changing time point when the changing state is an online state and time interval of a scheduled reference time point; according to the sum of the changing time point when the changing state is disconnection state and the time interval of the scheduled reference time point, and the sum of the changing time point when the changing state is the online state and the time interval of the scheduled reference time point, obtaining online time within the selected time period. The method of obtaining the online time within the selected time period can be used in the technical field of network.

Description

A kind of method and apparatus that obtains online hours in section seclected time
Technical field
The present invention relates to networking technology area, relate in particular to a kind of method and apparatus that obtains online hours in section seclected time.
Background technology
In report making software such as ReportService, the acquisition methods of the online hours in certain period carries out usually in the following way: the time point at first will be is during this period of time arranged in chronological order, and each online time period in finding out during this period of time, then the time point with the rear broken string of each online time period deducts previous online time point, by such online hours that obtain each online time period that subtract each other piecemeal, the total online hours at last these online hours additions just having been obtained during this period of time.
But this method of obtaining the online hours in certain period, need first to obtain with storing process the online hours of every section line duration in section seclected time, namely deduct the transformation period point of previous presence with the transformation period point of a rear broken string state, then these online hours are added and with the online hours in obtaining during this period of time, operand is large and obtain manner is complicated.
Summary of the invention
Embodiments of the invention provide a kind of method and apparatus that obtains online hours in section seclected time, can obtain easy, fast the online hours in section seclected time.
For achieving the above object, embodiments of the invention adopt following technical scheme:
A kind of method of obtaining online hours in section seclected time comprises:
Travel through the interior state record table of described section seclected time, to obtain with the last time is recorded the record of comparing the generation state variation before, the record of described generation state variation comprises variable condition and transformation period point, and described variable condition is included in line states or broken string state;
When exist recording of generation state variation described seclected time in section:
The time interval sum of the transformation period point that to obtain each described variable condition be the broken string state and regulation reference time point, and the time interval sum put of each described variable condition transformation period point that is presence and described regulation reference time;
According to the time interval sum of time interval sum and each described variable condition of described each described variable condition transformation period point that is the broken string state and the regulation reference time point transformation period point that is presence with described regulation reference time point, obtain the interior online hours of described section seclected time.
A kind of device that obtains online hours in section seclected time comprises:
Query unit, be used for traveling through the interior state record table of described section seclected time, compare to obtain with the last record before the record that state variation occurs, the record of described generation state variation comprises variable condition and transformation period point, and described variable condition is included in line states or broken string state;
Acquiring unit, be used for when exist recording of generation state variation described seclected time in section, the time interval sum of the transformation period point that to obtain each described variable condition be the broken string state and regulation reference time point, and the time interval sum put of each described variable condition transformation period point that is presence and described regulation reference time;
Computing unit, the time interval sum that the transformation period point that the transformation period point that to be used for according to described each described variable condition be the broken string state and time interval sum and each described variable condition of regulation reference time point are presence and described regulation reference time put is obtained the interior online hours of described section seclected time.
The method and apparatus that obtains online hours in section seclected time that the embodiment of the present invention provides, by the state record table in traversal section seclected time, only obtain the record that state variation occurs, and obtain online hours in section seclected time according to the time interval sum that the transformation period point of the time interval sum of the transformation period point of each presence in record and regulation reference time point and each broken string state and regulation reference time put.Compared with prior art, do not need every section online hours in the seclected time section are asked respectively duration, can obtain easy, fast the online hours in section seclected time.
Description of drawings
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, the below will do to introduce simply to the accompanying drawing of required use in embodiment or description of the Prior Art, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain according to these accompanying drawings other accompanying drawing.
A kind of method flow diagram that obtains online hours in section seclected time that Fig. 1 provides for the embodiment of the present invention;
A kind of structure drawing of device that obtains online hours in section seclected time that Fig. 2 provides for the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Based on the embodiment in the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
The embodiment of the present invention provides a kind of method of obtaining online hours in section seclected time, wherein, seclected time, section can be interior any a period of time of time range of state recording table record, can select according to the actual requirements and arbitrarily, as shown in Figure 1, described method comprises:
101, the state record table in traversal described seclected time of section, to obtain with the last time is recorded the record of comparing the generation state variation before, the record of described generation state variation comprises variable condition and transformation period point, and described variable condition is included in line states or broken string state.
Wherein, state record table be put down in writing online or broken string state and with the tables of data of the described online or time point that state that break is corresponding.State record table is just recorded the state of current online or broken string at regular intervals, and when recording current state, state record table also can record time point corresponding to each state.
In this step, travel through the interior state record table of described section seclected time, the state of the online or broken string that namely records in the ergodic state record sheet, thus obtain with the last time is recorded the record of comparing the generation state variation before.
For example, state record table is just recorded current state every 5 milliseconds, being recorded as in one section special time internal state record sheet: online, online, online, online, broken string, broken string.When recording current state, state record table also can record time point corresponding to each state and be respectively t1, t2, t3, t4, t5, t6.The state record table that travels through in this special time compares to obtain with the last record before the record that state variation occurs, and namely gets state broken string corresponding to time point t5 and is variable condition, and time point t5 is the transformation period point.
Concrete, adopt in embodiments of the present invention the storing process of vernier to obtain the record that state variation occurs.Vernier is the ergodic state record sheet in chronological order, in the process of traversal, at first store first state, second state that then will travel through compares with first state that obtains, if state is identical, do not obtain second state, continue the 3rd state of traversal, until traverse the state different from first state, it is retrieved as variable condition, simultaneously the record transformation period point corresponding with variable condition.Certainly, also can adopt the method except the vernier storing process to obtain the record that state variation occurs, to this, the embodiment of the present invention is not construed as limiting.
102, when exist recording of generation state variation described seclected time in section, the time interval sum of the transformation period point that to obtain each described variable condition be the broken string state and regulation reference time point, and the time interval sum put of each described variable condition transformation period point that is presence and described regulation reference time.
Because the time point data can have multiple expression mode, and some expression mode inconvenience directly sums up computing, for example time point data 14: 24: 40 on the 27th September in 2011 and time point data 09: 05: 30 on the 28th September in 2011.Therefore, in the embodiment of the present invention, be provided with regulation reference time point, obtain each time point to the time interval of regulation reference time point, thereby the time point data that can not directly sum up computing be converted into the time interval that facilitates computing.For example, in above-mentioned example, it is 00: 00: 00 on the 27th September in 2011 that regulation reference time point is set, and time point data 14: 24: 40 on the 27th September in 2011 and time point data 09: 05: 30 on the 28th September in 2011 and regulation reference time time interval of putting was respectively 14 hours 24 minutes 40 seconds and 33 hours 05 minute 30 seconds.
Regulation reference time point facilitates the time interval of computing to propose in order to obtain, and can be arbitrary time point, need to prove, in the process of the online hours in obtaining section seclected time, regulation reference time point is changeless.
Preferably, for the time interval that makes acquisition is nonnegative number, described regulation reference time point for any point before described seclected time section or seclected time section start time point.Certainly, also can select in section seclected time or the section seclected time reference time of any point afterwards for stipulating, the embodiment of the present invention does not limit this, also carries out as required the selection of regulation reference time point.
Optionally, adopt the Datediff function to obtain the described time interval in the present embodiment, adopt the Sum function when time interval of obtaining is sued for peace.Certainly, also can adopt as required other functions that can obtain the described time interval or method and can acquisition time other functions or the method for interval sum, the embodiment of the present invention is not construed as limiting this.
103, according to the time interval sum of time interval sum and each described variable condition of described each described variable condition transformation period point that is the broken string state and the regulation reference time point transformation period point that is presence with described regulation reference time point, obtain the interior online hours of described section seclected time.
Concrete, in the method that the embodiment of the present invention provides, described according to the time interval sum of time interval sum and each described variable condition of described each described variable condition transformation period point that is the broken string state and the regulation reference time point transformation period point that is presence with described regulation reference time point, obtain the interior online hours of described section seclected time and comprise:
First variable condition in described seclected time section is broken string, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula one;
Formula one: T=Toff-(Ton+ST)
First variable condition in described seclected time section is broken string, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula two;
Formula two: T=(Toff+ET)-(Ton+ST)
First variable condition in described seclected time section is online, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula three;
Formula three: T=Toff-Ton
First variable condition in described seclected time section is online, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula four;
Formula four: T=(Toff+ET)-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time; ST be described seclected time section start time point and the time interval of point of described regulation reference time; ET is time interval of termination time point and described regulation reference time point of described seclected time of section.Adopt Datediff function acquisition time interval ST and ET in the present embodiment, also can adopt as required other functions or the method that can obtain the described time interval, the embodiment of the present invention is not construed as limiting this.
The method of obtaining online hours in section seclected time that the embodiment of the present invention provides, by the state record table in traversal section seclected time, only obtain the record that state variation occurs, and obtain online hours in section seclected time according to the time interval sum that the transformation period point of the time interval sum of the transformation period point of each presence in record and regulation reference time point and each broken string state and regulation reference time put.Compared with prior art, do not need every section online hours in the seclected time section are asked respectively duration, can obtain easy, fast the online hours in section seclected time.When particularly being applied in report making software, can be good at utilizing the advantage of SQL aspect summation.Select before section seclected time any point or seclected time section initial reference point be the regulation reference time, making the time interval is nonnegative number, has further simplified the acquisition process of online hours.
Further, the method that provides of the embodiment of the present invention also comprises:
When do not exist recording of generation state variation described seclected time in section:
When the state of the last time record before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section;
When the state of described section seclected time the last time record before was broken string, obtaining the interior online hours of described section seclected time was 0.
Do not have the record that state variation occurs seclected time in section, illustrate, be all state online or broken string seclected time in section., illustrate to be presence in section seclected time when being online when the state of the last time record before described seclected time section so, therefore obtain the interior online hours of section seclected time and be the time span of described seclected time of section.And when the state of described section seclected time the last time record before is broken string, the state that is broken string in section seclected time is described, therefore obtaining the interior online hours of section seclected time is 0.
Do not exist in section in seclected time when the recording of state variation occurs, state by the last record before the seclected time section be online or broken string determines that accordingly the state in section seclected time is all online or breaks, and then the online hours that obtain in the seclected time section are the duration or 0 of section seclected time, the online hours in the time of can obtaining easy, fast in the section seclected time existence change records not.
Further, the method that provides in an alternative embodiment of the invention also comprises:
When do not exist recording of generation state variation described seclected time in section:
When the variable condition of the last time before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section;
When the variable condition of described section the last time before seclected time was broken string, obtaining the interior online hours of described section seclected time was 0.
Do not have the record that state variation occurs seclected time in section, illustrate, be all state online or broken string seclected time in section., illustrate to be presence in section seclected time when being online when the variable condition of the last time record before described seclected time section so, therefore obtain the interior online hours of section seclected time and be the duration of described seclected time of section.And when the variable condition of described section seclected time the last time record before is broken string, the state that is broken string in section seclected time is described, therefore obtaining the interior online hours of section seclected time is 0.
Do not exist in section in seclected time when the recording of state variation occurs, variable condition by the last record before the seclected time section be online or broken string determines that accordingly the state in section seclected time is all online or breaks, and then the online hours that obtain in the seclected time section are the duration or 0 of section seclected time, the online hours in the time of can obtaining easy, fast in the section seclected time existence change records not.
Optionally, in another embodiment of the present invention, described according to the time interval sum of time interval sum and each described variable condition of described each described variable condition transformation period point that is the broken string state and the regulation reference time point transformation period point that is presence with described regulation reference time point, obtain the interior online hours of described section seclected time and comprise:
Obtain online hours T in described seclected time of section by formula five;
Formula five: T=Toff-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time.Adopt Sum function acquisition time interval sum Toff and Ton in the present embodiment.Also can adopt as required other functions or the method that can obtain described time interval sum, this is not construed as limiting.
Longer in time interval that section is crossed over seclected time, when in the seclected time section, the accuracy of online hours is less demanding, the approximation that calculates the interior online hours of section seclected time that the obtain manner of this online hours can be very quick and easy.
Corresponding with said method, the embodiment of the present invention provides a kind of device that obtains online hours in section seclected time, as shown in Figure 2, comprising:
Query unit 21, be used for traveling through the interior state record table of described section seclected time, compare to obtain with the last record before the record that state variation occurs, the record of described generation state variation comprises variable condition and transformation period point, and described variable condition is included in line states or broken string state.
Concrete, query unit 21 adopts the storing process of vernier to obtain the record that state variation occurs in embodiments of the present invention.Vernier is the ergodic state record sheet in chronological order, in the process of traversal, at first store first state, second state that then will travel through compares with first state that obtains, if state is identical, do not obtain second state, continue the 3rd state of traversal, until traverse the state different from first state, it is retrieved as variable condition, simultaneously the record transformation period point corresponding with variable condition.Certainly, query unit 21 also can adopt the method except the vernier storing process to obtain the record that state variation occurs, and to this, the embodiment of the present invention is not construed as limiting.
Acquiring unit 22, be used for when exist recording of generation state variation described seclected time in section, the time interval sum of the transformation period point that to obtain each described variable condition be the broken string state and regulation reference time point, and the time interval sum put of each described variable condition transformation period point that is presence and described regulation reference time.
Preferably, for the time interval that makes acquisition is nonnegative number, described regulation reference time point for any point before described seclected time section or seclected time section start time point.Certainly, also can select in section seclected time or the section seclected time reference time of any point afterwards for stipulating, the embodiment of the present invention does not limit this, also carries out as required the selection of regulation reference time point.
Optionally, adopt the Datediff function to obtain the described time interval in the present embodiment, adopt the Sum function when time interval of obtaining is sued for peace.Certainly, also can adopt as required other functions that can obtain the described time interval or method and can acquisition time other functions or the method for interval sum, the embodiment of the present invention is not construed as limiting this.
Computing unit 23, the time interval sum that the transformation period point that the transformation period point that to be used for according to described each described variable condition be the broken string state and time interval sum and each described variable condition of regulation reference time point are presence and described regulation reference time put is obtained the interior online hours of described section seclected time.
The computing unit 23 of the device that optionally, provides in the embodiment of the present invention specifically is used for:
First variable condition in described seclected time section is broken string, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula one;
Formula one: T=Toff-(Ton+ST)
First variable condition in described seclected time section is broken string, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula two;
Formula two: T=(Toff+ET)-(Ton+ST)
First variable condition in described seclected time section is online, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula three;
Formula three: T=Toff-Ton
First variable condition in described seclected time section is online, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula four;
Formula four: T=(Toff+ET)-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time; ST be described seclected time section start time point and the time interval of point of described regulation reference time; ET is time interval of termination time point and described regulation reference time point of described seclected time of section.Adopt Datediff function acquisition time interval ST and ET in the present embodiment.Also can adopt as required other functions or the method that can obtain the described time interval, the embodiment of the present invention is not construed as limiting this.
The device that obtains online hours in section seclected time that the embodiment of the present invention provides, by the state record table in query unit 21 traversal sections seclected time, only obtain the record that state variation occurs, the time interval sum put of the transformation period point of the transformation period point of each presence that computing unit 23 obtains according to the acquiring unit 22 in record and the time interval sum of regulation reference time point and each broken string state and regulation reference time is obtained the online hours in section seclected time.Compared with prior art, do not need every section online hours in the seclected time section are asked respectively duration, can obtain easy, fast the online hours in section seclected time.When particularly being applied in report making software, can be good at utilizing the advantage of SQL aspect summation.Select before section seclected time any point or seclected time section start time point be the regulation reference time, making the time interval is nonnegative number, has further simplified the acquisition process of online hours.
Further, the computing unit 23 of the device that provides of the embodiment of the present invention also is used for:
Do not exist in section when the recording of state variation occurs when described seclected time: when the state of the last time record before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section; When the state of described section seclected time the last time record before was broken string, obtaining the interior online hours of described section seclected time was 0.
Do not have the record that state variation occurs seclected time in section, illustrate, be all state online or broken string seclected time in section., illustrate to be presence in section seclected time when being online when the state of the last time record before described seclected time section so, therefore obtain the interior online hours of section seclected time and be the time span of described seclected time of section.And when the state of described section seclected time the last time record before is broken string, the state that is broken string in section seclected time is described, therefore obtaining the interior online hours of section seclected time is 0.
Do not exist in section in seclected time when the recording of state variation occurs, state by the last record before the seclected time section be online or broken string determines that accordingly the state in section seclected time is all online or breaks, and then the online hours that computing unit 23 obtains in the seclected time section are the duration or 0 of section seclected time, the online hours in the time of can obtaining easy, fast in the section seclected time existence change records not.
Further, the computing unit 23 of the device that provides of an alternative embodiment of the invention also is used for:
Do not exist in section when the recording of state variation occurs when described seclected time: when the variable condition of the last time before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section; When the variable condition of described section the last time before seclected time was broken string, obtaining the interior online hours of described section seclected time was 0.
Do not have the record that state variation occurs seclected time in section, illustrate, be all state online or broken string seclected time in section., illustrate to be presence in section seclected time when being online when the variable condition of the last time record before described seclected time section so, therefore obtain the interior online hours of section seclected time and be the duration of described seclected time of section.And when the variable condition of described section seclected time the last time record before is broken string, the state that is broken string in section seclected time is described, therefore obtaining the interior online hours of section seclected time is 0.
Do not exist in section in seclected time when the recording of state variation occurs, variable condition by the last record before the seclected time section be online or broken string determines that accordingly the state in section seclected time is all online or breaks, and then the online hours that computing unit 23 obtains in the seclected time section are the duration or 0 of section seclected time, the online hours in the time of can obtaining easy, fast in the section seclected time existence change records not.
Optionally, in another embodiment of the present invention, computing unit 23 specifically is used for:
Obtain online hours T in described seclected time of section by formula five;
Formula five: T=Toff-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time.Adopt Sum function acquisition time interval sum Toff and Ton in the present embodiment.Also can adopt as required other functions or the method that can obtain described time interval sum, this is not construed as limiting.
Longer in time interval that section is crossed over seclected time, when in the seclected time section, the accuracy of online hours is less demanding, the approximation that calculates the interior online hours of section seclected time that the obtain manner of this online hours can be very quick and easy.
Through the above description of the embodiments, the those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential common hardware, can certainly pass through hardware, but in a lot of situation, the former is better execution mode.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product is stored in the storage medium that can read, floppy disk as computer, hard disk or CD etc., comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of described claim.

Claims (12)

1. a method of obtaining online hours in section seclected time, is characterized in that, comprising:
Travel through the interior state record table of described section seclected time, to obtain with the last time is recorded the record of comparing the generation state variation before, the record of described generation state variation comprises variable condition and transformation period point, and described variable condition is included in line states or broken string state;
When exist recording of generation state variation described seclected time in section:
The time interval sum of the transformation period point that to obtain each described variable condition be the broken string state and regulation reference time point, and the time interval sum put of each described variable condition transformation period point that is presence and described regulation reference time;
According to the time interval sum of time interval sum and each described variable condition of described each described variable condition transformation period point that is the broken string state and the regulation reference time point transformation period point that is presence with described regulation reference time point, obtain the interior online hours of described section seclected time.
2. method according to claim 1, is characterized in that, described method also comprises:
When do not exist recording of generation state variation described seclected time in section:
When the state of the last time record before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section;
When the state of described section seclected time the last time record before was broken string, obtaining the interior online hours of described section seclected time was 0.
3. method according to claim 1, is characterized in that, described method also comprises:
When do not exist recording of generation state variation described seclected time in section:
When the variable condition of the last time before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section;
When the variable condition of described section the last time before seclected time was broken string, obtaining the interior online hours of described section seclected time was 0.
4. the described method of according to claim 1 to 3 any one, it is characterized in that, described according to the time interval sum of time interval sum and each described variable condition of described each described variable condition transformation period point that is the broken string state and the regulation reference time point transformation period point that is presence with described regulation reference time point, obtain the interior online hours of described section seclected time and comprise:
First variable condition in described seclected time section is broken string, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula one;
Formula one: T=Toff-(Ton+ST)
First variable condition in described seclected time section is broken string, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula two;
Formula two: T=(Toff+ET)-(Ton+ST)
First variable condition in described seclected time section is online, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula three;
Formula three: T=Toff-Ton
First variable condition in described seclected time section is online, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula four;
Formula four: T=(Toff+ET)-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time; ST be described seclected time section start time point and the time interval of point of described regulation reference time; ET is time interval of termination time point and described regulation reference time point of described seclected time of section.
5. the described method of according to claim 1 to 3 any one, it is characterized in that, described according to the time interval sum of time interval sum and each described variable condition of described each described variable condition transformation period point that is the broken string state and the regulation reference time point transformation period point that is presence with described regulation reference time point, obtain the interior online hours of described section seclected time and comprise:
Obtain online hours T in described seclected time of section by formula five;
Formula five: T=Toff-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time.
6. method according to claim 1, is characterized in that, described regulation reference time point for the arbitrary time point before described seclected time section or described seclected time section start time point.
7. a device that obtains online hours in section seclected time, is characterized in that, comprising:
Query unit, be used for traveling through the interior state record table of described section seclected time, compare to obtain with the last record before the record that state variation occurs, the record of described generation state variation comprises variable condition and transformation period point, and described variable condition is included in line states or broken string state;
Acquiring unit, be used for when exist recording of generation state variation described seclected time in section, the time interval sum of the transformation period point that to obtain each described variable condition be the broken string state and regulation reference time point, and the time interval sum put of each described variable condition transformation period point that is presence and described regulation reference time;
Computing unit, the time interval sum that the transformation period point that the transformation period point that to be used for according to described each described variable condition be the broken string state and time interval sum and each described variable condition of regulation reference time point are presence and described regulation reference time put is obtained the interior online hours of described section seclected time.
8. device according to claim 7, is characterized in that, described computing unit also is used for:
Do not exist in section when the recording of state variation occurs when described seclected time: when the state of the last time record before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section; When the state of described section seclected time the last time record before was broken string, obtaining the interior online hours of described section seclected time was 0.
9. device according to claim 7, is characterized in that, described computing unit also is used for:
Do not exist in section when the recording of state variation occurs when described seclected time: when the variable condition of the last time before described seclected time section when being online, obtain online hours in described seclected time of section and be the time span of described seclected time of section; When the variable condition of described section the last time before seclected time was broken string, obtaining the interior online hours of described section seclected time was 0.
10. the described device of according to claim 7 to 9 any one, is characterized in that, described computing unit specifically is used for:
First variable condition in described seclected time section is broken string, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula one;
Formula one: T=Toff-(Ton+ST)
First variable condition in described seclected time section is broken string, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula two;
Formula two: T=(Toff+ET)-(Ton+ST)
First variable condition in described seclected time section is online, and last variable condition in described seclected time section is during for broken string, obtains online hours T in described seclected time of section by following formula three;
Formula three: T=Toff-Ton
First variable condition in described seclected time section is online, when last variable condition in described seclected time section is online, obtains online hours T in described seclected time of section by following formula four;
Formula four: T=(Toff+ET)-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time; ST be described seclected time section start time point and the time interval of point of described regulation reference time; ET is time interval of termination time point and described regulation reference time point of described seclected time of section.
11. according to claim 7-9 described devices of any one is characterized in that, described computing unit specifically is used for:
Obtain online hours T in described seclected time of section by formula five;
Formula five: T=Toff-Ton
Wherein: the time interval sum that Toff put for each described variable condition transformation period point that is the broken string state and regulation reference time; The time interval sum that Ton put for each described variable condition transformation period point that is presence and described regulation reference time.
12. device according to claim 7 is characterized in that, described regulation reference time point for the arbitrary time point before described seclected time section or described seclected time section start time point.
CN2011103960517A 2011-12-02 2011-12-02 Method of obtaining online time within selected time period and device using the same Pending CN103139272A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011103960517A CN103139272A (en) 2011-12-02 2011-12-02 Method of obtaining online time within selected time period and device using the same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2011103960517A CN103139272A (en) 2011-12-02 2011-12-02 Method of obtaining online time within selected time period and device using the same

Publications (1)

Publication Number Publication Date
CN103139272A true CN103139272A (en) 2013-06-05

Family

ID=48498571

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011103960517A Pending CN103139272A (en) 2011-12-02 2011-12-02 Method of obtaining online time within selected time period and device using the same

Country Status (1)

Country Link
CN (1) CN103139272A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105761119A (en) * 2016-03-30 2016-07-13 广州华多网络科技有限公司 On-line number of people distribution calculation method and device
CN108228679A (en) * 2016-12-22 2018-06-29 阿里巴巴集团控股有限公司 Time series data metering method and time series data metering device
CN111124846A (en) * 2018-10-31 2020-05-08 千寻位置网络有限公司 Online positioning duration statistical method and device and positioning service system
CN111263120A (en) * 2020-02-25 2020-06-09 北京金和网络股份有限公司 Video equipment online time counting method and device based on stream calculation and terminal
CN111372130A (en) * 2020-03-02 2020-07-03 北京字节跳动网络技术有限公司 User online time counting method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101860839A (en) * 2009-04-08 2010-10-13 北京博越世纪科技有限公司 Technology for carrying out dynamic statistics on online time of mobile phone user of emergency system
CN101860597A (en) * 2009-04-10 2010-10-13 北京闻言科技有限公司 Method for ranking online time of mobile phone client in real time
US20100280804A1 (en) * 2008-01-23 2010-11-04 Huawei Technologies Co., Ltd. Method and device for predicting residual online time of peer in peer-to-peer network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100280804A1 (en) * 2008-01-23 2010-11-04 Huawei Technologies Co., Ltd. Method and device for predicting residual online time of peer in peer-to-peer network
CN101860839A (en) * 2009-04-08 2010-10-13 北京博越世纪科技有限公司 Technology for carrying out dynamic statistics on online time of mobile phone user of emergency system
CN101860597A (en) * 2009-04-10 2010-10-13 北京闻言科技有限公司 Method for ranking online time of mobile phone client in real time

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105761119A (en) * 2016-03-30 2016-07-13 广州华多网络科技有限公司 On-line number of people distribution calculation method and device
CN105761119B (en) * 2016-03-30 2019-11-05 广州华多网络科技有限公司 Online number distribution calculation method and device
CN108228679A (en) * 2016-12-22 2018-06-29 阿里巴巴集团控股有限公司 Time series data metering method and time series data metering device
CN108228679B (en) * 2016-12-22 2022-02-18 阿里巴巴集团控股有限公司 Time series data metering method and time series data metering device
CN111124846A (en) * 2018-10-31 2020-05-08 千寻位置网络有限公司 Online positioning duration statistical method and device and positioning service system
CN111124846B (en) * 2018-10-31 2023-05-30 千寻位置网络有限公司 Online positioning time length counting method and device and positioning service system
CN111263120A (en) * 2020-02-25 2020-06-09 北京金和网络股份有限公司 Video equipment online time counting method and device based on stream calculation and terminal
CN111263120B (en) * 2020-02-25 2021-05-25 北京金和网络股份有限公司 Video equipment online time counting method and device based on stream calculation and terminal
CN111372130A (en) * 2020-03-02 2020-07-03 北京字节跳动网络技术有限公司 User online time counting method and device, electronic equipment and storage medium
CN111372130B (en) * 2020-03-02 2021-02-02 北京字节跳动网络技术有限公司 User online time counting method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN103139272A (en) Method of obtaining online time within selected time period and device using the same
CN105096363A (en) Picture editing method and picture editing device
CN104182405A (en) Method and device for connection query
CN105447030B (en) A kind of index process method and apparatus
CN103955536A (en) Classification method and device of applications
CN104504137A (en) Data storage method and system
CN102789353A (en) Method and device for operating desktop objects on touch screen mobile devices
CN108241692B (en) Data query method and device
CN106547870A (en) Point table method and device of data base
CN105653647A (en) Information acquisition method and system of SQL (Structured Query Language) statement
CN104424240A (en) Multi-table correlation method and system, main service node and computing node
US20180032588A1 (en) Identifying relationship instances between entities
CN104461384B (en) A kind of method for writing data and storage device
CN102624544A (en) Method and device for creating monitoring tasks
CN109189343B (en) Metadata disk-dropping method, device, equipment and computer-readable storage medium
CN103247312B (en) A kind of method of even played songs
CN101917282B (en) Method, device and system for processing alarm shielding rules
CN105426131A (en) KV (Key Value) storage implementation method and device
CN106326439A (en) Real-time video storage and retrieval method and device
CN106294591A (en) File storage method and device and electronic equipment
DE102016204714A1 (en) Assistance Technology (AT) Reacting to Cognitive States
CN103793469A (en) Data inquiry statistics method and data inquiry statistics system
CN108446062A (en) A kind of object fixing means, device, terminal device and storage medium
CN105487769B (en) Media file display method and device and electronic equipment
CN107239568A (en) Distributed index implementation method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
ASS Succession or assignment of patent right

Free format text: FORMER OWNER: BEIDA FANGZHENG ELECTRONICS CO., LTD., BEIJING

Effective date: 20131031

Owner name: XIN'AOTE(BEIJING) VIDEO TECHNOLOGY CO., LTD.

Free format text: FORMER OWNER: BEIDA FANGZHENG GROUP CO. LTD.

Effective date: 20131031

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100871 HAIDIAN, BEIJING TO: 100080 HAIDIAN, BEIJING

TA01 Transfer of patent application right

Effective date of registration: 20131031

Address after: Newauto Technology Building No. 49 Beijing 100080 Haidian District Wukesong Road

Applicant after: China Digital Video (Beijing) Limited

Address before: 100871 Beijing, Haidian District into the house road, founder of the building on the 5 floor, No. 298

Applicant before: Peking Founder Group Co., Ltd.

Applicant before: Beida Fangzheng Electronics Co., Ltd., Beijing

AD01 Patent right deemed abandoned

Effective date of abandoning: 20161228

C20 Patent right or utility model deemed to be abandoned or is abandoned