CN109597588A - A kind of date storage method, data restoration method and device - Google Patents

A kind of date storage method, data restoration method and device Download PDF

Info

Publication number
CN109597588A
CN109597588A CN201811509080.8A CN201811509080A CN109597588A CN 109597588 A CN109597588 A CN 109597588A CN 201811509080 A CN201811509080 A CN 201811509080A CN 109597588 A CN109597588 A CN 109597588A
Authority
CN
China
Prior art keywords
timestamp
sequence
time stamp
deviation
relationship
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.)
Granted
Application number
CN201811509080.8A
Other languages
Chinese (zh)
Other versions
CN109597588B (en
Inventor
苏宏业
卜梓琴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Zhongzhida Technology Co Ltd
Original Assignee
Zhejiang Zhongzhida Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Zhongzhida Technology Co Ltd filed Critical Zhejiang Zhongzhida Technology Co Ltd
Priority to CN201811509080.8A priority Critical patent/CN109597588B/en
Publication of CN109597588A publication Critical patent/CN109597588A/en
Application granted granted Critical
Publication of CN109597588B publication Critical patent/CN109597588B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention provides a kind of date storage method, data restoration method and device, 1 return is added to execute i-th of the timestamp obtained in original time stamp sequence to i if the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation and i-th of timestamp is not n-th of timestamp, the 1st timestamp in original time stamp sequence is stored if the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation and i-th of timestamp is n-th of timestamp, the 2nd timestamp is stored to the respective deviation of n-th of timestamp and storage deviation number, the corresponding unique time stamps of each deviation are restored by deviation, the occupancy for reducing memory space is achieved in by way of storing deviation, it does not need to abandon deviation when storing deviation in this way, and pass through storage deviation The mode of value make each timestamp in original time stamp sequence can accurate reproduction, to improve the integrality and authenticity of timestamp.

Description

A kind of date storage method, data restoration method and device
Technical field
The invention belongs to technical field of data processing more particularly to a kind of date storage methods, data convert and device.
Background technique
Industrial control field needs to store extensive real time data as production control, production analysis, Optimizing manufacture at present Etc. processes important evidence, wherein real time data is used to describe state change of one object on the time dimension of history and believes Breath, such as 9 divide 9:123456 second when 1 day 9 January in 2017, the coolant-temperature gage of plant area's 1# rectifier unit is 20 degrees Celsius, it can thus be appreciated that Real time data includes: the state change information timestamp corresponding with the state change information of object, and timestamp is usually one Character, for uniquely indicating a certain moment, and timestamp is made of year, month, day, hour, min, second and millisecond, therefore is being deposited Timestamp occupies biggish memory when storing up timestamp.
In order to reduce the memory of timestamp occupancy, timestamp can be used setting deviation threshold mode storage time and stab, for example, If the deviation between current time stamp and previous timestamp abandons current time stamp in deviation threshold, if partially Difference exceeds deviation threshold, then retains current time stamp and store, and this storage mode is by reducing the timestamp number stored Mode reach reduction EMS memory occupation, achieve the purpose that storage optimization, but this storage mode can lose some timestamps, drop The integrality and authenticity of low timestamp.
Summary of the invention
In view of this, being used for the purpose of the present invention is to provide a kind of date storage method, data restoration method and device By storage time stab in deviation come storing data, and by restore deviation obtain data.Technical solution is as follows:
The present invention provides a kind of date storage method, which comprises
I-th of timestamp in original time stamp sequence is obtained, i is from 2 any one number into n, and n is described original Timestamp sum in timestamp sequence;
If relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, and i-th of the time Stamp is not n-th of timestamp, then adds 1 return to execute the step of obtaining i-th of timestamp in original time stamp sequence i;
If relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, and i-th of the time Stamp is n-th of timestamp, then stores the 1st timestamp, the 2nd timestamp of storage to n-th in the original time stamp sequence A respective deviation of timestamp and storage deviation number.
Preferably, the method also includes:
If relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, and i-th of timestamp It is n-th of timestamp, then individually stores i-th of timestamp;
If relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, and i-th of timestamp It is not n-th of timestamp, then the 1st new time being determined as i-th of timestamp in the original time stamp sequence Stamp, and add 1 return to execute the step of obtaining i-th of timestamp in original time stamp sequence i;
To the 1st timestamp in the original time stamp sequence to (i-1)-th timestamp based on the pass between timestamp System's storage.
Preferably, the 1st timestamp in the original time stamp sequence to (i-1)-th timestamp is based on the time Relationship storage between stamp includes:
If the value of i is equal to 2, the 1st timestamp in the original time stamp sequence is individually stored;
If the value of i is greater than 2, if there are relationship being serial relation in the original time stamp sequence and adjacent to each other The continuous time of timestamp composition stabs sequence, then stores the 1st timestamp in the continuous time stamp sequence, stores the 2nd For timestamp to the respective deviation of m-th of timestamp and storage deviation number, m-1 is the continuous time to stab sequence large deviations It is worth number, if the relationship between -1 timestamp of j-th of timestamp in the original time stamp sequence and jth is discontinuous Relationship and relationship between+1 timestamp of jth is discontinuous relationship, then individually store in the original time stamp sequence J-th of timestamp.
Preferably, the 1st timestamp in the storage original time stamp sequence, the 2nd timestamp of storage to n-th A respective deviation of timestamp and storage deviation number include:
Sequence according to the 1st timestamp to n-th of timestamp in the original time stamp sequence, storage the 1st A timestamp, the 2nd timestamp of storage to the respective deviation of n-th of timestamp and storage deviation number to continuous time stab In sequence;
The deviation of 2nd timestamp x-th of timestamp into n-th of timestamp are as follows: x-th of timestamp and xth- The deviation between deviation or x-th of timestamp and the 1st timestamp between 1 timestamp, x be from 2 into n Any one number.
Preferably, the 1st in the continuous time stamp sequence is the value of identifier, and the value of the identifier is used for Show that the relationship between the timestamp of the continuous time stamp sequence storage is serial relation.
Preferably, the method also includes: the sampling interval of the original time stamp sequence is stored in the consecutive hours Between stab sequence in.
The present invention provides a kind of data restoration method, which comprises
Acquisition time stabs the identifier in sequence, wherein the timestamp sequence is based on claim 1 to 6 any one The sequence that the method handles original time stamp sequence;
If the value of the identifier in the timestamp sequence shows that the timestamp sequence is continuous time to stab sequence, It obtains and indicates the 1st timestamp in the continuous time stamp sequence, indicate that the 2nd timestamp is respective partially to e-th of timestamp Difference and the field for indicating deviation number, and when based on the 2nd the 1st timestamp of expressions, expression timestamp to e-th Between stab respective deviation and indicate the field of deviation number, obtain the 1st timestamp to e-th of timestamp, e-1 is the company The deviation number of continuous timestamp sequential recording;
If the value of the identifier in the timestamp sequence shows that the timestamp sequence is that independent time stabs sequence, The timestamp recorded in the independent time stamp sequence is calculated.
The present invention provides a kind of data storage device, and described device includes:
First obtains module, and for obtaining i-th of timestamp in original time stamp sequence, i is any into n from 2 One number, n are timestamp sum in the original time stamp sequence;
First returns to execution module, if the relationship between i-th of timestamp and (i-1)-th timestamp is continuous Relationship, and i-th of timestamp is not n-th of timestamp, then adds 1 to i and trigger the first acquisition module;
First memory module, if being continuous close for the relationship between i-th of timestamp and (i-1)-th timestamp System, and i-th of timestamp is n-th of timestamp, then stores the in the original time stamp sequence the 1st timestamp, deposits The 2nd timestamp is stored up to the respective deviation of n-th of timestamp and storage deviation number.
Preferably, described device further include:
Second memory module, if being discontinuous close for the relationship between i-th of timestamp and (i-1)-th timestamp System, and i-th of timestamp is n-th of timestamp, then individually stores i-th of timestamp;
Second returns to execution module, if being not connect for the relationship between i-th of timestamp and (i-1)-th timestamp Continuous relationship, and i-th of timestamp is not n-th of timestamp, then i-th of timestamp is determined as the original time stamp sequence The 1st new timestamp in column, and is added by 1 and triggers described first by i and obtains module;
Third memory module, for the 1st timestamp in the original time stamp sequence to (i-1)-th timestamp base Relationship storage between timestamp.
The present invention provides a kind of data recovery device, and described device includes:
Second obtains module, for the identifier in acquisition time stamp sequence, wherein the timestamp sequence is based on power The sequence that benefit requires 8 to 9 any one described devices to handle original time stamp sequence;
First recovery module is if the value for the identifier in the timestamp sequence shows the timestamp sequence Continuous time stabs sequence, then obtaining indicates the 1st timestamp, indicates the 2nd timestamp to e in the continuous time stamp sequence A respective deviation of timestamp and the field for indicating deviation number, and based on the 1st timestamp of the expression, expression the 2nd A timestamp obtains the 1st timestamp to e to the field of the respective deviation of e-th of timestamp and expression deviation number A timestamp, e-1 are the deviation number for the continuous time stabbing sequential recording;
Second recovery module is if the value for the identifier in the timestamp sequence shows the timestamp sequence Independent time stabs sequence, then the timestamp recorded in the independent time stamp sequence is calculated.
From above-mentioned technical proposal it is found that by obtaining i-th of timestamp in original time stamp sequence, if i-th of time Relationship between stamp and (i-1)-th timestamp is serial relation and i-th of timestamp is not that n-th of timestamp then adds 1 return to i I-th of the timestamp obtained in original time stamp sequence is executed, if the relationship between i-th of timestamp and (i-1)-th timestamp For serial relation and i-th of timestamp is that n-th of timestamp then stores the 1st timestamp in original time stamp sequence, storage 2nd timestamp can be restored each to the respective deviation of n-th of timestamp and storage deviation number by deviation The corresponding unique time stamps of deviation, being achieved in by way of storing deviation reduces the occupancy of memory space, in this way It does not need to abandon deviation when storing deviation, and makes original time stamp sequence by way of storing deviation Each timestamp in column can accurate reproduction, to improve the integrality and authenticity of timestamp.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is the present invention Some embodiments for those of ordinary skill in the art without creative efforts, can also basis These attached drawings obtain other attached drawings.
Fig. 1 is a kind of flow chart of date storage method provided in an embodiment of the present invention;
Fig. 2 is the flow chart of another date storage method provided in an embodiment of the present invention;
Fig. 3 is a kind of flow chart of data restoration method provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of data storage device provided in an embodiment of the present invention;
Fig. 5 is the structural schematic diagram of another data storage device provided in an embodiment of the present invention;
Fig. 6 is a kind of structural schematic diagram of data recovery device provided in an embodiment of the present invention.
Specific embodiment
Because of various fields, as the real time data of industrial control field be generated by collector timing sampling, so Between the corresponding timestamp of real time data often it is regular be incremented by, as theoretically meet between the corresponding timestamp of real time data as Lower feature:
T1, t2=t1+ △ t, t3=t2+ △ t ... ..tn=tn-1+ △ t, wherein △ t is the sampling interval, thus can be total Bear the theory rule followed between two neighboring timestamp in the timestamp sequence being made of multiple timestamps are as follows: tn=tn-1 + △ t (n=2,3 ...).
But actually due to the acquisition precision of collector and other a variety of causes, each timestamp will appear to a certain degree Deviation, the value of the timestamp in timestamp sequence are as follows: t1+d1, t2=t1+ △ t+d2, t3=t2+ △ t+d3 ..., Tn=tn-1+ △ t+dn (n >=2), therefore followed on theoretical regular basis between two neighboring timestamp in timestamp sequence Rule are as follows:
Tn=tn-1+ △ t+dn (n >=2).Wherein d2, d3 ..., dn is deviation, if collector is uninterruptedly adopted Collection, then the value of △ t+dn can fluctuate above or below sampling interval △ t.
Assuming that each timestamp is indicated using int64 when storage time stabs sequence, then each timestamp occupies 8 Byte, this memory space for resulting in timestamp sequence to occupy can be very big, and inventor can use for reference above-mentioned tn=tn- by observation The rule of 1+ △ t+dn (n >=2) replaces timestamp using deviation, why using deviation replace timestamp be because are as follows: For deviation for timestamp, the value of deviation will be much smaller than the value of timestamp, in this way can when storing deviation It to use lesser memory space, such as uses but is not limited to store using 2 bytes, so that the storage that timestamp sequence occupies Space is greatly reduced, and is based on this thinking, and the present invention provides a kind of date storage method, data restoration method and device.
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Referring to Fig. 1, it illustrates a kind of flow chart of date storage method provided in an embodiment of the present invention, for reducing The memory space that timestamp sequence occupies, may comprise steps of:
S101: obtaining i-th of timestamp in original time stamp sequence, and i is from 2 any one number into n, and n is original Timestamp sum in beginning timestamp sequence.It is to be understood that in original time stamp sequence each timestamp be ordered as from 1 to N, but during actual storage each timestamp can be successively obtained since the 2nd timestamp of original time stamp sequence Until arrive original time stamp sequence the last one timestamp, while the 2nd timestamp between the last one timestamp appoint One timestamp only obtains once, is performed both by subsequent step to each timestamp.Why can be obtained since the 2nd timestamp Take is because being and the 1st timestamp based on the relationship between i-th of timestamp and (i-1)-th timestamp in follow-up storage It is first in original time stamp sequence, the timestamp before the 1st timestamp is not present for the 1st timestamp, And it also can determine the storage mode of the 1st timestamp by the relationship of the 1st timestamp and the 2nd timestamp.
It if included 10 timestamps in original time stamp sequence, is then successively obtained since the 2nd timestamp, until obtaining When to the 10th timestamp, acquisition terminates, one timestamp of every acquisition, executes following steps to the timestamp currently got, To judge the timestamp currently got and the relationship between its adjacent previous timestamp, and determined such as based on the relationship What storage time stamp.
S102: if the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, and i-th of timestamp is not It is n-th of timestamp, then adds 1 return to execute the step of obtaining i-th of timestamp in original time stamp sequence i.
In the present embodiment, judge a kind of feasible pattern of the relationship between i-th of timestamp and (i-1)-th timestamp It is: obtains i-th of timestamp and (i-1)-th timestamp, i-th of timestamp and (i-1)-th timestamp is based on, when obtaining i-th Between stab and (i-1)-th timestamp between deviation (being denoted as i-th of deviation in order to facilitate description), if i-th of deviation With continuity, it is determined that the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, if i-th of deviation Value does not have continuity, then the relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship.
Wherein judge whether i-th of deviation there is a kind of successional feasible pattern to be: whether judging i-th of deviation In threshold range, if i-th of deviation, in threshold range, i-th of deviation has continuity, if i-th inclined Difference is not in threshold range, then i-th deviation does not have a continuity, threshold range can be but not limited to [- 32768 ,+ 32767], if therefore i-th of deviation be located in [- 32768 ,+32767], then confirm that i-th of deviation has continuity, it is no Do not have continuity then.
A kind of feasible pattern for determining i-th of timestamp not and be n-th of timestamp is: obtaining the value of i, acquisition time stamp Total n, judges whether i is greater than or equal to n, if i is greater than or equal to n, i-th of timestamp is n-th of timestamp, if i Less than n, then i-th of timestamp is not n-th of timestamp.
It should be understood that adding 1 return to execute the step of obtaining i-th of timestamp in original time stamp sequence i is Refer to: the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, then returns and obtain original time stamp sequence In i+1 timestamp, relationship such as between the 5th timestamp and the 4th timestamp is serial relation, then continues to obtain The 6th timestamp in original time stamp sequence.
S103: if the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, and i-th of timestamp is N-th of timestamp then stores the 1st timestamp, the 2nd timestamp of storage to n-th of timestamp in original time stamp sequence Respective deviation and storage deviation number.
In the present embodiment, it stores the 1st timestamp in original time stamp sequence, store the 2nd timestamp to n-th A kind of feasible pattern of the respective deviation of timestamp and storage deviation number is: according to the 1st timestamp to n-th of time The sequence in original time stamp sequence is stabbed, the 2nd the 1st timestamp of storage, storage timestamp are respective to n-th of timestamp Deviation and storage deviation number are into continuous time stamp sequence.
That is, also saying relative to original time stamp sequence, each storage unit is stored in original time stamp sequence One timestamp, and the 1st storage unit storage in continuous time stamp sequence is the 1st timestamp, other storage units Storage be timestamp deviation, and in continuous time stamp sequence the content of each storage unit storage be still according to it is original when Between stab sequence in the 1st timestamp to n-th of timestamp sequence.
The wherein deviation of the 2nd timestamp x-th of timestamp into n-th of timestamp are as follows: x-th of timestamp and xth- The deviation between deviation or x-th of timestamp and the 1st timestamp between 1 timestamp, x be from 2 into n Any one number.That is, each timestamp of the 2nd timestamp into n-th of timestamp has 1 corresponding deviation Value such as obtains the 2nd timestamp and the respective deviation of n-th of timestamp by above-mentioned tn=tn-1+ △ t+dn (n >=2) D2, d3 ..., dn, and it is based on d2, d3 ..., the sequence of dn is sequentially stored in continuous time stamp sequence, by tn= Tn-1+ △ t+dn (n >=2) know that deviation is the deviation between -1 timestamp of x-th of timestamp and xth, may be used also certainly To use other modes, such as deviation between x-th of timestamp and the 1st timestamp, i.e., on the basis of the 1st timestamp, Deviation of the other times stamp relative to the 1st timestamp is calculated, or using being calculated on the basis of other times stamp, originally Embodiment is not illustrating.
It should be understood that when storing the 1st timestamp in original time stamp sequence, the 2nd timestamp to n-th Between while stab respective deviation, it is also desirable to store deviation number, deviation number can be passed through in data convert in this way Determine the deviation stored in continuous time stamp sequence, if the timestamp t2 to t5 in original time stamp sequence is serial relation, Then in continuous time stamp sequence while storage t2 respective to t5 deviation, also storage deviation number to consecutive hours Between stab sequence in, this continuous time stab sequence in deviation number value be 4.
In order to whether be the data stabbed continuous time in sequence convenient for the current data of determination during data convert, Continuous time stamp sequence can be marked by way of identifier, if the 1st in continuous time stamp sequence is mark The value of symbol, the value of the identifier are used to show that the relationship between the timestamp of continuous time stamp sequence storage to be continuous Relationship, for example, when identifier value be 1, be shown to be continuous time stamp sequence and continuous time stamp sequence storage timestamp it Between relationship be serial relation, then the number stored for the 2nd storage unit into n-th of storage unit in data convert Timestamp is restored according to the mode that tn=tn-1+ △ t+dn (n >=2) can be used, dn is then the n-th of n-th of storage unit storage The corresponding deviation of a timestamp, △ t are the sampling interval.The byte for wherein storing the storage unit of deviation can be according to deviation Depending on, if deviation needs to occupy 2 bytes or 4 bytes, then 2 bytes can be distributed for storage unit or 4 bytes are come Deviation is stored, the byte of storage unit distribution is not defined herein, as long as being less than timestamp in original time stamp sequence The byte of occupancy.
And it can be stabbed thus in continuous time from tn=tn-1+ △ t+dn (n >=2) it is found that needing △ t in reduction The sampling interval is stored in sequence, which can store the last one storage unit in continuous time stamp sequence, i.e. phase For original time stamp sequence, increase a storage unit to store the sampling interval, as shown in table 1.
A kind of storage mode of 1 continuous time of table stamp sequence
Certainly other storage modes, the deviation corresponding with the 2nd timestamp such as after the 1st timestamp can also be used The sampling interval is stored between value, this present embodiment is not being illustrated, or the sampling interval is interacted using preparatory interactive mode, In order to carry out data convert.For deviation number, it can store after the 1st timestamp and the 2nd time It stabs between corresponding deviation, or is stored in other positions, the present embodiment is to the position of deviation number without limiting.
From above-mentioned technical proposal it is found that by obtaining i-th of timestamp in original time stamp sequence, if i-th of time Relationship between stamp and (i-1)-th timestamp is serial relation and i-th of timestamp is not that n-th of timestamp then adds 1 return to i I-th of the timestamp obtained in original time stamp sequence is executed, if the relationship between i-th of timestamp and (i-1)-th timestamp For serial relation and i-th of timestamp is that n-th of timestamp then stores the 1st timestamp in original time stamp sequence, storage 2nd timestamp can be restored each to the respective deviation of n-th of timestamp and storage deviation number by deviation The corresponding unique time stamps of deviation, being achieved in by way of storing deviation reduces the occupancy of memory space, in this way It does not need to abandon deviation when storing deviation, and makes original time stamp sequence by way of storing deviation Each timestamp in column can accurate reproduction, to improve the integrality and authenticity of timestamp.
Opposite, if the case where relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, i-th Timestamp is also required to be stored, and present embodiments provides the flow chart of another date storage method thus, when illustrating i-th Between stab and (i-1)-th timestamp between relationship be discontinuous relationship when storage mode, base of the date storage method in Fig. 1 It may comprise steps of on plinth:
S104: if relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, and i-th of timestamp It is n-th of timestamp, then individually stores i-th of timestamp.
Wherein judge the relationship between i-th of timestamp and (i-1)-th timestamp and determines that i-th of timestamp is not n-th A timestamp is identical as above-mentioned steps S102 implementation procedure and principle, is not repeating herein.But with step S102 difference It is: if the relationship between two adjacent timestamps is discontinuous relationship and i-th of timestamp is n-th of timestamp, can incites somebody to action I-th of timestamp individually stores, and such as i-th of timestamp is stored in an independent time stamp sequence, which stabs sequence Column can only store one and the relationship of adjacent timestamp is the timestamp of discontinuous relationship, or store multiple and adjacent The relationship of timestamp is the timestamp of discontinuous relationship.
It is corresponding with continuous time stamp sequence, independent time stamp sequence is also required to configure taking for an identifier for it Value, such as value in the 1st record identifier of independent time stamp sequence, the value of the identifier and continuous time are stabbed in sequence The value of identifier is different, if the value of identifier in independent time stamp sequence is 0, to show in independent time stamp sequence It is discontinuous relationship that each timestamp of storage, which is with the relationship of other times stamp,.
Herein it should be understood that if an original time stamp sequence, obtain at least one continuous time stamp sequence and At least one independent time stabs sequence, and each independent time stamp sequence only stores a timestamp, then in storage consecutive hours Between stab sequence and independent time stamp sequence when, need according to continuous time stab sequence and independent time stamp sequence in timestamp in original Sequence in beginning timestamp sequence stores, if original time stamp sequence is by 10 timestamps, wherein the 1st timestamp is to the 3rd A timestamp forms a continuous time stamp sequence (being denoted as continuous time stamp sequence 1 for ease of description), and the 4th timestamp exists (it is denoted as independent time stamp sequence 1 for ease of description) in one independent time stamp sequence, the 5th timestamp sequence is to the 10th Timestamp form continuous time stamp sequence (be denoted as continuous time stamp sequence 2 for ease of description, then in storage this three The positional relationship of a timestamp sequence are as follows: continuous time stabs sequence 1, independent time stamp sequence 1 and continuous time and stabs sequence 2, this Sample can successively restore the data in these three timestamp sequences in reduction, the sequence of the timestamp after reduction are as follows: 1st timestamp, the 2nd timestamp ..., the 10th timestamp, sequence and the timestamp in original time stamp sequence It sorts identical.
If multiple timestamps are stored in an independent time stamp sequence, in order to make the sequence of the timestamp restored It is identical as the sequence of timestamp in original time stamp sequence, then it needs to stab in sequence and independent time stamp sequence in continuous time and deposit The sequence of timestamp and deviation in original time stamp sequence is stored up, it in this way can be according to the sequence to reduction in reduction Timestamp is arranged.
S105: if relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, and i-th of timestamp It is not n-th of timestamp, then i-th of timestamp is determined as the 1st new timestamp in original time stamp sequence, and to i 1 return is added to execute the step of obtaining i-th of timestamp in original time stamp sequence.
That is, the relationship between some timestamp in original time stamp sequence and its previous timestamp is not connect Continuous relationship, then can using timestamp as the 1st new timestamp in original time stamp sequence, then from newly the 1st when Between stamp start successively to obtain the other times stamp after being located at the 1st new timestamp in original time stamp sequence, and to new The 1st timestamp and the other times stamp after the 1st new timestamp carry out the judgement of relationship and based on relationship Storage.
For example, the relationship between the 5th timestamp and the 4th timestamp in original time stamp sequence is discontinuous closes System, and the 5th timestamp is not n-th of timestamp (i.e. the last one timestamp), then using the 5th timestamp as the new the 1st A timestamp, and continue successively to obtain the other times stamp after the 1st new timestamp, i.e., the 6th timestamp is to n-th Timestamp.
S106: to the 1st timestamp in original time stamp sequence to (i-1)-th timestamp based on the pass between timestamp System's storage.
In the present embodiment, timestamp is based on to the 1st timestamp in original time stamp sequence to (i-1)-th timestamp Between relationship storage need the value based on i depending on, it is specific: if the value of i is equal to 2, individually to store original time stamp The 1st timestamp in sequence.
If the value of i is greater than 2, if being serial relation and the time adjacent to each other there are relationship in original time stamp sequence The continuous time of stamp composition stabs sequence, then stores the 1st timestamp in continuous time stamp sequence, stores the 2nd timestamp extremely The respective deviation of m-th of timestamp and storage deviation number, m-1 are continuous time to stab sequence large deviations value number.
That is it is greater than 2 in the value of i, if between multiple timestamps continuous each other in original time stamp sequence Relationship be serial relation, then be considered as this multiple timestamp and form continuous times stamp sequence.Such as original time stamp sequence Into (i-1)-th timestamp, to+a timestamps of jth, (a is the nature more than or equal to 1 to j-th of timestamp to 1st timestamp of column Number) in, the relationship between two timestamps of arbitrary neighborhood is serial relation, then regards j-th of timestamp to+a timestamps of jth A continuous time stamp sequence is formed, then for this continuous time stamp sequence, using j-th of timestamp as the 1st Timestamp stores the 1st timestamp in continuous time stamp sequence, storage other times stab respective deviation and storage deviation It is worth number, the acquisition modes that other times stab respective deviation is please referred to the explanation in above method embodiment.
If the value of i is greater than 2, if j-th timestamp and -1 timestamp of jth in original time stamp sequence nucleotide sequence it Between relationship be discontinuous relationship and the relationship between+1 timestamp of jth is discontinuous relationship, then when individually storing original Between stab sequence in j-th of timestamp.Such as j-th of timestamp can be stored in one independent time stamp sequence, for The explanation of independent time stamp sequence please refers to the related description in above method embodiment.
Below by taking an original time stamp sequence includes 10 timestamps as an example, method shown in above-mentioned Fig. 1 and Fig. 2 is carried out Illustrate: there are following relationships between this 10 timestamps:
The first relationship is: the relationship in 10 timestamps between two timestamps of arbitrary neighborhood is serial relation, then This 10 timestamps are stored in a continuous time stamp sequence, storage mode are as follows: store this in continuous time stamp sequence The 1st timestamp, storage other times in 10 timestamps stab respective deviation and storage deviation number.
Second of relationship is: in 10 timestamps the 10th timestamp and/or the 1st timestamp respectively with the adjacent time Relationship between stamp is discontinuous relationship, and the relationship between other times stamp is serial relation, then individually stores the 10th time Stamp and/or the 1st timestamp can store in a continuous time stamp sequence other times stamp, storage mode are as follows: this The storage time stamp of sequence the 1st in a little timestamps, the respective deviation of storage of other sequences, such as other times stamp are the 2nd A timestamp then stores the 2nd timestamp, the 3rd timestamp of storage to the to the 9th timestamp in continuous time stamp sequence 9 respective deviations of timestamp store deviation number.
The third relationship is: the stamp of the other times in addition to the 10th timestamp and the 1st timestamp in 10 timestamps Relationship between adjacent timestamp is discontinuous relationship, such as the 3rd timestamp and the 8th timestamp in 10 timestamps Respectively the relationship between adjacent timestamp is discontinuous relationship, and the relationship between other timestamps adjacent to each other is continuous Relationship then is respectively seen as being a continuous time by the three parts timestamp that the 3rd timestamp and the 8th timestamp are divided into Stab sequence, i.e. the 1st timestamp and the 2nd timestamp form a continuous time and stab sequence, when the 4th timestamp is to the 7th Between stamp form continuous time and stab sequence, the 9th timestamp and the 10th timestamp form a continuous time and stab sequence, right Any continuous time stamp sequence is stored according to the explanation in second of relationship in these three continuous times stamp sequence, for the 3rd A timestamp and the 8th timestamp can be then stored in independent time stamp sequence, such as by the 3rd timestamp and the 8th timestamp It is respectively stored in an independent time stamp sequence, and store corresponding deviation in stamp sequence of each continuous time Number.
From above-mentioned technical proposal it is found that if the relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous closes System, and i-th of timestamp is n-th of timestamp, then i-th of timestamp is individually stored, if when i-th of timestamp and (i-1)-th Between relationship between stamp be not serial relation, and i-th of timestamp is not n-th of timestamp, then can be to original time stamp sequence The 1st timestamp in column is stored to (i-1)-th timestamp based on the relationship between timestamp, and based between timestamp The case where when relationship stores in the presence of the deviation for storing some timestamps, the storage that thus can also reduce timestamp occupancy are empty Between, it is equally also stabbed without drop-out time, improves the integrality and authenticity of timestamp.
It please join Fig. 3, a kind of flow chart of data restoration method provided in an embodiment of the present invention be illustrated, for restoring Timestamp in timestamp sequence, specifically, data restoration method shown in Fig. 3 may comprise steps of:
S201: acquisition time stabs the identifier in sequence, and wherein timestamp sequence is based on above-mentioned date storage method pair The sequence that original time stamp sequence is handled, and the identifier in timestamp sequence can be based on above-mentioned date storage method The setting of identifier-location is obtained, such as the 1st in sequence is set identifier by above-mentioned date storage method, then can be from Identifier is obtained in 1st.
S202: it if the value of the identifier in timestamp sequence shows that timestamp sequence is continuous time to stab sequence, obtains Take indicated in continuous time stamp sequence the 1st timestamp, indicate the 2nd timestamp to the respective deviation of e-th of timestamp and Indicate the field of deviation number, and respective to e-th of timestamp based on the 2nd the 1st timestamp of expression, expression timestamp Deviation and the field for indicating deviation number obtain the 1st timestamp to e-th of timestamp, and e-1 is the continuous time to stab sequence Arrange the deviation number of record.
Wherein the value of the identifier in timestamp sequence shows that timestamp sequence is that continuous time one kind of stamp sequence can Line mode is: based on the identifier in timestamp sequence, the value of identifier is obtained, if the value of identifier meets the first threshold Value, then the timestamp sequence is continuous time to stab sequence,, should if the value of identifier is 1 if first threshold can be 1 Timestamp sequence is continuous time to stab sequence, and first threshold can be depending on practical application, and the present embodiment does not limit its value.
If timestamp sequence is continuous time to stab sequence, expression the 1st stored in continuous time stamp sequence is obtained Timestamp, the field for indicating the 2nd timestamp to the respective deviation of e-th of timestamp and expression deviation number, from these Data are obtained in field to be restored, are such as obtained for the 1st timestamp by N system operation, as continuous time stabs sequence Using can then restore the 1st timestamp when binary storage by binary arithmetic operation, for the 2nd timestamp and e For a timestamp, then it can be obtained based on respective deviation and tn=tn-1+ △ t+dn (n >=2) reduction.
S203: it if the value of the identifier in timestamp sequence shows that timestamp sequence is that independent time stabs sequence, counts Calculate the timestamp for obtaining recording in independent time stamp sequence.
Wherein the value of the identifier in timestamp sequence shows that one kind that timestamp sequence is independent time stamp sequence can Line mode is: based on the identifier in timestamp sequence, the value of identifier is obtained, if the value of identifier meets the second threshold Value, then the timestamp sequence is that independent time stabs sequence,, should if the value of identifier is 0 if second threshold can be 0 Timestamp sequence is that independent time stabs sequence, and second threshold can be depending on practical application, and the present embodiment does not limit its value.
A kind of feasible pattern of timestamp being calculated in independent time stamp sequence is: independent time is stabbed appointing in sequence The data are restored timestamp by N system operation by the data of one storage unit storage, as independent time stamp sequence uses two System then can restore timestamp by binary arithmetic operation when storing.
From above-mentioned technical proposal it is found that being obtained after above-mentioned date storage method is handled in original time stamp sequence Timestamp sequence, if the value of the identifier in timestamp sequence show timestamp sequence be continuous time stab sequence, obtain Take indicated in continuous time stamp sequence the 1st timestamp, indicate the 2nd timestamp to the respective deviation of e-th of timestamp and Indicate the field of deviation number, and respective to e-th of timestamp based on the 2nd the 1st timestamp of expression, expression timestamp Deviation and the field for indicating deviation number, obtain the 1st timestamp to e-th of timestamp, if the mark in timestamp sequence The value for knowing symbol shows that timestamp sequence is that independent time stabs sequence, then the time recorded in independent time stamp sequence is calculated Stamp realizes the reduction to the timestamp recorded in timestamp sequence.
For the various method embodiments described above, for simple description, therefore, it is stated as a series of action combinations, but Be those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because according to the present invention, certain A little steps can be performed in other orders or simultaneously.Secondly, those skilled in the art should also know that, it is retouched in specification The embodiment stated belongs to preferred embodiment, and related actions and modules are not necessarily necessary for the present invention.
Corresponding with above method embodiment, the embodiment of the present invention provides a kind of data storage device, structural schematic diagram As shown in figure 4, may include: that the first acquisition module 11, first returns to execution module 12 and the first memory module 13.
First obtains module 11, and for obtaining i-th of timestamp in original time stamp sequence, i is appointing into n from 2 It anticipates a number, n is timestamp sum in original time stamp sequence.It is to be understood that each time in original time stamp sequence Stamp be ordered as from 1 to n, but during actual storage can since the 2nd timestamp of original time stamp sequence according to It is secondary to obtain each timestamp until arriving the last one timestamp of original time stamp sequence, at the same the 2nd timestamp to last Any one timestamp between a timestamp only obtains once, handles each timestamp, why from the 2nd timestamp Start to please refer to the explanation in embodiment of the method the reason of acquisition.
First returns to execution module 12, if being to connect for the relationship between i-th of timestamp and (i-1)-th timestamp Continuous relationship, and i-th of timestamp is not n-th of timestamp, then adds 1 to i and trigger the first acquisition module 11 and continue to obtain Other times stamp in original time stamp sequence.
In the present embodiment, the first return execution module 12 judges the pass between i-th of timestamp and (i-1)-th timestamp A kind of feasible pattern of system is: i-th of timestamp and (i-1)-th timestamp is obtained, when being based on i-th of timestamp and (i-1)-th Between stab, obtain the deviation (being denoted as i-th of deviation in order to facilitate description) between i-th of timestamp and (i-1)-th timestamp, If i-th of deviation has continuity, it is determined that the relationship between i-th of timestamp and (i-1)-th timestamp is continuous closes System, if i-th of deviation does not have continuity, the relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous Relationship.Wherein whether i-th of deviation has successional judgement and determines whether i-th of timestamp is n-th of timestamp Explanation please refer to embodiment of the method, this is no longer illustrated.
First memory module 13, if being continuous close for the relationship between i-th of timestamp and (i-1)-th timestamp System, and i-th of timestamp is n-th of timestamp, then stores the in the original time stamp sequence the 1st timestamp, deposits The 2nd timestamp is stored up to the respective deviation of n-th of timestamp and storage deviation number.
In the present embodiment, it stores the 1st timestamp in original time stamp sequence, store the 2nd timestamp to n-th A kind of feasible pattern of the respective deviation of timestamp and storage deviation number is: according to the 1st timestamp to n-th of time The sequence in original time stamp sequence is stabbed, the 2nd the 1st timestamp of storage, storage timestamp are respective to n-th of timestamp Deviation and storage deviation number are into continuous time stamp sequence.
That is, also saying relative to original time stamp sequence, each storage unit is stored in original time stamp sequence One timestamp, and the 1st storage unit storage in continuous time stamp sequence is the 1st timestamp, other storage units Storage be timestamp deviation, and in continuous time stamp sequence the content of each storage unit storage be still according to it is original when Between stab sequence in the 1st timestamp to n-th of timestamp sequence, and continuous time stamp sequence a storage unit in Store deviation number.
The wherein deviation of the 2nd timestamp x-th of timestamp into n-th of timestamp are as follows: x-th of timestamp and xth- The deviation between deviation or x-th of timestamp and the 1st timestamp between 1 timestamp, x be from 2 into n Any one number, illustrates and please refers to embodiment of the method, no longer illustrates this present embodiment.
It furthermore whether is number in continuous time stamp sequence convenient for the current data of determination in order to during data convert According to, can by way of identifier to continuous time stamp sequence be marked, as continuous time stamp sequence in the 1st for mark Know the value of symbol, the value of the identifier is used to show that the relationship between the timestamp of continuous time stamp sequence storage to be to connect Continuous relationship, such as when the value of identifier is 1, it is shown to be the timestamp of continuous time stamp sequence and continuous time stamp sequence storage Between relationship be serial relation, then the 2nd storage unit is stored into n-th of storage unit in data convert The mode that tn=tn-1+ △ t+dn (n >=2) can be used in data restores timestamp, and dn is then that n-th of storage unit stores The corresponding deviation of n-th of timestamp, △ t are the sampling interval, which also can store in continuous time stamp sequence, Related description in embodiment of the method is please referred to for the storage in deviation and sampling interval.
From above-mentioned technical proposal it is found that by obtaining i-th of timestamp in original time stamp sequence, if i-th of time Relationship between stamp and (i-1)-th timestamp is serial relation and i-th of timestamp is not that n-th of timestamp then adds 1 return to i I-th of the timestamp obtained in original time stamp sequence is executed, if the relationship between i-th of timestamp and (i-1)-th timestamp For serial relation and i-th of timestamp is that n-th of timestamp then stores the 1st timestamp in original time stamp sequence, storage 2nd timestamp can be restored each to the respective deviation of n-th of timestamp and storage deviation number by deviation The corresponding unique time stamps of deviation, being achieved in by way of storing deviation reduces the occupancy of memory space, in this way It does not need to abandon deviation when storing deviation, and makes original time stamp sequence by way of storing deviation Each timestamp in column can accurate reproduction, to improve the integrality and authenticity of timestamp.
Opposite, if in the case that the relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, I-th of timestamp is also required to be stored, and present embodiments provides the structural schematic diagram of another data storage device thus, explains State the storage mode when relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, the data storage device It on the basis of fig. 4 may include: that the second memory module 14, second returns to execution module 15 and third memory module 16, such as Fig. 5 It is shown.
Second memory module 14, if the relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous Relationship, and i-th of timestamp is n-th of timestamp, then individually stores i-th of timestamp, i-th of timestamp is such as stored in one In a independent time stamp sequence.
Wherein judge the relationship between i-th of timestamp and (i-1)-th timestamp and determines that i-th of timestamp is not n-th A timestamp please refers to the explanation in above method embodiment, no longer illustrates this present embodiment.
It is corresponding with continuous time stamp sequence, independent time stamp sequence is also required to configure taking for an identifier for it Value, such as value in the 1st record identifier of independent time stamp sequence, the value of the identifier and continuous time are stabbed in sequence The value of identifier is different, if the value of identifier in independent time stamp sequence is 0, to show in independent time stamp sequence It is discontinuous relationship that each timestamp of storage, which is with the relationship of other times stamp,.
Herein it should be understood that if an original time stamp sequence, obtain at least one continuous time stamp sequence and At least one independent time stabs sequence, and each independent time stamp sequence only stores a timestamp, then in storage consecutive hours Between stab sequence and independent time stamp sequence when, need according to continuous time stab sequence and independent time stamp sequence in timestamp in original Sequence in beginning timestamp sequence stores, if original time stamp sequence is by 10 timestamps, wherein the 1st timestamp is to the 3rd A timestamp forms a continuous time stamp sequence (being denoted as continuous time stamp sequence 1 for ease of description), and the 4th timestamp exists (it is denoted as independent time stamp sequence 1 for ease of description) in one independent time stamp sequence, the 5th timestamp sequence is to the 10th Timestamp form continuous time stamp sequence (be denoted as continuous time stamp sequence 2 for ease of description, then in storage this three The positional relationship of a timestamp sequence are as follows: continuous time stabs sequence 1, independent time stamp sequence 1 and continuous time and stabs sequence 2, this Sample can successively restore the data in these three timestamp sequences in reduction, the sequence of the timestamp after reduction are as follows: 1st timestamp, the 2nd timestamp ..., the 10th timestamp, sequence and the timestamp in original time stamp sequence It sorts identical.
If multiple timestamps are stored in an independent time stamp sequence, in order to make the sequence of the timestamp restored It is identical as the sequence of timestamp in original time stamp sequence, then it needs to stab in sequence and independent time stamp sequence in continuous time and deposit The sequence of timestamp and deviation in original time stamp sequence is stored up, it in this way can be according to the sequence to reduction in reduction Timestamp is arranged.
Second returns to execution module 15, if being not for the relationship between i-th of timestamp and (i-1)-th timestamp Serial relation, and i-th of timestamp is not n-th of timestamp, then i-th of timestamp is determined as the original time stamp The 1st new timestamp in sequence, and is added by 1 and triggers the first acquisition module 11 by i and continues to obtain in original time stamp sequence Other times stamp.
That is, the relationship between some timestamp in original time stamp sequence and its previous timestamp is not connect Continuous relationship, then can using timestamp as the 1st new timestamp in original time stamp sequence, then from newly the 1st when Between stamp start successively to obtain the other times stamp after being located at the 1st new timestamp in original time stamp sequence, and to new The 1st timestamp and the other times stamp after the 1st new timestamp carry out the judgement of relationship and based on relationship Storage.
For example, the relationship between the 5th timestamp and the 4th timestamp in original time stamp sequence is discontinuous closes System, and the 5th timestamp is not n-th of timestamp (i.e. the last one timestamp), then using the 5th timestamp as the new the 1st A timestamp, and continue successively to obtain the other times stamp after the 1st new timestamp, i.e., the 6th timestamp is to n-th Timestamp.
Third memory module 16, for the 1st timestamp in the original time stamp sequence to (i-1)-th timestamp Based on the relationship storage between timestamp.
In the present embodiment, timestamp is based on to the 1st timestamp in original time stamp sequence to (i-1)-th timestamp Between relationship storage need the value based on i depending on, it is specific: if the value of i is equal to 2, individually to store original time stamp The 1st timestamp in sequence.
If the value of i is greater than 2, if being serial relation and the time adjacent to each other there are relationship in original time stamp sequence The continuous time of stamp composition stabs sequence, then stores the 1st timestamp in continuous time stamp sequence, stores the 2nd timestamp extremely The respective deviation of m-th of timestamp and storage deviation number, m-1 are continuous time to stab sequence large deviations value number.
That is it is greater than 2 in the value of i, if between multiple timestamps continuous each other in original time stamp sequence Relationship be serial relation, then be considered as this multiple timestamp and form continuous times stamp sequence.Such as original time stamp sequence Into (i-1)-th timestamp, to+a timestamps of jth, (a is the nature more than or equal to 1 to j-th of timestamp to 1st timestamp of column Number) in, the relationship between two timestamps of arbitrary neighborhood is serial relation, then regards j-th of timestamp to+a timestamps of jth A continuous time stamp sequence is formed, then for this continuous time stamp sequence, using j-th of timestamp as the 1st Timestamp stores the 1st timestamp in continuous time stamp sequence, storage other times stab respective deviation and storage deviation It is worth number, the acquisition modes that other times stab respective deviation is please referred to the explanation in above method embodiment.
If the value of i is greater than 2, if j-th timestamp and -1 timestamp of jth in original time stamp sequence nucleotide sequence it Between relationship be discontinuous relationship and the relationship between+1 timestamp of jth is discontinuous relationship, then when individually storing original Between stab sequence in j-th of timestamp.Such as j-th of timestamp can be stored in one independent time stamp sequence, for The explanation of independent time stamp sequence please refers to the related description in above method embodiment.Specifically, above method implementation please be join Example, details are not described herein.
The embodiment of the present invention also provides a kind of data recovery device, and structure is as shown in fig. 6, may include: the second acquisition Module 21, the first recovery module 22 and the second recovery module 23.
Second obtains module 21, and for the identifier in acquisition time stamp sequence, wherein timestamp sequence is based on above-mentioned The sequence that data storage device handles original time stamp sequence, and the identifier in timestamp sequence can be based on it is upper It states data storage device to obtain the setting of identifier-location, such as above-mentioned data storage device sets the 1st in sequence to Identifier then can obtain identifier from the 1st.
First recovery module 22, if the value for the identifier in the timestamp sequence shows the timestamp sequence Sequence is stabbed for continuous time, then obtains in the continuous time stamp sequence and indicates the 1st timestamp, indicate the 2nd timestamp extremely The respective deviation of n-th of timestamp and the field for indicating deviation number, and based on the 1st timestamp of the expression, expression 2nd timestamp obtains the 1st timestamp extremely to the field of the respective deviation of e-th of timestamp and expression deviation number E-th of timestamp, e-1 are the deviation number for the continuous time stabbing sequential recording.
Wherein the value of the identifier in timestamp sequence shows that timestamp sequence is that continuous time one kind of stamp sequence can Line mode is: based on the identifier in timestamp sequence, the value of identifier is obtained, if the value of identifier meets the first threshold Value, then the timestamp sequence is continuous time to stab sequence,, should if the value of identifier is 1 if first threshold can be 1 Timestamp sequence is continuous time to stab sequence, and first threshold can be depending on practical application, and the present embodiment does not limit its value.
If timestamp sequence is continuous time to stab sequence, the 1st time stored in continuous time stamp sequence is obtained Stamp, the 2nd timestamp of storage to the respective deviation of e-th of timestamp and the field for storing deviation number, from these fields Middle acquisition data are restored, and are such as obtained for the 1st timestamp by N system operation, as continuous time stamp sequence uses The 1st timestamp can be then restored when binary storage by binary arithmetic operation, when for the 2nd timestamp and e-th Between for stamp, then can be obtained based on respective deviation and tn=tn-1+ △ t+dn (n >=2) reduction.
Second recovery module 23, if the value for the identifier in the timestamp sequence shows the timestamp sequence Sequence is stabbed for independent time, then the timestamp recorded in the independent time stamp sequence is calculated.Wherein in timestamp sequence The value of identifier show that timestamp sequence is that independent time stabs a kind of feasible pattern of sequence and is: based in timestamp sequence Identifier, obtain the value of identifier, if the value of identifier meets second threshold, the timestamp sequence be it is independent when Between stab sequence, if second threshold can be 0, if the value of identifier be 0, the timestamp sequence be independent time stab sequence Column, second threshold can be depending on practical application, and the present embodiment does not limit its value.
A kind of feasible pattern of timestamp being calculated in independent time stamp sequence is: independent time is stabbed appointing in sequence The data are restored timestamp by N system operation by the data of one storage unit storage, as independent time stamp sequence uses two System then can restore timestamp by binary arithmetic operation when storing.
From above-mentioned technical proposal it is found that being obtained after above-mentioned date storage method is handled in original time stamp sequence Timestamp sequence, if the value of the identifier in timestamp sequence show timestamp sequence be continuous time stab sequence, obtain Take indicated in continuous time stamp sequence the 1st timestamp, indicate the 2nd timestamp to the respective deviation of e-th of timestamp and Indicate the field of deviation number, and respective to e-th of timestamp based on the 2nd the 1st timestamp of expression, expression timestamp Deviation and the field for indicating deviation number, obtain the 1st timestamp to e-th of timestamp, if the mark in timestamp sequence The value for knowing symbol shows that timestamp sequence is that independent time stabs sequence, then the time recorded in independent time stamp sequence is calculated Stamp realizes the reduction to the timestamp recorded in timestamp sequence.
It should be noted that all the embodiments in this specification are described in a progressive manner, each embodiment weight Point explanation is the difference from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For device class embodiment, since it is basically similar to the method embodiment, so being described relatively simple, related place ginseng See the part explanation of embodiment of the method.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that the process, method, article or equipment for including a series of elements not only includes that A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged Except there is also other identical elements in the process, method, article or apparatus that includes the element.
The foregoing description of the disclosed embodiments can be realized those skilled in the art or using the present invention.To this A variety of modifications of a little embodiments will be apparent for a person skilled in the art, and the general principles defined herein can Without departing from the spirit or scope of the present invention, to realize in other embodiments.Therefore, the present invention will not be limited It is formed on the embodiments shown herein, and is to fit to consistent with the principles and novel features disclosed in this article widest Range.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (10)

1. a kind of date storage method, which is characterized in that the described method includes:
I-th of timestamp in original time stamp sequence is obtained, i is from 2 any one number into n, and n is the original time Stab timestamp sum in sequence;
If the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, and i-th of timestamp is not It is n-th of timestamp, then adds 1 return to execute the step of obtaining i-th of timestamp in original time stamp sequence i;
If the relationship between i-th of timestamp and (i-1)-th timestamp is serial relation, and i-th of timestamp is N-th of timestamp, then when storing the 2nd the 1st timestamp in the original time stamp sequence, storage timestamp to n-th Between stab respective deviation and storage deviation number.
2. the method according to claim 1, wherein the method also includes:
If the relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, and i-th of timestamp is n-th A timestamp then individually stores i-th of timestamp;
If the relationship between i-th of timestamp and (i-1)-th timestamp is discontinuous relationship, and i-th of timestamp is not I-th of timestamp is then determined as the 1st new timestamp in the original time stamp sequence by n-th of timestamp, and I plus 1 is returned and executes the step of obtaining i-th of timestamp in original time stamp sequence;
The 1st timestamp in the original time stamp sequence is deposited to (i-1)-th timestamp based on the relationship between timestamp Storage.
3. according to the method described in claim 2, it is characterized in that, it is described to the 1st in the original time stamp sequence when Between stamp to (i-1)-th timestamp include: based on the relationship storage between timestamp
If the value of i is equal to 2, the 1st timestamp in the original time stamp sequence is individually stored;
If the value of i is greater than 2, if being serial relation and the time adjacent to each other there are relationship in the original time stamp sequence The continuous time of stamp composition stabs sequence, then stores the 1st timestamp in the continuous time stamp sequence, stores the 2nd time For stamp to the respective deviation of m-th of timestamp and storage deviation number, m-1 is the continuous time to stab sequence large deviations value Number, if the relationship between -1 timestamp of j-th of timestamp in the original time stamp sequence and jth is discontinuous relationship And the relationship between+1 timestamp of jth is discontinuous relationship, then individually stores j-th in the original time stamp sequence Timestamp.
4. the method according to claim 1, wherein the 1st in the storage original time stamp sequence Timestamp, the 2nd timestamp of storage to the respective deviation of n-th of timestamp and storage deviation number include:
Sequence according to the 1st timestamp to n-th of timestamp in the original time stamp sequence, when storing the 1st Between stamp, storage the 2nd timestamp to the respective deviation of n-th of timestamp and storage deviation number to continuous time stab sequence In;
The deviation of 2nd timestamp x-th of timestamp into n-th of timestamp are as follows: x-th of timestamp and xth -1 The deviation between deviation or x-th of timestamp and the 1st timestamp between timestamp, x are any into n from 2 One number.
5. according to the method described in claim 4, it is characterized in that, the 1st in continuous time stamp sequence is identifier Value, the value of the identifier is used to show that the relationship between the timestamp of the continuous time stamp sequence storage to be to connect Continuous relationship.
6. according to the method described in claim 4, it is characterized in that, the method also includes: by the original time stamp sequence Sampling interval be stored in continuous time stamp sequence.
7. a kind of data restoration method, which is characterized in that the described method includes:
Acquisition time stabs the identifier in sequence, wherein the timestamp sequence is based on described in claim 1 to 6 any one The sequence that method handles original time stamp sequence;
If the value of the identifier in the timestamp sequence shows that the timestamp sequence is continuous time to stab sequence, obtain The 1st timestamp is indicated in the continuous time stamp sequence, indicates the 2nd timestamp to the respective deviation of e-th of timestamp With the field for indicating deviation number, and based on the 2nd the 1st timestamp of expressions, expression timestamp to e-th of timestamp Respective deviation and the field for indicating deviation number obtain the 1st timestamp to e-th of timestamp, and e-1 is the consecutive hours Between stab sequential recording deviation number;
If the value of the identifier in the timestamp sequence shows that the timestamp sequence is that independent time stabs sequence, calculate Obtain the timestamp recorded in the independent time stamp sequence.
8. a kind of data storage device, which is characterized in that described device includes:
First obtains module, and for obtaining i-th of timestamp in original time stamp sequence, i is from 2 any one into n Number, n are timestamp sum in the original time stamp sequence;
First returns to execution module, if being continuous close for the relationship between i-th of timestamp and (i-1)-th timestamp System, and i-th of timestamp is not n-th of timestamp, then adds 1 to i and trigger the first acquisition module;
First memory module, if it is serial relation for the relationship between i-th of timestamp and (i-1)-th timestamp, and I-th of timestamp is n-th of timestamp, then stores the 1st timestamp in the original time stamp sequence, stores the 2nd A timestamp is to the respective deviation of n-th of timestamp and stores deviation number.
9. device according to claim 8, which is characterized in that described device further include:
Second memory module, if being discontinuous relationship for the relationship between i-th of timestamp and (i-1)-th timestamp, And i-th of timestamp is n-th of timestamp, then individually stores i-th of timestamp;
Second returns to execution module, if being discontinuous close for the relationship between i-th of timestamp and (i-1)-th timestamp System, and i-th of timestamp is not n-th of timestamp, then i-th of timestamp is determined as in the original time stamp sequence The 1st new timestamp, and is added by 1 and triggers described first by i and obtains module;
Third memory module, when for being based on to the 1st timestamp to (i-1)-th timestamp in the original time stamp sequence Between stamp between relationship storage.
10. a kind of data recovery device, which is characterized in that described device includes:
Second obtains module, for the identifier in acquisition time stamp sequence, wherein the timestamp sequence is wanted based on right The sequence for asking 8 to 9 any one described devices to handle original time stamp sequence;
First recovery module, if the value for the identifier in the timestamp sequence shows that the timestamp sequence is continuous Timestamp sequence then obtains when indicating the 1st timestamp in continuous time stamp sequence, indicating the 2nd timestamp to e-th Between stab respective deviation and indicate deviation number field, and based on the 1st timestamp of expressions, expression the 2nd when Between stamp to the respective deviation of e-th of timestamp and indicate the field of deviation number, when obtaining the 1st timestamp to e-th Between stab, e-1 be the continuous time stab sequential recording deviation number;
Second recovery module, if the value for the identifier in the timestamp sequence shows that the timestamp sequence is independent The timestamp recorded in the independent time stamp sequence is then calculated in timestamp sequence.
CN201811509080.8A 2018-12-11 2018-12-11 Data storage method, data restoration method and device Active CN109597588B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811509080.8A CN109597588B (en) 2018-12-11 2018-12-11 Data storage method, data restoration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811509080.8A CN109597588B (en) 2018-12-11 2018-12-11 Data storage method, data restoration method and device

Publications (2)

Publication Number Publication Date
CN109597588A true CN109597588A (en) 2019-04-09
CN109597588B CN109597588B (en) 2020-09-04

Family

ID=65961616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811509080.8A Active CN109597588B (en) 2018-12-11 2018-12-11 Data storage method, data restoration method and device

Country Status (1)

Country Link
CN (1) CN109597588B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688362A (en) * 2019-08-27 2020-01-14 浙江浙大中控信息技术有限公司 Data sectional type storage method based on time stamp
CN112419698A (en) * 2020-10-26 2021-02-26 浙江正泰仪器仪表有限责任公司 Electric energy meter data transmission method, system and device based on distribution line message specification
WO2021226922A1 (en) * 2020-05-14 2021-11-18 深圳市欢太科技有限公司 Data compression method, apparatus and device, and readable storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100259631A1 (en) * 2007-10-26 2010-10-14 Fujifilm Corporation Data compression apparatus, data compression program and image-taking apparatus
CN102103630A (en) * 2010-12-08 2011-06-22 中国联合网络通信集团有限公司 Data compression method and device as well as data decompression method and device
CN103914449A (en) * 2012-12-29 2014-07-09 上海可鲁系统软件有限公司 Multisource time series data compression storage method
CN104035956A (en) * 2014-04-11 2014-09-10 江苏瑞中数据股份有限公司 Time-series data storage method based on distributive column storage
CN104281616A (en) * 2013-07-10 2015-01-14 北京旋极信息技术股份有限公司 Data processing method
CN106055430A (en) * 2016-05-27 2016-10-26 北京奇虎科技有限公司 System backup updating method and device for PTZ camera
CN106549673A (en) * 2016-10-27 2017-03-29 深圳市金证科技股份有限公司 A kind of data compression method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100259631A1 (en) * 2007-10-26 2010-10-14 Fujifilm Corporation Data compression apparatus, data compression program and image-taking apparatus
CN102103630A (en) * 2010-12-08 2011-06-22 中国联合网络通信集团有限公司 Data compression method and device as well as data decompression method and device
CN103914449A (en) * 2012-12-29 2014-07-09 上海可鲁系统软件有限公司 Multisource time series data compression storage method
CN104281616A (en) * 2013-07-10 2015-01-14 北京旋极信息技术股份有限公司 Data processing method
CN104035956A (en) * 2014-04-11 2014-09-10 江苏瑞中数据股份有限公司 Time-series data storage method based on distributive column storage
CN106055430A (en) * 2016-05-27 2016-10-26 北京奇虎科技有限公司 System backup updating method and device for PTZ camera
CN106549673A (en) * 2016-10-27 2017-03-29 深圳市金证科技股份有限公司 A kind of data compression method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688362A (en) * 2019-08-27 2020-01-14 浙江浙大中控信息技术有限公司 Data sectional type storage method based on time stamp
WO2021226922A1 (en) * 2020-05-14 2021-11-18 深圳市欢太科技有限公司 Data compression method, apparatus and device, and readable storage medium
CN112419698A (en) * 2020-10-26 2021-02-26 浙江正泰仪器仪表有限责任公司 Electric energy meter data transmission method, system and device based on distribution line message specification

Also Published As

Publication number Publication date
CN109597588B (en) 2020-09-04

Similar Documents

Publication Publication Date Title
CN109597588A (en) A kind of date storage method, data restoration method and device
CN109445972A (en) Data recovery method, device, equipment and storage medium
Fu et al. Techniques for optimization via simulation: an experimental study on an (s, S) inventory system
CN103294911B (en) A kind of time series similarity value-acquiring method and system
CN104978842B (en) A kind of method of low pressure concentrator clock self-regeneration
CN109165871A (en) Automatic scheduled production method, apparatus and computer readable storage medium
CN106155802A (en) Method for scheduling task, device and control node
CN107766219A (en) Automated testing log collection method, system, equipment and computer memory device
CN107169676A (en) A kind of system and method for the engineering material management of utilization planar bar code technology
CN106294824A (en) Manufacture Internet of Things towards the complex events detecting methods of uncertain data stream and system
CN111614520B (en) IDC flow data prediction method and device based on machine learning algorithm
CN107870940A (en) A kind of file memory method and device
CN112395298A (en) Data consistency management system based on data layering thought
CN110019564B (en) Table relation analysis supporting device and table relation analysis supporting method
CN104516914A (en) Method and device for recognizing time sequence mode
CN115983551A (en) Intelligent industrial production scheduling method, device, equipment and application
CN100389565C (en) Analytic method of expression type
Byrne et al. Scheduling of toll collectors
CN108255979A (en) A kind of data summarization method, data summarization platform and system
CN110990405B (en) Data loading method, device, server and storage medium
CN103970854B (en) Method for synchronizing incremental certificate information between SAP ECC end and SAP BW end
US10664542B2 (en) Platform device for passively distributed quantitative collective knowledge
CN113672776A (en) Fault analysis method and device
CN105251786A (en) Method for intelligent grouping rolled steel type in steel rolling process
CN106331132A (en) Node replacement method and device in distributed database

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: The invention relates to a data storage method, a data restoration method and a device

Effective date of registration: 20210615

Granted publication date: 20200904

Pledgee: The Bank of Hangzhou branch of Limited by Share Ltd. sea park

Pledgor: ZHEJIANG ZHONGZHIDA TECHNOLOGY Co.,Ltd.

Registration number: Y2021980004734

PC01 Cancellation of the registration of the contract for pledge of patent right
PC01 Cancellation of the registration of the contract for pledge of patent right

Date of cancellation: 20220713

Granted publication date: 20200904

Pledgee: The Bank of Hangzhou branch of Limited by Share Ltd. sea park

Pledgor: ZHEJIANG ZHONGZHIDA TECHNOLOGY Co.,Ltd.

Registration number: Y2021980004734

PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: A data storage method, data restore method and device

Effective date of registration: 20220720

Granted publication date: 20200904

Pledgee: The Bank of Hangzhou branch of Limited by Share Ltd. sea park

Pledgor: ZHEJIANG ZHONGZHIDA TECHNOLOGY Co.,Ltd.

Registration number: Y2022980010803