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.
Printable View
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.
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>.
@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)