|
-
April 5th, 2011, 01:34 AM
#1
How to add some interval?
I have a list of time stamp. like 1.00001, 1.10004, 1.100345 .............. 10.99999
I want to add 0.08 second in every 0.02 second interval.
How to write code for this?
Pls. help.
-
April 5th, 2011, 02:26 AM
#2
Re: How to add some interval?
first of all, if the format is fixed and bounded as it seems it's better to translate the time stamps in integral units ( in your case, 10uS units ); in this way, you save the potential problems of float comparisons/accumulation. Then, if I understood what you meant right, you can simply traverse the vector of time stamps adding 8000 to a counter whenever <input time stamp>/2000 changes ( supposing the first interval starts from 0 and intervals are left-closed, right-open ), then the output time stamp will be simply <input time stamp> + <counter>.
-
April 5th, 2011, 03:25 AM
#3
Re: How to add some interval?
@loves oi,
Thanks for your reply.
I have a list of time stamps from 1.000000 second to 10.999999 second. The gap between two time stamp is random.
Now I want to add 0.08 second in every 0.02 second interval. (i.e. after 0.02 second there will be 0.08 second rest time (or say gap))
Example 1: ---working time (when 0.02 sec) ----------- take 0.80 sec rest------ continue work for 0.02 second---------- take 0.80 rest------
Example2: (I don't know exactly, whether it's like this, but the concept is as below)
Original changed
1.000000 1.000000
1.000010 1.000010
......... ...............
1.020010 1.020010 + 0.08
1.031010 1.031010+ 0.08
............ ...............
1.035010 1.035010+ 0.08
1.040010 1.040010+ (0.08 *2)
Last edited by ritika_sharma82; April 5th, 2011 at 03:32 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|